[Libreoffice-commits] core.git: include/test qadevOOo/Jar_OOoRunner.mk qadevOOo/objdsc qadevOOo/tests sc/qa test/Library_subsequenttest.mk test/source

Jens Carl j.carl43 at gmx.de
Tue Feb 27 17:18:54 UTC 2018


 include/test/sheet/sheetfilterdescriptor.hxx                           |   34 ++
 qadevOOo/Jar_OOoRunner.mk                                              |    1 
 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScFilterDescriptorBase.csv |    9 
 qadevOOo/tests/java/ifc/sheet/_SheetFilterDescriptor.java              |   43 --
 sc/qa/extras/scfilterdescriptorbaseobj.cxx                             |    8 
 test/Library_subsequenttest.mk                                         |    1 
 test/source/sheet/sheetfilterdescriptor.cxx                            |  151 ++++++++++
 7 files changed, 193 insertions(+), 54 deletions(-)

New commits:
commit 5a0acced8988a54d8aaf0328d2696dae21727c6a
Author: Jens Carl <j.carl43 at gmx.de>
Date:   Tue Feb 27 07:59:26 2018 +0000

    tdf#45904: Move _SheetFilterDescriptor Java tests to C++
    
    Change-Id: I894b2e2534efeb5369c491053caf56f67dc56618
    Reviewed-on: https://gerrit.libreoffice.org/50411
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jens Carl <j.carl43 at gmx.de>

