summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2015-03-16 20:23:59 +0100
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2015-03-30 04:30:51 +0200
commit29b8f25ff238fcbbff886a108a2fa1c36aa09600 (patch)
tree343e525c1828cf5a3959ab5e80db684f4242134e
parent9dc75d5a548facf605a5bde48e637b94bdcabae9 (diff)
add first test for new conditional format API
Change-Id: I85cee7b6b55ce35bb900eaf708744117208e57d7
-rw-r--r--sc/CppunitTest_sc_new_cond_format_api.mk109
-rw-r--r--sc/Module_sc.mk1
-rw-r--r--sc/qa/extras/new_cond_format.cxx106
-rw-r--r--sc/qa/extras/testdocuments/new_cond_format_api.odsbin0 -> 7376 bytes
4 files changed, 216 insertions, 0 deletions
diff --git a/sc/CppunitTest_sc_new_cond_format_api.mk b/sc/CppunitTest_sc_new_cond_format_api.mk
new file mode 100644
index 000000000000..c0558d12264a
--- /dev/null
+++ b/sc/CppunitTest_sc_new_cond_format_api.mk
@@ -0,0 +1,109 @@
+# -*- 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_new_cond_format_api))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_new_cond_format_api, \
+ sc/qa/extras/new_cond_format \
+))
+
+$(eval $(call gb_CppunitTest_use_external,sc_new_cond_format_api,boost_headers))
+
+$(eval $(call gb_CppunitTest_use_libraries,sc_new_cond_format_api, \
+ basegfx \
+ comphelper \
+ cppu \
+ cppuhelper \
+ drawinglayer \
+ editeng \
+ for \
+ forui \
+ i18nlangtag \
+ msfilter \
+ oox \
+ sal \
+ salhelper \
+ sax \
+ sb \
+ sfx \
+ sot \
+ subsequenttest \
+ svl \
+ svt \
+ svx \
+ svxcore \
+ test \
+ tk \
+ tl \
+ ucbhelper \
+ unotest \
+ utl \
+ vbahelper \
+ vcl \
+ xo \
+ $(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_new_cond_format_api,\
+ -I$(SRCDIR)/sc/source/ui/inc \
+ -I$(SRCDIR)/sc/inc \
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,sc_new_cond_format_api,\
+ offapi \
+ udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,sc_new_cond_format_api))
+$(eval $(call gb_CppunitTest_use_vcl,sc_new_cond_format_api))
+
+$(eval $(call gb_CppunitTest_use_components,sc_new_cond_format_api,\
+ 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/util/i18npool \
+ linguistic/source/lng \
+ 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 \
+ xmloff/util/xo \
+ svtools/util/svt \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sc_new_cond_format_api))
+
+$(eval $(call gb_CppunitTest_use_unittest_configuration,sc_new_cond_format_api))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index c25151f1a89f..31b2c6d8ac95 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -53,6 +53,7 @@ $(eval $(call gb_Module_add_check_targets,sc,\
$(eval $(call gb_Module_add_slowcheck_targets,sc, \
CppunitTest_sc_condformats \
+ CppunitTest_sc_new_cond_format_api \
CppunitTest_sc_subsequent_filters_test \
CppunitTest_sc_subsequent_export_test \
CppunitTest_sc_bugfix_test \
diff --git a/sc/qa/extras/new_cond_format.cxx b/sc/qa/extras/new_cond_format.cxx
new file mode 100644
index 000000000000..84c29a6249fc
--- /dev/null
+++ b/sc/qa/extras/new_cond_format.cxx
@@ -0,0 +1,106 @@
+/* -*- 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 <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sheet/XConditionalFormats.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/table/CellAddress.hpp>
+#include <unonames.hxx>
+
+using namespace css;
+
+namespace sc_apitest {
+
+#define NUMBER_OF_TESTS 1
+
+class ScConditionalFormatTest : public CalcUnoApiTest
+{
+public:
+ ScConditionalFormatTest();
+
+ virtual void setUp() SAL_OVERRIDE;
+ virtual void tearDown() SAL_OVERRIDE;
+
+ uno::Reference< uno::XInterface > init();
+ void testRequestCondFormatListFromSheet();
+
+ CPPUNIT_TEST_SUITE(ScConditionalFormatTest);
+ CPPUNIT_TEST(testRequestCondFormatListFromSheet);
+ CPPUNIT_TEST_SUITE_END();
+private:
+
+ static sal_Int32 nTest;
+ static uno::Reference< lang::XComponent > mxComponent;
+};
+
+sal_Int32 ScConditionalFormatTest::nTest = 0;
+uno::Reference< lang::XComponent > ScConditionalFormatTest::mxComponent;
+
+ScConditionalFormatTest::ScConditionalFormatTest()
+ : CalcUnoApiTest("sc/qa/extras/testdocuments/")
+{
+}
+
+uno::Reference< uno::XInterface > ScConditionalFormatTest::init()
+{
+ if(!mxComponent.is())
+ {
+ // get the test file
+ OUString aFileURL;
+ createFileURL(OUString("new_cond_format_api.ods"), aFileURL);
+ mxComponent = loadFromDesktop(aFileURL);
+ }
+ CPPUNIT_ASSERT_MESSAGE("Component not loaded", mxComponent.is());
+
+ // get the first sheet
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, uno::UNO_QUERY_THROW);
+ uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), uno::UNO_QUERY_THROW);
+ uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), uno::UNO_QUERY_THROW);
+
+ return xSheet;
+}
+
+void ScConditionalFormatTest::testRequestCondFormatListFromSheet()
+{
+ uno::Reference<sheet::XSpreadsheet> xSheet(init(), uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xProps(xSheet, uno::UNO_QUERY_THROW);
+ uno::Any aAny = xProps->getPropertyValue("ConditionalFormats");
+ uno::Reference<sheet::XConditionalFormats> xCondFormats;
+ CPPUNIT_ASSERT(aAny >>= xCondFormats);
+ CPPUNIT_ASSERT(xCondFormats.is());
+}
+
+void ScConditionalFormatTest::setUp()
+{
+ nTest++;
+ CalcUnoApiTest::setUp();
+}
+
+void ScConditionalFormatTest::tearDown()
+{
+ if (nTest == NUMBER_OF_TESTS)
+ {
+ closeDocument(mxComponent);
+ mxComponent.clear();
+ }
+
+ CalcUnoApiTest::tearDown();
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScConditionalFormatTest);
+
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/extras/testdocuments/new_cond_format_api.ods b/sc/qa/extras/testdocuments/new_cond_format_api.ods
new file mode 100644
index 000000000000..8208fea80ff1
--- /dev/null
+++ b/sc/qa/extras/testdocuments/new_cond_format_api.ods
Binary files differ