[Libreoffice-commits] core.git: qadevOOo/objdsc sc/qa
Jens Carl (via logerrit)
logerrit at kemper.freedesktop.org
Mon Apr 8 23:30:05 UTC 2019
qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellFieldObj.csv | 4
sc/qa/extras/sceditfieldobj-cell.cxx | 78 +++++-----
sc/qa/extras/sceditfieldobj-header.cxx | 57 ++++---
3 files changed, 79 insertions(+), 60 deletions(-)
New commits:
commit 6c50ee3377756ae7da1ae039da35775c0a97ef2f
Author: Jens Carl <j.carl43 at gmx.de>
AuthorDate: Mon Apr 8 21:45:18 2019 +0000
Commit: Jens Carl <j.carl43 at gmx.de>
CommitDate: Tue Apr 9 01:29:36 2019 +0200
tdf#45904 Move XPropertySet Java tests to C++
Move remaining XPropertySet Java tests to ScEditFieldObj_Cell and
ScEditFieldObj_Header.
Change-Id: I43640c6ea5a35fcc1aa8e15be17dae7611551776
Reviewed-on: https://gerrit.libreoffice.org/70434
Tested-by: Jenkins
Reviewed-by: Jens Carl <j.carl43 at gmx.de>
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellFieldObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellFieldObj.csv
index 8ca686fff172..1912ae235b3b 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellFieldObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellFieldObj.csv
@@ -4,7 +4,3 @@
"ScCellFieldObj";"com::sun::star::text::TextContent";"AnchorType#optional"
"ScCellFieldObj";"com::sun::star::text::TextContent";"AnchorTypes#optional"
"ScCellFieldObj";"com::sun::star::text::TextContent";"TextWrap#optional"
-"ScCellFieldObj";"com::sun::star::beans::XPropertySet#optional";"addPropertyChangeListener()"
-"ScCellFieldObj";"com::sun::star::beans::XPropertySet#optional";"removePropertyChangeListener()"
-"ScCellFieldObj";"com::sun::star::beans::XPropertySet#optional";"addVetoableChangeListener()"
-"ScCellFieldObj";"com::sun::star::beans::XPropertySet#optional";"removeVetoableChangeListener()"
diff --git a/sc/qa/extras/sceditfieldobj-cell.cxx b/sc/qa/extras/sceditfieldobj-cell.cxx
index 7f39e88f1752..071be82489ff 100644
--- a/sc/qa/extras/sceditfieldobj-cell.cxx
+++ b/sc/qa/extras/sceditfieldobj-cell.cxx
@@ -13,19 +13,29 @@
#include <test/text/xtextcontent.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/table/XCell.hpp>
#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
#include <com/sun/star/text/XTextField.hpp>
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
-using namespace css;
-using namespace css::uno;
+#include <com/sun/star/uno/Reference.hxx>
-namespace sc_apitest {
+using namespace css;
-class ScEditFieldObj_Cell : public CalcUnoApiTest, public apitest::XTextField, public apitest::XTextContent, public apitest::XPropertySet
+namespace sc_apitest
+{
+class ScEditFieldObj_Cell : public CalcUnoApiTest,
+ public apitest::XPropertySet,
+ public apitest::XTextContent,
+ public apitest::XTextField
{
public:
ScEditFieldObj_Cell();
@@ -45,6 +55,8 @@ public:
CPPUNIT_TEST(testGetPropertySetInfo);
CPPUNIT_TEST(testGetPropertyValue);
CPPUNIT_TEST(testSetPropertyValue);
+ CPPUNIT_TEST(testPropertyChangeListener);
+ CPPUNIT_TEST(testVetoableChangeListener);
// XTextField
CPPUNIT_TEST(testGetPresentation);
@@ -66,7 +78,7 @@ private:
uno::Reference<text::XTextField> ScEditFieldObj_Cell::mxField;
ScEditFieldObj_Cell::ScEditFieldObj_Cell()
- : CalcUnoApiTest("/sc/qa/extras/testdocuments")
+ : CalcUnoApiTest("/sc/qa/extras/testdocuments")
{
}
@@ -84,41 +96,41 @@ void ScEditFieldObj_Cell::tearDown()
CalcUnoApiTest::tearDown();
}
-namespace {
-
+namespace
+{
uno::Reference<text::XTextField> getNewField(const uno::Reference<lang::XMultiServiceFactory>& xSM)
{
- uno::Reference<text::XTextField> xField(
- xSM->createInstance("com.sun.star.text.TextField.URL"), UNO_QUERY_THROW);
- uno::Reference<beans::XPropertySet> xPropSet(xField, UNO_QUERY_THROW);
+ uno::Reference<text::XTextField> xField(xSM->createInstance("com.sun.star.text.TextField.URL"),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPropSet(xField, uno::UNO_QUERY_THROW);
xPropSet->setPropertyValue("Representation", uno::makeAny(OUString("LibreOffice")));
xPropSet->setPropertyValue("URL", uno::makeAny(OUString("http://www.libreoffice.org/")));
return xField;
}
-}
+} // namespace
uno::Reference<uno::XInterface> ScEditFieldObj_Cell::init()
{
// Return a field that's already in the cell.
if (!mxField.is())
{
- uno::Reference<lang::XMultiServiceFactory> xSM(mxComponent, UNO_QUERY_THROW);
+ uno::Reference<lang::XMultiServiceFactory> xSM(mxComponent, uno::UNO_QUERY_THROW);
// Create a new URL field object, and populate it with name and URL.
mxField = getNewField(xSM);
// Insert this field into a cell.
- uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, UNO_QUERY_THROW);
- uno::Reference<container::XIndexAccess> xIA(xDoc->getSheets(), UNO_QUERY_THROW);
- uno::Reference<sheet::XSpreadsheet> xSheet(xIA->getByIndex(0), UNO_QUERY_THROW);
+ uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, uno::UNO_QUERY_THROW);
+ uno::Reference<container::XIndexAccess> xIA(xDoc->getSheets(), uno::UNO_QUERY_THROW);
+ uno::Reference<sheet::XSpreadsheet> xSheet(xIA->getByIndex(0), uno::UNO_QUERY_THROW);
// Use cell A1 for this.
uno::Reference<table::XCell> xCell = xSheet->getCellByPosition(0, 0);
- uno::Reference<text::XText> xText(xCell, UNO_QUERY_THROW);
+ uno::Reference<text::XText> xText(xCell, uno::UNO_QUERY_THROW);
uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor();
- uno::Reference<text::XTextRange> xRange(xCursor, UNO_QUERY_THROW);
- uno::Reference<text::XTextContent> xContent(mxField, UNO_QUERY_THROW);
+ uno::Reference<text::XTextRange> xRange(xCursor, uno::UNO_QUERY_THROW);
+ uno::Reference<text::XTextContent> xContent(mxField, uno::UNO_QUERY_THROW);
xText->insertTextContent(xRange, xContent, false);
}
return mxField;
@@ -127,33 +139,33 @@ uno::Reference<uno::XInterface> ScEditFieldObj_Cell::init()
uno::Reference<text::XTextContent> ScEditFieldObj_Cell::getTextContent()
{
// Return a field object that's not yet inserted.
- uno::Reference<lang::XMultiServiceFactory> xSM(mxComponent, UNO_QUERY_THROW);
- return uno::Reference<text::XTextContent>(getNewField(xSM), UNO_QUERY_THROW);
+ uno::Reference<lang::XMultiServiceFactory> xSM(mxComponent, uno::UNO_QUERY_THROW);
+ return uno::Reference<text::XTextContent>(getNewField(xSM), uno::UNO_QUERY_THROW);
}
uno::Reference<text::XTextRange> ScEditFieldObj_Cell::getTextRange()
{
// Use cell A2 for this.
- uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, UNO_QUERY_THROW);
- uno::Reference<container::XIndexAccess> xIA(xDoc->getSheets(), UNO_QUERY_THROW);
- uno::Reference<sheet::XSpreadsheet> xSheet(xIA->getByIndex(0), UNO_QUERY_THROW);
+ uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, uno::UNO_QUERY_THROW);
+ uno::Reference<container::XIndexAccess> xIA(xDoc->getSheets(), uno::UNO_QUERY_THROW);
+ uno::Reference<sheet::XSpreadsheet> xSheet(xIA->getByIndex(0), uno::UNO_QUERY_THROW);
uno::Reference<table::XCell> xCell = xSheet->getCellByPosition(0, 1);
- uno::Reference<text::XText> xText(xCell, UNO_QUERY_THROW);
+ uno::Reference<text::XText> xText(xCell, uno::UNO_QUERY_THROW);
uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor();
- uno::Reference<text::XTextRange> xRange(xCursor, UNO_QUERY_THROW);
+ uno::Reference<text::XTextRange> xRange(xCursor, uno::UNO_QUERY_THROW);
return xRange;
}
void ScEditFieldObj_Cell::testEditFieldProperties()
{
- uno::Reference<lang::XMultiServiceFactory> xSM(mxComponent, UNO_QUERY_THROW);
+ uno::Reference<lang::XMultiServiceFactory> xSM(mxComponent, uno::UNO_QUERY_THROW);
{
// Test properties of date time field.
uno::Reference<text::XTextField> xField(
- xSM->createInstance("com.sun.star.text.textfield.DateTime"), UNO_QUERY_THROW);
- uno::Reference<beans::XPropertySet> xPropSet(xField, UNO_QUERY_THROW);
+ xSM->createInstance("com.sun.star.text.textfield.DateTime"), uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPropSet(xField, uno::UNO_QUERY_THROW);
uno::Reference<beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo();
CPPUNIT_ASSERT_MESSAGE("failed to retrieve property set info.", xInfo.is());
@@ -165,8 +177,8 @@ void ScEditFieldObj_Cell::testEditFieldProperties()
{
// Test properties of document title field.
uno::Reference<text::XTextField> xField(
- xSM->createInstance("com.sun.star.text.textfield.docinfo.Title"), UNO_QUERY_THROW);
- uno::Reference<beans::XPropertySet> xPropSet(xField, UNO_QUERY_THROW);
+ xSM->createInstance("com.sun.star.text.textfield.docinfo.Title"), uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPropSet(xField, uno::UNO_QUERY_THROW);
uno::Reference<beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo();
CPPUNIT_ASSERT_MESSAGE("failed to retrieve property set info.", xInfo.is());
@@ -178,7 +190,7 @@ void ScEditFieldObj_Cell::testEditFieldProperties()
CPPUNIT_TEST_SUITE_REGISTRATION(ScEditFieldObj_Cell);
-}
+} // namespace sc_apitest
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/qa/extras/sceditfieldobj-header.cxx b/sc/qa/extras/sceditfieldobj-header.cxx
index 8d415d6736c8..e04f5087f17f 100644
--- a/sc/qa/extras/sceditfieldobj-header.cxx
+++ b/sc/qa/extras/sceditfieldobj-header.cxx
@@ -9,26 +9,32 @@
#include <test/calc_unoapi_test.hxx>
#include <test/beans/xpropertyset.hxx>
-#include <test/text/xtextfield.hxx>
#include <test/text/xtextcontent.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/sheet/XHeaderFooterContent.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
#include <com/sun/star/text/XTextField.hpp>
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
-#include <com/sun/star/sheet/XHeaderFooterContent.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
-using namespace css;
-using namespace css::uno;
+#include <com/sun/star/uno/Reference.hxx>
-namespace sc_apitest {
+using namespace css;
-class ScEditFieldObj_Header : public CalcUnoApiTest, public apitest::XTextContent, public apitest::XPropertySet
+namespace sc_apitest
+{
+class ScEditFieldObj_Header : public CalcUnoApiTest,
+ public apitest::XTextContent,
+ public apitest::XPropertySet
{
public:
ScEditFieldObj_Header();
@@ -46,6 +52,8 @@ public:
CPPUNIT_TEST(testGetPropertySetInfo);
CPPUNIT_TEST(testGetPropertyValue);
CPPUNIT_TEST(testSetPropertyValue);
+ CPPUNIT_TEST(testPropertyChangeListener);
+ CPPUNIT_TEST(testVetoableChangeListener);
// XTextContent
CPPUNIT_TEST(testGetAnchor);
@@ -63,7 +71,7 @@ uno::Reference<text::XTextField> ScEditFieldObj_Header::mxField;
uno::Reference<text::XText> ScEditFieldObj_Header::mxRightText;
ScEditFieldObj_Header::ScEditFieldObj_Header()
- : CalcUnoApiTest("/sc/qa/extras/testdocuments")
+ : CalcUnoApiTest("/sc/qa/extras/testdocuments")
{
}
@@ -89,24 +97,27 @@ uno::Reference<uno::XInterface> ScEditFieldObj_Header::init()
// Return a field that's already in the header.
if (!mxField.is())
{
- uno::Reference<lang::XMultiServiceFactory> xSM(mxComponent, UNO_QUERY_THROW);
+ uno::Reference<lang::XMultiServiceFactory> xSM(mxComponent, uno::UNO_QUERY_THROW);
// Create a new URL field object, and populate it with name and URL.
- mxField.set(xSM->createInstance("com.sun.star.text.TextField.Time"), UNO_QUERY_THROW);
+ mxField.set(xSM->createInstance("com.sun.star.text.TextField.Time"), uno::UNO_QUERY_THROW);
- uno::Reference<style::XStyleFamiliesSupplier> xSFS(mxComponent, UNO_QUERY_THROW);
- uno::Reference<container::XNameAccess> xStyleFamilies(xSFS->getStyleFamilies(), UNO_QUERY_THROW);
- uno::Reference<container::XNameAccess> xPageStyles(xStyleFamilies->getByName("PageStyles"), UNO_QUERY_THROW);
- uno::Reference<beans::XPropertySet> xPropSet(xPageStyles->getByName("Default"), UNO_QUERY_THROW);
+ uno::Reference<style::XStyleFamiliesSupplier> xSFS(mxComponent, uno::UNO_QUERY_THROW);
+ uno::Reference<container::XNameAccess> xStyleFamilies(xSFS->getStyleFamilies(),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<container::XNameAccess> xPageStyles(xStyleFamilies->getByName("PageStyles"),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPropSet(xPageStyles->getByName("Default"),
+ uno::UNO_QUERY_THROW);
uno::Reference<sheet::XHeaderFooterContent> xHeaderContent(
- xPropSet->getPropertyValue("RightPageHeaderContent"), UNO_QUERY_THROW);
+ xPropSet->getPropertyValue("RightPageHeaderContent"), uno::UNO_QUERY_THROW);
// Use the left header text.
uno::Reference<text::XText> xText = xHeaderContent->getLeftText();
uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor();
- uno::Reference<text::XTextRange> xRange(xCursor, UNO_QUERY_THROW);
- uno::Reference<text::XTextContent> xContent(mxField, UNO_QUERY_THROW);
+ uno::Reference<text::XTextRange> xRange(xCursor, uno::UNO_QUERY_THROW);
+ uno::Reference<text::XTextContent> xContent(mxField, uno::UNO_QUERY_THROW);
xText->insertTextContent(xRange, xContent, false);
xPropSet->setPropertyValue("RightPageHeaderContent", uno::makeAny(xHeaderContent));
@@ -120,22 +131,22 @@ uno::Reference<uno::XInterface> ScEditFieldObj_Header::init()
uno::Reference<text::XTextContent> ScEditFieldObj_Header::getTextContent()
{
// Return a field object that's not yet inserted.
- uno::Reference<lang::XMultiServiceFactory> xSM(mxComponent, UNO_QUERY_THROW);
+ uno::Reference<lang::XMultiServiceFactory> xSM(mxComponent, uno::UNO_QUERY_THROW);
uno::Reference<text::XTextContent> xField(
- xSM->createInstance("com.sun.star.text.TextField.Date"), UNO_QUERY_THROW);
+ xSM->createInstance("com.sun.star.text.TextField.Date"), uno::UNO_QUERY_THROW);
return xField;
}
uno::Reference<text::XTextRange> ScEditFieldObj_Header::getTextRange()
{
// Use the right header text for this.
- uno::Reference<text::XTextRange> xRange(mxRightText, UNO_QUERY_THROW);
+ uno::Reference<text::XTextRange> xRange(mxRightText, uno::UNO_QUERY_THROW);
return xRange;
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScEditFieldObj_Header);
-}
+} // namespace sc_apitest
CPPUNIT_PLUGIN_IMPLEMENT();
More information about the Libreoffice-commits
mailing list