diff --git a/include/test/sheet/sheetfilterdescriptor.hxx b/include/test/sheet/sheetfilterdescriptor.hxx
new file mode 100644
index 000000000000..919b84171697
--- /dev/null
+++ b/include/test/sheet/sheetfilterdescriptor.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_SHEETFILTERDESCRIPTOR_HXX
+#define INCLUDED_TEST_SHEET_SHEETFILTERDESCRIPTOR_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST SheetFilterDescriptor
+{
+public:
+    virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+    void testSheetFilterDescriptorProperties();
+
+protected:
+    ~SheetFilterDescriptor() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_SHEETFILTERDESCRIPTOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk
index b3f79bb2feb5..fa6d33e0fade 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -565,7 +565,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
     qadevOOo/tests/java/ifc/sdb/_XSQLErrorBroadcaster \
     qadevOOo/tests/java/ifc/sheet/_FunctionDescription \
     qadevOOo/tests/java/ifc/sheet/_Shape \
-    qadevOOo/tests/java/ifc/sheet/_SheetFilterDescriptor \
     qadevOOo/tests/java/ifc/sheet/_SheetLink \
     qadevOOo/tests/java/ifc/sheet/_SheetSortDescriptor \
     qadevOOo/tests/java/ifc/sheet/_Spreadsheet \
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScFilterDescriptorBase.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScFilterDescriptorBase.csv
index bbd744683dc8..ed43efa9a2b5 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScFilterDescriptorBase.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScFilterDescriptorBase.csv
@@ -1,12 +1,3 @@
-"ScFilterDescriptorBase";"com::sun::star::sheet::SheetFilterDescriptor";"IsCaseSensitive"
-"ScFilterDescriptorBase";"com::sun::star::sheet::SheetFilterDescriptor";"SkipDuplicates"
-"ScFilterDescriptorBase";"com::sun::star::sheet::SheetFilterDescriptor";"UseRegularExpressions"
-"ScFilterDescriptorBase";"com::sun::star::sheet::SheetFilterDescriptor";"SaveOutputPosition"
-"ScFilterDescriptorBase";"com::sun::star::sheet::SheetFilterDescriptor";"Orientation"
-"ScFilterDescriptorBase";"com::sun::star::sheet::SheetFilterDescriptor";"ContainsHeader"
-"ScFilterDescriptorBase";"com::sun::star::sheet::SheetFilterDescriptor";"CopyOutputData"
-"ScFilterDescriptorBase";"com::sun::star::sheet::SheetFilterDescriptor";"OutputPosition"
-"ScFilterDescriptorBase";"com::sun::star::sheet::SheetFilterDescriptor";"MaxFieldCount"
 "ScFilterDescriptorBase";"com::sun::star::beans::XPropertySet";"getPropertySetInfo()"
 "ScFilterDescriptorBase";"com::sun::star::beans::XPropertySet";"setPropertyValue()"
 "ScFilterDescriptorBase";"com::sun::star::beans::XPropertySet";"getPropertyValue()"
diff --git a/qadevOOo/tests/java/ifc/sheet/_SheetFilterDescriptor.java b/qadevOOo/tests/java/ifc/sheet/_SheetFilterDescriptor.java
deleted file mode 100644
index 785ca77072be..000000000000
--- a/qadevOOo/tests/java/ifc/sheet/_SheetFilterDescriptor.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package ifc.sheet;
-
-import lib.MultiPropertyTest;
-
-/**
-* Testing <code>com.sun.star.sheet.SheetFilterDescriptor</code>
-* service properties :
-* <ul>
-*  <li><code> IsCaseSensitive</code></li>
-*  <li><code> SkipDuplicates</code></li>
-*  <li><code> UseRegularExpressions</code></li>
-*  <li><code> SaveOutputPosition</code></li>
-*  <li><code> Orientation</code></li>
-*  <li><code> ContainsHeader</code></li>
-*  <li><code> CopyOutputData</code></li>
-*  <li><code> OutputPosition</code></li>
-*  <li><code> MaxFieldCount</code></li>
-* </ul> <p>
-* Properties testing is automated by <code>lib.MultiPropertyTest</code>.
-* @see com.sun.star.sheet.SheetFilterDescriptor
-*/
-public class _SheetFilterDescriptor extends MultiPropertyTest {
-}  // finish class _SheetFilterDescriptor
-
-
diff --git a/sc/qa/extras/scfilterdescriptorbaseobj.cxx b/sc/qa/extras/scfilterdescriptorbaseobj.cxx
index 993016b77ebb..35fca71f62d5 100644
--- a/sc/qa/extras/scfilterdescriptorbaseobj.cxx
+++ b/sc/qa/extras/scfilterdescriptorbaseobj.cxx
@@ -8,6 +8,7 @@
  */
 
 #include <test/calc_unoapi_test.hxx>
+#include <test/sheet/sheetfilterdescriptor.hxx>
 #include <test/sheet/xsheetfilterdescriptor.hxx>
 
 #include <com/sun/star/container/XIndexAccess.hpp>
@@ -22,7 +23,9 @@ using namespace css::uno;
 
 namespace sc_apitest {
 
-class ScFilterDescriptorBaseObj : public CalcUnoApiTest, public apitest::XSheetFilterDescriptor
+class ScFilterDescriptorBaseObj : public CalcUnoApiTest,
+                                  public apitest::SheetFilterDescriptor,
+                                  public apitest::XSheetFilterDescriptor
 {
 public:
     ScFilterDescriptorBaseObj();
@@ -34,6 +37,9 @@ public:
 
     CPPUNIT_TEST_SUITE(ScFilterDescriptorBaseObj);
 
+    // SheetFilterDescriptor
+    CPPUNIT_TEST(testSheetFilterDescriptorProperties);
+
     // XSheetFilterDescriptor
     CPPUNIT_TEST(testGetSetFilterFields);
 
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 4c976adb2ccf..9bf962c1731c 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -56,6 +56,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
 	test/source/sheet/sheetcell \
 	test/source/sheet/sheetcellrange \
 	test/source/sheet/sheetcellranges \
+	test/source/sheet/sheetfilterdescriptor \
 	test/source/sheet/tableautoformat \
 	test/source/sheet/tablevalidation \
 	test/source/sheet/xarealink \
diff --git a/test/source/sheet/sheetfilterdescriptor.cxx b/test/source/sheet/sheetfilterdescriptor.cxx
new file mode 100644
index 000000000000..b5618e75d62a
--- /dev/null
+++ b/test/source/sheet/sheetfilterdescriptor.cxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/cppunitasserthelper.hxx>
+#include <test/sheet/sheetfilterdescriptor.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/table/CellAddress.hpp>
+#include <com/sun/star/table/TableOrientation.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+namespace apitest
+{
+void SheetFilterDescriptor::testSheetFilterDescriptorProperties()
+{
+    uno::Reference<beans::XPropertySet> xSheetFilterDescriptor(init(), UNO_QUERY_THROW);
+    OUString propName;
+    uno::Any aNewValue;
+
+    propName = "IsCaseSensitive";
+    bool bIsCaseSensitiveGet = false;
+    bool bIsCaseSensitiveSet = false;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue IsCaseSensitive",
+                           xSheetFilterDescriptor->getPropertyValue(propName)
+                           >>= bIsCaseSensitiveGet);
+
+    aNewValue <<= !bIsCaseSensitiveGet;
+    xSheetFilterDescriptor->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xSheetFilterDescriptor->getPropertyValue(propName) >>= bIsCaseSensitiveSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue IsCaseSensitive",
+                                 !bIsCaseSensitiveGet, bIsCaseSensitiveSet);
+
+    propName = "SkipDuplicates";
+    bool bSkipDuplicatesGet = false;
+    bool bSkipDuplicatesSet = false;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue SkipDuplicates",
+                           xSheetFilterDescriptor->getPropertyValue(propName)
+                           >>= bSkipDuplicatesGet);
+
+    aNewValue <<= !bSkipDuplicatesGet;
+    xSheetFilterDescriptor->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xSheetFilterDescriptor->getPropertyValue(propName) >>= bSkipDuplicatesSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue SkipDuplicates", !bSkipDuplicatesGet,
+                                 bSkipDuplicatesSet);
+
+    propName = "UseRegularExpressions";
+    bool bUseRegularExpressionsGet = false;
+    bool bUseRegularExpressionsSet = false;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue UseRegularExpressions",
+                           xSheetFilterDescriptor->getPropertyValue(propName)
+                           >>= bUseRegularExpressionsGet);
+
+    aNewValue <<= !bUseRegularExpressionsGet;
+    xSheetFilterDescriptor->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xSheetFilterDescriptor->getPropertyValue(propName)
+                   >>= bUseRegularExpressionsSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue UseRegularExpressions",
+                                 !bUseRegularExpressionsGet, bUseRegularExpressionsSet);
+
+    propName = "SaveOutputPosition";
+    bool bSaveOutputPositionGet = false;
+    bool bSaveOutputPositionSet = false;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue SaveOutputPosition",
+                           xSheetFilterDescriptor->getPropertyValue(propName)
+                           >>= bSaveOutputPositionGet);
+
+    aNewValue <<= !bSaveOutputPositionGet;
+    xSheetFilterDescriptor->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xSheetFilterDescriptor->getPropertyValue(propName) >>= bSaveOutputPositionSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue SaveOutputPosition",
+                                 !bSaveOutputPositionGet, bSaveOutputPositionSet);
+
+    propName = "Orientation";
+    table::TableOrientation aOrientationGet;
+    table::TableOrientation aOrientationSet;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Orientation",
+                           xSheetFilterDescriptor->getPropertyValue(propName) >>= aOrientationGet);
+
+    aNewValue <<= table::TableOrientation_COLUMNS;
+    xSheetFilterDescriptor->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xSheetFilterDescriptor->getPropertyValue(propName) >>= aOrientationSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue Orientation",
+                                 table::TableOrientation_COLUMNS, aOrientationSet);
+
+    propName = "ContainsHeader";
+    bool bContainsHeaderGet = false;
+    bool bContainsHeaderSet = false;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ContainsHeader",
+                           xSheetFilterDescriptor->getPropertyValue(propName)
+                           >>= bContainsHeaderGet);
+
+    aNewValue <<= !bContainsHeaderGet;
+    xSheetFilterDescriptor->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xSheetFilterDescriptor->getPropertyValue(propName) >>= bContainsHeaderSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue ContainsHeader", !bContainsHeaderGet,
+                                 bContainsHeaderSet);
+
+    propName = "CopyOutputData";
+    bool bCopyOutputDataGet = false;
+    bool bCopyOutputDataSet = false;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue CopyOutputData",
+                           xSheetFilterDescriptor->getPropertyValue(propName)
+                           >>= bCopyOutputDataGet);
+
+    aNewValue <<= !bCopyOutputDataGet;
+    xSheetFilterDescriptor->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xSheetFilterDescriptor->getPropertyValue(propName) >>= bCopyOutputDataSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue CopyOutputData", !bCopyOutputDataGet,
+                                 bCopyOutputDataSet);
+
+    propName = "OutputPosition";
+    table::CellAddress aCellAddressGet;
+    table::CellAddress aCellAddressSet;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue OutputPosition",
+                           xSheetFilterDescriptor->getPropertyValue(propName) >>= aCellAddressGet);
+
+    aCellAddressGet = table::CellAddress(0, 42, 42);
+    aNewValue <<= aCellAddressGet;
+    xSheetFilterDescriptor->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xSheetFilterDescriptor->getPropertyValue(propName) >>= aCellAddressSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue OutputPosition", aCellAddressGet,
+                                 aCellAddressSet);
+
+    propName = "MaxFieldCount";
+    sal_Int32 nMaxFieldCountGet = 0;
+    sal_Int32 nMaxFieldCountSet = 0;
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue MaxFieldCount",
+                           xSheetFilterDescriptor->getPropertyValue(propName)
+                           >>= nMaxFieldCountGet);
+
+    aNewValue <<= nMaxFieldCountGet + 42;
+    xSheetFilterDescriptor->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xSheetFilterDescriptor->getPropertyValue(propName) >>= nMaxFieldCountSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Able to set PropertyValue MaxFieldCount", nMaxFieldCountGet,
+                                 nMaxFieldCountSet);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */


More information about the Libreoffice-commits mailing list