[Libreoffice-commits] core.git: include/test qadevOOo/Jar_OOoRunner.mk qadevOOo/objdsc qadevOOo/tests sc/CppunitTest_sc_filterdescriptorbaseobj.mk sc/Module_sc.mk sc/qa test/Library_subsequenttest.mk test/source
Jens Carl
j.carl43 at gmx.de
Sun Oct 29 22:45:38 UTC 2017
include/test/sheet/xsheetfilterdescriptor.hxx | 36 +++
qadevOOo/Jar_OOoRunner.mk | 1
qadevOOo/objdsc/sc/com.sun.star.comp.office.ScFilterDescriptorBase.csv | 2
qadevOOo/tests/java/ifc/sheet/_XSheetFilterDescriptor.java | 73 ------
sc/CppunitTest_sc_filterdescriptorbaseobj.mk | 105 ++++++++++
sc/Module_sc.mk | 1
sc/qa/extras/scfilterdescriptorbaseobj.cxx | 102 +++++++++
test/Library_subsequenttest.mk | 1
test/source/sheet/xsheetfilterdescriptor.cxx | 42 ++++
9 files changed, 287 insertions(+), 76 deletions(-)
New commits:
commit ba93d6aeb73cba64f037a0bd88d96fedb90f3f2f
Author: Jens Carl <j.carl43 at gmx.de>
Date: Fri Oct 20 22:39:21 2017 +0000
tdf#45904: Move Java _XSheetFilterDescriptor tests to C++
Change-Id: If9bbef199f2c698f9ffeb3d57423b66ebd439a94
Reviewed-on: https://gerrit.libreoffice.org/43635
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/include/test/sheet/xsheetfilterdescriptor.hxx b/include/test/sheet/xsheetfilterdescriptor.hxx
new file mode 100644
index 000000000000..3a4a6a695c1b
--- /dev/null
+++ b/include/test/sheet/xsheetfilterdescriptor.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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_XSHEETFILTERDESCRIPTOR_HXX
+#define INCLUDED_TEST_SHEET_XSHEETFILTERDESCRIPTOR_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 XSheetFilterDescriptor
+{
+public:
+ virtual css::uno::Reference< css::uno::XInterface > init() =0;
+
+ void testGetSetFilterFields();
+
+protected:
+ ~XSheetFilterDescriptor() {}
+};
+
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETFILTERDESCRIPTOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk
index 42108bb54891..796fc0805945 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -626,7 +626,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/ifc/sheet/_XSheetConditionalEntry \
qadevOOo/tests/java/ifc/sheet/_XSheetFilterable \
qadevOOo/tests/java/ifc/sheet/_XSheetFilterableEx \
- qadevOOo/tests/java/ifc/sheet/_XSheetFilterDescriptor \
qadevOOo/tests/java/ifc/sheet/_XSpreadsheetView \
qadevOOo/tests/java/ifc/style/_CharacterProperties \
qadevOOo/tests/java/ifc/style/_CharacterPropertiesAsian \
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 80cf902f40b8..bbd744683dc8 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScFilterDescriptorBase.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScFilterDescriptorBase.csv
@@ -1,5 +1,3 @@
-"ScFilterDescriptorBase";"com::sun::star::sheet::XSheetFilterDescriptor";"getFilterFields()"
-"ScFilterDescriptorBase";"com::sun::star::sheet::XSheetFilterDescriptor";"setFilterFields()"
"ScFilterDescriptorBase";"com::sun::star::sheet::SheetFilterDescriptor";"IsCaseSensitive"
"ScFilterDescriptorBase";"com::sun::star::sheet::SheetFilterDescriptor";"SkipDuplicates"
"ScFilterDescriptorBase";"com::sun::star::sheet::SheetFilterDescriptor";"UseRegularExpressions"
diff --git a/qadevOOo/tests/java/ifc/sheet/_XSheetFilterDescriptor.java b/qadevOOo/tests/java/ifc/sheet/_XSheetFilterDescriptor.java
deleted file mode 100644
index 9069e9231669..000000000000
--- a/qadevOOo/tests/java/ifc/sheet/_XSheetFilterDescriptor.java
+++ /dev/null
@@ -1,73 +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.MultiMethodTest;
-import util.ValueComparer;
-
-import com.sun.star.sheet.TableFilterField;
-import com.sun.star.sheet.XSheetFilterDescriptor;
-
-/**
-* Testing <code>com.sun.star.sheet.XSheetFilterDescriptor</code>
-* interface methods :
-* <ul>
-* <li><code> getFilterFields()</code></li>
-* <li><code> setFilterFields()</code></li>
-* </ul> <p>
-* @see com.sun.star.sheet.XSheetFilterDescriptor
-*/
-public class _XSheetFilterDescriptor extends MultiMethodTest {
-
- public XSheetFilterDescriptor oObj = null;
- public TableFilterField[] TFF = null;
-
- /**
- * Test calls the method, stores and checks returned value. <p>
- * Has <b> OK </b> status if returned value isn't null. <p>
- */
- public void _getFilterFields(){
- TFF = oObj.getFilterFields();
- tRes.tested("getFilterFields()", TFF != null );
- }
-
- /**
- * Test sets new value of the definitions of the filter fields,
- * gets the current definitions of the filter fields and compares
- * returned value with value that was stored by method
- * <code>getFilterFields()</code>. <p>
- * Has <b> OK </b> status if values aren't equal. <p>
- * The following method tests are to be completed successfully before :
- * <ul>
- * <li> <code> getFilterFields() </code> : to have the current definitions
- * of the filter fields </li>
- * </ul>
- */
- public void _setFilterFields() {
- requiredMethod("getFilterFields()");
- TableFilterField[] newTFF = new TableFilterField[1];
- newTFF[0] = new TableFilterField();
- oObj.setFilterFields(newTFF);
- newTFF = oObj.getFilterFields();
- tRes.tested("setFilterFields()", ! ValueComparer.equalValue(TFF, newTFF));
- }
-
-} // finish class _XSheetFilterDescriptor
-
-
diff --git a/sc/CppunitTest_sc_filterdescriptorbaseobj.mk b/sc/CppunitTest_sc_filterdescriptorbaseobj.mk
new file mode 100644
index 000000000000..28cd6c7af67b
--- /dev/null
+++ b/sc/CppunitTest_sc_filterdescriptorbaseobj.mk
@@ -0,0 +1,105 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# 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/.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sc_filterdescriptorbaseobj))
+
+$(eval $(call gb_CppunitTest_use_external,sc_filterdescriptorbaseobj,boost_headers))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_filterdescriptorbaseobj, \
+ sc/qa/extras/scfilterdescriptorbaseobj\
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sc_filterdescriptorbaseobj, \
+ basegfx \
+ comphelper \
+ cppu \
+ cppuhelper \
+ drawinglayer \
+ editeng \
+ for \
+ forui \
+ i18nlangtag \
+ msfilter \
+ oox \
+ sal \
+ salhelper \
+ sax \
+ sb \
+ sc \
+ sfx \
+ sot \
+ subsequenttest \
+ svl \
+ svt \
+ svx \
+ svxcore \
+ test \
+ tk \
+ tl \
+ ucbhelper \
+ unotest \
+ utl \
+ vbahelper \
+ vcl \
+ xo \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_filterdescriptorbaseobj,\
+ -I$(SRCDIR)/sc/source/ui/inc \
+ -I$(SRCDIR)/sc/inc \
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,sc_filterdescriptorbaseobj))
+
+$(eval $(call gb_CppunitTest_use_ure,sc_filterdescriptorbaseobj))
+$(eval $(call gb_CppunitTest_use_vcl,sc_filterdescriptorbaseobj))
+
+$(eval $(call gb_CppunitTest_use_components,sc_filterdescriptorbaseobj,\
+ basic/util/sb \
+ comphelper/util/comphelp \
+ configmgr/source/configmgr \
+ dbaccess/util/dba \
+ filter/source/config/cache/filterconfig1 \
+ filter/source/storagefilterdetect/storagefd \
+ forms/util/frm \
+ framework/util/fwk \
+ i18npool/source/search/i18nsearch \
+ i18npool/util/i18npool \
+ oox/util/oox \
+ package/source/xstor/xstor \
+ package/util/package2 \
+ sax/source/expatwrap/expwrap \
+ scripting/source/basprov/basprov \
+ scripting/util/scriptframe \
+ sc/util/sc \
+ sc/util/scd \
+ sc/util/scfilt \
+ $(call gb_Helper_optional,SCRIPTING, \
+ sc/util/vbaobj) \
+ sfx2/util/sfx \
+ sot/util/sot \
+ svl/source/fsstor/fsstorage \
+ toolkit/util/tk \
+ ucb/source/core/ucb1 \
+ ucb/source/ucp/file/ucpfile1 \
+ ucb/source/ucp/tdoc/ucptdoc1 \
+ unotools/util/utl \
+ unoxml/source/rdf/unordf \
+ unoxml/source/service/unoxml \
+ uui/util/uui \
+ xmloff/util/xo \
+ svtools/util/svt \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sc_filterdescriptorbaseobj))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index ed4e61855d45..1fba8a97959a 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -133,6 +133,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
CppunitTest_sc_subtotalfieldobj \
CppunitTest_sc_arealinksobj \
CppunitTest_sc_cellrangesobj \
+ CppunitTest_sc_filterdescriptorbaseobj \
))
$(eval $(call gb_Module_add_perfcheck_targets,sc,\
diff --git a/sc/qa/extras/scfilterdescriptorbaseobj.cxx b/sc/qa/extras/scfilterdescriptorbaseobj.cxx
new file mode 100644
index 000000000000..1fc814af2cbd
--- /dev/null
+++ b/sc/qa/extras/scfilterdescriptorbaseobj.cxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/calc_unoapi_test.hxx>
+#include <test/sheet/xsheetfilterdescriptor.hxx>
+
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/sheet/XSheetFilterable.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace sc_apitest {
+
+#define NUMBER_OF_TESTS 1
+
+class ScFilterDescriptorBaseObj : public CalcUnoApiTest, public apitest::XSheetFilterDescriptor
+{
+public:
+ ScFilterDescriptorBaseObj();
+
+ virtual void setUp() override;
+ virtual void tearDown() override;
+
+ virtual uno::Reference< uno::XInterface > init() override;
+
+ CPPUNIT_TEST_SUITE(ScFilterDescriptorBaseObj);
+
+ // XSheetFilterDescriptor
+ CPPUNIT_TEST(testGetSetFilterFields);
+
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ static sal_Int32 nTest;
+ static uno::Reference< lang::XComponent > mxComponent;
+};
+
+sal_Int32 ScFilterDescriptorBaseObj::nTest = 0;
+uno::Reference< lang::XComponent > ScFilterDescriptorBaseObj::mxComponent;
+
+ScFilterDescriptorBaseObj::ScFilterDescriptorBaseObj():
+ CalcUnoApiTest("/sc/qa/extras/testdocuments")
+{
+}
+
+uno::Reference< uno::XInterface > ScFilterDescriptorBaseObj::init()
+{
+ // create a calc document
+ if (!mxComponent.is())
+ mxComponent = loadFromDesktop("private:factory/scalc");
+
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is());
+
+ uno::Reference< container::XIndexAccess > xIndexAccess(xDoc->getSheets(), uno::UNO_QUERY_THROW);
+ uno::Reference< sheet::XSpreadsheet > xSheet(xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW);
+
+ xSheet->getCellByPosition(5, 5)->setValue(15);
+ xSheet->getCellByPosition(1, 4)->setValue(10);
+ xSheet->getCellByPosition(2, 0)->setValue(-5.15);
+
+ uno::Reference< sheet::XSheetFilterable > xSF(xSheet, uno::UNO_QUERY_THROW);
+
+ return xSF->createFilterDescriptor(true);
+}
+
+void ScFilterDescriptorBaseObj::setUp()
+{
+ nTest++;
+ CPPUNIT_ASSERT(nTest <= NUMBER_OF_TESTS);
+ CalcUnoApiTest::setUp();
+}
+
+void ScFilterDescriptorBaseObj::tearDown()
+{
+ if (nTest == NUMBER_OF_TESTS)
+ {
+ closeDocument(mxComponent);
+ mxComponent.clear();
+ }
+
+ CalcUnoApiTest::tearDown();
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScFilterDescriptorBaseObj);
+
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 79463d688958..581614cc5c80 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -70,6 +70,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/xsheetannotation \
test/source/sheet/xsheetannotations \
test/source/sheet/xsheetannotationshapesupplier \
+ test/source/sheet/xsheetfilterdescriptor \
test/source/sheet/xsheetoutline \
test/source/sheet/xsheetlinkable \
test/source/sheet/xsheetoperation \
diff --git a/test/source/sheet/xsheetfilterdescriptor.cxx b/test/source/sheet/xsheetfilterdescriptor.cxx
new file mode 100644
index 000000000000..b1d26473fca7
--- /dev/null
+++ b/test/source/sheet/xsheetfilterdescriptor.cxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/sheet/xsheetfilterdescriptor.hxx>
+
+#include <com/sun/star/sheet/TableFilterField.hpp>
+#include <com/sun/star/sheet/XSheetFilterDescriptor.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace css;
+using namespace css::uno;
+
+namespace apitest {
+
+void XSheetFilterDescriptor::testGetSetFilterFields()
+{
+ uno::Reference< sheet::XSheetFilterDescriptor > xSFD(init(), UNO_QUERY_THROW);
+ uno::Sequence< sheet::TableFilterField > xDefaultTFF = xSFD->getFilterFields();
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get TableFilterField", sal_Int32(0), xDefaultTFF.getLength());
+
+ uno::Sequence< sheet::TableFilterField > xTFF;
+ xTFF.realloc(1);
+
+ xSFD->setFilterFields(xTFF);
+ uno::Sequence< sheet::TableFilterField > xNewTFF = xSFD->getFilterFields();
+ CPPUNIT_ASSERT_MESSAGE("Unable to set TableFilterField", xNewTFF != xDefaultTFF);
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list