summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-01-21 12:02:46 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-01-23 19:46:46 +0100
commit95780ec73990f96dc16fc677c895d00fa1360008 (patch)
tree875b727854a9d3c4dd0d2958ba490627ca53b78a
parent3fcde5e3f9e0921effd9ffd6c26246647f108ce3 (diff)
refactor concept for c++ based subsequenttests
-rw-r--r--sc/CppunitTest_sc_cellrangeobj.mk (renamed from sc/CppunitTest_sc_cellrangesbase.mk)3
-rw-r--r--sc/CppunitTest_sc_databaserangeobj.mk3
-rw-r--r--sc/CppunitTest_sc_datapilotfieldobj.mk3
-rw-r--r--sc/CppunitTest_sc_datapilottableobj.mk (renamed from sc/CppunitTest_sc_datapilotdescriptorbase.mk)23
-rw-r--r--sc/CppunitTest_sc_namedrangeobj.mk3
-rw-r--r--sc/CppunitTest_sc_namedrangesobj.mk142
-rw-r--r--sc/CppunitTest_sc_tablesheetsobj.mk (renamed from sc/CppunitTest_sc_spreadsheetobj.mk)2
-rw-r--r--sc/Module_sc.mk14
-rw-r--r--sc/qa/extras/sccellrangeobj.cxx116
-rw-r--r--sc/qa/extras/scdatabaserangeobj.cxx106
-rw-r--r--sc/qa/extras/scdatapilotfieldobj.cxx (renamed from sc/qa/extras/xdatapilotfieldgrouping.cxx)98
-rw-r--r--sc/qa/extras/scdatapilottableobj.cxx (renamed from sc/qa/extras/xdatapilottable.cxx)102
-rw-r--r--sc/qa/extras/scnamedrangeobj.cxx117
-rw-r--r--sc/qa/extras/scnamedrangesobj.cxx110
-rw-r--r--sc/qa/extras/sctablesheetsobj.cxx138
-rw-r--r--sc/qa/extras/testdocuments/rangenamessrc.odsbin9250 -> 9089 bytes
-rw-r--r--test/Library_subsequenttest.mk11
-rw-r--r--test/Package_inc.mk11
-rw-r--r--test/inc/test/container/xnamecontainer.hxx55
-rw-r--r--test/inc/test/sheet/cellproperties.hxx48
-rw-r--r--test/inc/test/sheet/datapilotfield.hxx50
-rw-r--r--test/inc/test/sheet/tableautoformatfield.hxx49
-rw-r--r--test/inc/test/sheet/xcellrangesquery.hxx57
-rw-r--r--test/inc/test/sheet/xdatabaserange.hxx50
-rw-r--r--test/inc/test/sheet/xdatapilotdescriptor.hxx67
-rw-r--r--test/inc/test/sheet/xdatapilotfieldgrouping.hxx48
-rw-r--r--test/inc/test/sheet/xdatapilottable.hxx54
-rw-r--r--test/inc/test/sheet/xnamedrange.hxx56
-rw-r--r--test/inc/test/sheet/xnamedranges.hxx63
-rw-r--r--test/inc/test/sheet/xspreadsheets2.hxx83
-rw-r--r--test/inc/test/unoapi_test.hxx12
-rw-r--r--test/source/container/xnamecontainer.cxx (renamed from sc/qa/extras/xnamecontainer.cxx)49
-rw-r--r--test/source/sheet/cellproperties.cxx (renamed from sc/qa/extras/cellproperties.cxx)87
-rw-r--r--test/source/sheet/datapilotfield.cxx (renamed from sc/qa/extras/datapilotfieldobj.cxx)83
-rw-r--r--test/source/sheet/tableautoformatfield.cxx (renamed from sc/qa/extras/tableautoformatfield.cxx)66
-rw-r--r--test/source/sheet/xcellrangesquery.cxx (renamed from sc/qa/extras/xcellrangesquery.cxx)120
-rw-r--r--test/source/sheet/xdatabaserange.cxx (renamed from sc/qa/extras/xdatabaserange.cxx)90
-rw-r--r--test/source/sheet/xdatapilotdescriptor.cxx (renamed from sc/qa/extras/xdatapilotdescriptor.cxx)169
-rw-r--r--test/source/sheet/xdatapilotfieldgrouping.cxx62
-rw-r--r--test/source/sheet/xdatapilottable.cxx75
-rw-r--r--test/source/sheet/xnamedrange.cxx (renamed from sc/qa/extras/xnamedrange.cxx)83
-rw-r--r--test/source/sheet/xnamedranges.cxx (renamed from sc/qa/extras/xnamedranges.cxx)108
-rw-r--r--test/source/sheet/xspreadsheets2.cxx (renamed from sc/qa/extras/xspreadsheets2.cxx)187
-rw-r--r--test/source/unoapi_test.cxx8
44 files changed, 1902 insertions, 979 deletions
diff --git a/sc/CppunitTest_sc_cellrangesbase.mk b/sc/CppunitTest_sc_cellrangeobj.mk
index 12c96a866561..c72a1c283e08 100644
--- a/sc/CppunitTest_sc_cellrangesbase.mk
+++ b/sc/CppunitTest_sc_cellrangeobj.mk
@@ -31,8 +31,7 @@
$(eval $(call gb_CppunitTest_CppunitTest,sc_cellrangesbase))
$(eval $(call gb_CppunitTest_add_exception_objects,sc_cellrangesbase, \
- sc/qa/extras/xcellrangesquery \
- sc/qa/extras/cellproperties \
+ sc/qa/extras/sccellrangeobj\
))
$(eval $(call gb_CppunitTest_add_linked_libs,sc_cellrangesbase, \
diff --git a/sc/CppunitTest_sc_databaserangeobj.mk b/sc/CppunitTest_sc_databaserangeobj.mk
index a5ba678610f3..d201ca81d4b1 100644
--- a/sc/CppunitTest_sc_databaserangeobj.mk
+++ b/sc/CppunitTest_sc_databaserangeobj.mk
@@ -31,7 +31,7 @@
$(eval $(call gb_CppunitTest_CppunitTest,sc_databaserangeobj))
$(eval $(call gb_CppunitTest_add_exception_objects,sc_databaserangeobj, \
- sc/qa/extras/xdatabaserange \
+ sc/qa/extras/scdatabaserangeobj \
))
$(eval $(call gb_CppunitTest_add_linked_libs,sc_databaserangeobj, \
@@ -55,6 +55,7 @@ $(eval $(call gb_CppunitTest_add_linked_libs,sc_databaserangeobj, \
sc \
sfx \
sot \
+ subsequenttest \
svl \
svt \
svx \
diff --git a/sc/CppunitTest_sc_datapilotfieldobj.mk b/sc/CppunitTest_sc_datapilotfieldobj.mk
index 5898d3d57ef9..01f8c418cd79 100644
--- a/sc/CppunitTest_sc_datapilotfieldobj.mk
+++ b/sc/CppunitTest_sc_datapilotfieldobj.mk
@@ -31,8 +31,7 @@
$(eval $(call gb_CppunitTest_CppunitTest,sc_datapilotfieldobj))
$(eval $(call gb_CppunitTest_add_exception_objects,sc_datapilotfieldobj, \
- sc/qa/extras/datapilotfieldobj \
- sc/qa/extras/xdatapilotfieldgrouping \
+ sc/qa/extras/scdatapilotfieldobj \
))
$(eval $(call gb_CppunitTest_add_linked_libs,sc_datapilotfieldobj, \
diff --git a/sc/CppunitTest_sc_datapilotdescriptorbase.mk b/sc/CppunitTest_sc_datapilottableobj.mk
index 31a49b80a8f7..05bca552c35e 100644
--- a/sc/CppunitTest_sc_datapilotdescriptorbase.mk
+++ b/sc/CppunitTest_sc_datapilottableobj.mk
@@ -28,14 +28,13 @@
# instead of those above.
#*************************************************************************
-$(eval $(call gb_CppunitTest_CppunitTest,sc_datapilotdescriptorbase))
+$(eval $(call gb_CppunitTest_CppunitTest,sc_datapilottableobj))
-$(eval $(call gb_CppunitTest_add_exception_objects,sc_datapilotdescriptorbase, \
- sc/qa/extras/xdatapilotdescriptor \
- sc/qa/extras/xdatapilottable \
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_datapilottableobj, \
+ sc/qa/extras/scdatapilottableobj \
))
-$(eval $(call gb_CppunitTest_add_linked_libs,sc_datapilotdescriptorbase, \
+$(eval $(call gb_CppunitTest_add_linked_libs,sc_datapilottableobj, \
avmedia \
basegfx \
comphelper \
@@ -73,25 +72,25 @@ $(eval $(call gb_CppunitTest_add_linked_libs,sc_datapilotdescriptorbase, \
$(gb_STDLIBS) \
))
-$(eval $(call gb_CppunitTest_set_include,sc_datapilotdescriptorbase,\
+$(eval $(call gb_CppunitTest_set_include,sc_datapilottableobj,\
-I$(realpath $(SRCDIR)/sc/source/ui/inc) \
-I$(realpath $(SRCDIR)/sc/inc) \
$$(INCLUDE) \
-I$(OUTDIR)/inc \
))
-$(eval $(call gb_CppunitTest_add_api,sc_datapilotdescriptorbase,\
+$(eval $(call gb_CppunitTest_add_api,sc_datapilottableobj,\
offapi \
udkapi \
))
-$(eval $(call gb_CppunitTest_uses_ure,sc_datapilotdescriptorbase))
+$(eval $(call gb_CppunitTest_uses_ure,sc_datapilottableobj))
-$(eval $(call gb_CppunitTest_add_type_rdbs,sc_datapilotdescriptorbase,\
+$(eval $(call gb_CppunitTest_add_type_rdbs,sc_datapilottableobj,\
types \
))
-$(eval $(call gb_CppunitTest_add_components,sc_datapilotdescriptorbase,\
+$(eval $(call gb_CppunitTest_add_components,sc_datapilottableobj,\
basic/util/sb \
comphelper/util/comphelp \
configmgr/source/configmgr \
@@ -124,7 +123,7 @@ $(eval $(call gb_CppunitTest_add_components,sc_datapilotdescriptorbase,\
unoxml/source/service/unoxml \
))
-$(eval $(call gb_CppunitTest_set_args,sc_datapilotdescriptorbase,\
+$(eval $(call gb_CppunitTest_set_args,sc_datapilottableobj,\
--headless \
--protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \
"-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry) module:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry/spool) xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/unittest/registry)" \
@@ -135,7 +134,7 @@ $(eval $(call gb_CppunitTest_set_args,sc_datapilotdescriptorbase,\
# a) explicitly depend on library msword because it is not implied by a link
# relation
# b) explicitly depend on the sc resource files needed at unit-test runtime
-$(call gb_CppunitTest_get_target,sc_datapilotdescriptorbase) : \
+$(call gb_CppunitTest_get_target,sc_datapilottableobj) : \
$(WORKDIR)/AllLangRes/sc \
$(call gb_Library_get_target,localedata_en) \
$(call gb_Library_get_target,scfilt) \
diff --git a/sc/CppunitTest_sc_namedrangeobj.mk b/sc/CppunitTest_sc_namedrangeobj.mk
index bd2d7d9662b1..948e84de2fb5 100644
--- a/sc/CppunitTest_sc_namedrangeobj.mk
+++ b/sc/CppunitTest_sc_namedrangeobj.mk
@@ -31,8 +31,7 @@
$(eval $(call gb_CppunitTest_CppunitTest,sc_namedrangeobj))
$(eval $(call gb_CppunitTest_add_exception_objects,sc_namedrangeobj, \
- sc/qa/extras/xnamedranges \
- sc/qa/extras/xnamedrange \
+ sc/qa/extras/scnamedrangeobj \
))
$(eval $(call gb_CppunitTest_add_linked_libs,sc_namedrangeobj, \
diff --git a/sc/CppunitTest_sc_namedrangesobj.mk b/sc/CppunitTest_sc_namedrangesobj.mk
new file mode 100644
index 000000000000..6a4e968d8b58
--- /dev/null
+++ b/sc/CppunitTest_sc_namedrangesobj.mk
@@ -0,0 +1,142 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Initial Developer of the Original Code is
+# Markus Mohrhard <markus.mohrhard@googlemail.com>
+# Portions created by the Initial Developer are Copyright (C) 2011 the
+# Initial Developer. All Rights Reserved.
+#
+# Major Contributor(s):
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sc_namedrangesobj))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_namedrangesobj, \
+ sc/qa/extras/scnamedrangesobj \
+))
+
+$(eval $(call gb_CppunitTest_add_linked_libs,sc_namedrangesobj, \
+ avmedia \
+ basegfx \
+ comphelper \
+ cppu \
+ cppuhelper \
+ drawinglayer \
+ editeng \
+ fileacc \
+ for \
+ forui \
+ i18nisolang1 \
+ msfilter \
+ oox \
+ sal \
+ salhelper \
+ sax \
+ sb \
+ sc \
+ sfx \
+ sot \
+ svl \
+ svt \
+ svx \
+ svxcore \
+ test \
+ tl \
+ tk \
+ subsequenttest \
+ ucbhelper \
+ unotest \
+ utl \
+ vbahelper \
+ vcl \
+ xo \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_namedrangesobj,\
+ -I$(realpath $(SRCDIR)/sc/source/ui/inc) \
+ -I$(realpath $(SRCDIR)/sc/inc) \
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc \
+))
+
+$(eval $(call gb_CppunitTest_add_api,sc_namedrangesobj,\
+ offapi \
+ udkapi \
+))
+
+$(eval $(call gb_CppunitTest_uses_ure,sc_namedrangesobj))
+
+$(eval $(call gb_CppunitTest_add_type_rdbs,sc_namedrangesobj,\
+ types \
+))
+
+$(eval $(call gb_CppunitTest_add_components,sc_namedrangesobj,\
+ basic/util/sb \
+ comphelper/util/comphelp \
+ configmgr/source/configmgr \
+ dbaccess/util/dba \
+ fileaccess/source/fileacc \
+ filter/source/config/cache/filterconfig1 \
+ forms/util/frm \
+ framework/util/fwk \
+ i18npool/util/i18npool \
+ oox/util/oox \
+ package/source/xstor/xstor \
+ package/util/package2 \
+ sax/source/expatwrap/expwrap \
+ sax/source/fastparser/fastsax \
+ sc/util/sc \
+ sc/util/scd \
+ sc/util/scfilt \
+ sc/util/vbaobj \
+ scripting/source/basprov/basprov \
+ scripting/util/scriptframe \
+ 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 \
+))
+
+$(eval $(call gb_CppunitTest_set_args,sc_namedrangesobj,\
+ --headless \
+ --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \
+ "-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry) module:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry/spool) xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/unittest/registry)" \
+))
+ # .../spool is required for the (somewhat strange) filter configuration
+
+# we need to
+# a) explicitly depend on library msword because it is not implied by a link
+# relation
+# b) explicitly depend on the sc resource files needed at unit-test runtime
+$(call gb_CppunitTest_get_target,sc_namedrangesobj) : \
+ $(WORKDIR)/AllLangRes/sc \
+ $(call gb_Library_get_target,localedata_en) \
+ $(call gb_Library_get_target,scfilt) \
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/CppunitTest_sc_spreadsheetobj.mk b/sc/CppunitTest_sc_tablesheetsobj.mk
index 29779bd952bf..c7f43d0c7018 100644
--- a/sc/CppunitTest_sc_spreadsheetobj.mk
+++ b/sc/CppunitTest_sc_tablesheetsobj.mk
@@ -31,7 +31,7 @@
$(eval $(call gb_CppunitTest_CppunitTest,sc_spreadsheetobj))
$(eval $(call gb_CppunitTest_add_exception_objects,sc_spreadsheetobj, \
- sc/qa/extras/xspreadsheets2 \
+ sc/qa/extras/sctablesheetsobj \
))
$(eval $(call gb_CppunitTest_add_linked_libs,sc_spreadsheetobj, \
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 266f82277958..d7d28ef03d47 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -35,21 +35,21 @@ $(eval $(call gb_Module_add_targets,sc,\
))
$(eval $(call gb_Module_add_check_targets,sc,\
- CppunitTest_sc_filters_test \
CppunitTest_sc_ucalc \
+ CppunitTest_sc_filters_test \
))
$(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
- CppunitTest_sc_cellrangesbase \
- CppunitTest_sc_datapilotdescriptorbase \
+ JunitTest_sc_complex \
+ JunitTest_sc_unoapi \
+ CppunitTest_sc_cellrangeobj \
+ CppunitTest_sc_datapilottableobj \
CppunitTest_sc_datapilotfieldobj \
CppunitTest_sc_macros_test \
CppunitTest_sc_namedrangeobj \
- CppunitTest_sc_spreadsheetobj \
+ CppunitTest_sc_namedrangesobj \
+ CppunitTest_sc_tablesheetsobj \
CppunitTest_sc_subsequent_filters_test \
- CppunitTest_sc_tableautoformatfield \
- JunitTest_sc_complex \
- JunitTest_sc_unoapi \
))
# vim: set noet sw=4 ts=4:
diff --git a/sc/qa/extras/sccellrangeobj.cxx b/sc/qa/extras/sccellrangeobj.cxx
new file mode 100644
index 000000000000..20a191c1f5a7
--- /dev/null
+++ b/sc/qa/extras/sccellrangeobj.cxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/sheet/xcellrangesquery.hxx>
+#include <test/sheet/cellproperties.hxx>
+
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+
+namespace sc_apitest {
+
+#define NUMBER_OF_TESTS 8
+
+class ScCellRangeObj : public UnoApiTest, apitest::XCellRangesQuery, apitest::CellProperties
+{
+public:
+ virtual void setUp();
+ virtual void tearDown();
+ virtual uno::Reference< uno::XInterface > init();
+
+ CPPUNIT_TEST_SUITE(ScCellRangeObj);
+ CPPUNIT_TEST(testQueryColumnDifference);
+ CPPUNIT_TEST(testQueryContentDifference);
+ CPPUNIT_TEST(testQueryEmptyCells);
+ //CPPUNIT_TEST(testQueryFormulaCells);
+ CPPUNIT_TEST(testQueryIntersection);
+ CPPUNIT_TEST(testQueryRowDifference);
+ CPPUNIT_TEST(testQueryVisibleCells);
+ CPPUNIT_TEST(testVertJustify);
+ CPPUNIT_TEST(testRotateReference);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ static sal_Int32 nTest;
+ static uno::Reference< lang::XComponent > mxComponent;
+};
+
+sal_Int32 ScCellRangeObj::nTest = 0;
+uno::Reference< lang::XComponent > ScCellRangeObj::mxComponent;
+
+uno::Reference< uno::XInterface > ScCellRangeObj::init()
+{
+ rtl::OUString aFileURL;
+ const rtl::OUString aFileBase(RTL_CONSTASCII_USTRINGPARAM("xcellrangesquery.ods"));
+ createFileURL(aFileBase, aFileURL);
+ std::cout << rtl::OUStringToOString(aFileURL, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
+ if( !mxComponent.is())
+ mxComponent = loadFromDesktop(aFileURL);
+ uno::Reference< sheet::XSpreadsheetDocument> xDoc (mxComponent, UNO_QUERY_THROW);
+ uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
+ uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW);
+
+ CPPUNIT_ASSERT_MESSAGE("Could not create interface of type XSpreadsheet", xSheet.is());
+
+ uno::Reference<table::XCellRange> xReturn(xSheet->getCellRangeByPosition(0,0,3,4), UNO_QUERY_THROW);
+
+ CPPUNIT_ASSERT_MESSAGE("Could not create object of type XCellRangesQuery", xReturn.is());
+ return xReturn;
+}
+
+void ScCellRangeObj::setUp()
+{
+ nTest++;
+ CPPUNIT_ASSERT(nTest <= NUMBER_OF_TESTS);
+ UnoApiTest::setUp();
+}
+
+void ScCellRangeObj::tearDown()
+{
+ if (nTest == NUMBER_OF_TESTS)
+ {
+ closeDocument(mxComponent);
+ }
+
+ UnoApiTest::tearDown();
+
+ if (nTest == NUMBER_OF_TESTS)
+ {
+ mxDesktop->terminate();
+ }
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScCellRangeObj);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/extras/scdatabaserangeobj.cxx b/sc/qa/extras/scdatabaserangeobj.cxx
new file mode 100644
index 000000000000..69a3d48dcee6
--- /dev/null
+++ b/sc/qa/extras/scdatabaserangeobj.cxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/sheet/xdatabaserange.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/sheet/XDatabaseRange.hpp>
+
+
+namespace sc_apitest {
+
+#define NUMBER_OF_TESTS 3
+
+class ScDatabaseRangeObj : public UnoApiTest, apitest::XDatabaseRange
+{
+public:
+ virtual void setUp();
+ virtual void tearDown();
+
+ virtual uno::Reference< uno::XInterface > init( const rtl::OUString& rDBName );
+
+ CPPUNIT_TEST_SUITE(ScDatabaseRangeObj);
+ CPPUNIT_TEST(testDataArea);
+ CPPUNIT_TEST(testGetSortDescriptor);
+ CPPUNIT_TEST(testGetSubtotalDescriptor);
+ CPPUNIT_TEST_SUITE_END();
+private:
+ static sal_Int32 nTest;
+ static uno::Reference< lang::XComponent > mxComponent;
+};
+
+sal_Int32 ScDatabaseRangeObj::nTest = 0;
+uno::Reference< lang::XComponent > ScDatabaseRangeObj::mxComponent;
+
+uno::Reference< uno::XInterface > ScDatabaseRangeObj::init( const rtl::OUString& rDBName )
+{
+ rtl::OUString aFileURL;
+ createFileURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("xdatabaserange.ods")), aFileURL);
+ if(!mxComponent.is())
+ mxComponent = loadFromDesktop(aFileURL);
+ CPPUNIT_ASSERT(mxComponent.is());
+
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
+ uno::Reference< beans::XPropertySet > xPropSet(xDoc, UNO_QUERY_THROW);
+ uno::Reference< container::XNameAccess > xNameAccess( xPropSet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DatabaseRanges"))), UNO_QUERY_THROW);
+ uno::Reference< sheet::XDatabaseRange > xDBRange( xNameAccess->getByName(rDBName), UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xDBRange.is());
+ return xDBRange;
+}
+
+void ScDatabaseRangeObj::setUp()
+{
+ nTest++;
+ UnoApiTest::setUp();
+}
+
+void ScDatabaseRangeObj::tearDown()
+{
+ if (nTest == NUMBER_OF_TESTS)
+ {
+ closeDocument(mxComponent);
+ }
+
+ UnoApiTest::tearDown();
+
+ if (nTest == NUMBER_OF_TESTS)
+ {
+ mxDesktop->terminate();
+ }
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScDatabaseRangeObj);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/extras/xdatapilotfieldgrouping.cxx b/sc/qa/extras/scdatapilotfieldobj.cxx
index 4ee9a1c37028..ff67e4620b75 100644
--- a/sc/qa/extras/xdatapilotfieldgrouping.cxx
+++ b/sc/qa/extras/scdatapilotfieldobj.cxx
@@ -13,7 +13,7 @@
* License.
*
* Major Contributor(s):
- * Copyright (C) 2011 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
+ * Copyright (C) 2012 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
*
* All Rights Reserved.
*
@@ -27,75 +27,54 @@
*/
#include <test/unoapi_test.hxx>
+#include <test/sheet/xdatapilotfieldgrouping.hxx>
+#include <test/sheet/datapilotfield.hxx>
+
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp>
#include <com/sun/star/sheet/XDataPilotTables.hpp>
#include <com/sun/star/sheet/XDataPilotDescriptor.hpp>
-#include <com/sun/star/sheet/XDataPilotFieldGrouping.hpp>
-#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-
-#include <rtl/oustringostreaminserter.hxx>
-namespace ScDataPilotFieldObj {
+namespace sc_apitest {
-#define NUMBER_OF_TESTS 1
+#define NUMBER_OF_TESTS 6
-class ScXDataPilotFieldGrouping : public UnoApiTest
+class ScDataPilotFieldObj : public UnoApiTest, apitest::XDataPilotFieldGrouping,
+ apitest::DataPilotField
{
public:
- void testCreateNameGroup();
- void testCreateDateGroup();
-
virtual void setUp();
virtual void tearDown();
-
- CPPUNIT_TEST_SUITE(ScXDataPilotFieldGrouping);
+ virtual uno::Reference< uno::XInterface > init();
+
+ CPPUNIT_TEST_SUITE(ScDataPilotFieldObj);
+ CPPUNIT_TEST(testSortInfo);
+ CPPUNIT_TEST(testLayoutInfo);
+ CPPUNIT_TEST(testAutoShowInfo);
+ CPPUNIT_TEST(testReference);
+ CPPUNIT_TEST(testIsGroupField);
CPPUNIT_TEST(testCreateNameGroup);
- //broken: fdo#43609
+ // see fdo#
//CPPUNIT_TEST(testCreateDateGroup);
CPPUNIT_TEST_SUITE_END();
-
- uno::Reference< sheet::XDataPilotFieldGrouping > init();
-
private:
- static int nTest;
- static uno::Reference< lang::XComponent > xComponent;
+ static sal_Int32 nTest;
+ static uno::Reference< lang::XComponent > mxComponent;
};
-int ScXDataPilotFieldGrouping::nTest = 0;
-uno::Reference< lang::XComponent > ScXDataPilotFieldGrouping::xComponent;
-
-void ScXDataPilotFieldGrouping::testCreateNameGroup()
-{
- uno::Reference< sheet::XDataPilotFieldGrouping > xDataPilotFieldGrouping = init();
- uno::Reference< sheet::XDataPilotField > xDataPilotField( xDataPilotFieldGrouping, UNO_QUERY_THROW );
- uno::Reference< container::XNameAccess > xNameAccess( xDataPilotField->getItems(), UNO_QUERY_THROW );
- CPPUNIT_ASSERT(xNameAccess->hasElements());
-
- uno::Sequence< rtl::OUString > aElements = xNameAccess->getElementNames();
- xDataPilotFieldGrouping->createNameGroup( aElements );
-}
+sal_Int32 ScDataPilotFieldObj::nTest = 0;
+uno::Reference< lang::XComponent > ScDataPilotFieldObj::mxComponent;
-void ScXDataPilotFieldGrouping::testCreateDateGroup()
-{
- uno::Reference< sheet::XDataPilotFieldGrouping > xDataPilotFieldGrouping = init();
- sheet::DataPilotFieldGroupInfo aGroupInfo;
- aGroupInfo.GroupBy = sheet::DataPilotFieldGroupBy::MONTHS;
- aGroupInfo.HasDateValues = true;
- xDataPilotFieldGrouping->createDateGroup(aGroupInfo);
-}
-
-uno::Reference< sheet::XDataPilotFieldGrouping> ScXDataPilotFieldGrouping::init()
+uno::Reference< uno::XInterface > ScDataPilotFieldObj::init()
{
rtl::OUString aFileURL;
- const rtl::OUString aFileBase(RTL_CONSTASCII_USTRINGPARAM("scdatapilotfieldobj.ods"));
- createFileURL(aFileBase, aFileURL);
- std::cout << rtl::OUStringToOString(aFileURL, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
- if( !xComponent.is())
- xComponent = loadFromDesktop(aFileURL);
- uno::Reference< sheet::XSpreadsheetDocument> xDoc (xComponent, UNO_QUERY_THROW);
+ createFileURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("scdatapilotfieldobj.ods")), aFileURL);
+ if(!mxComponent.is())
+ mxComponent = loadFromDesktop(aFileURL);
+ CPPUNIT_ASSERT(mxComponent.is());
+
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(1), UNO_QUERY_THROW);
@@ -105,32 +84,26 @@ uno::Reference< sheet::XDataPilotFieldGrouping> ScXDataPilotFieldGrouping::init(
uno::Reference< sheet::XDataPilotTables > xDPT = xDPTS->getDataPilotTables();
CPPUNIT_ASSERT(xDPT.is());
uno::Sequence<rtl::OUString> aElementNames = xDPT->getElementNames();
- for (int i = 0; i < aElementNames.getLength(); ++i)
- {
- std::cout << "PivotTable: " << aElementNames[i] << std::endl;
- }
uno::Reference< sheet::XDataPilotDescriptor > xDPDsc(xDPT->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataPilot1"))),UNO_QUERY_THROW);
-
CPPUNIT_ASSERT(xDPDsc.is());
uno::Reference< container::XIndexAccess > xIA( xDPDsc->getDataPilotFields(), UNO_QUERY_THROW);
- uno::Reference< sheet::XDataPilotFieldGrouping > xReturnValue( xIA->getByIndex(0), UNO_QUERY_THROW);
+ uno::Reference< uno::XInterface > xReturnValue( xIA->getByIndex(0), UNO_QUERY_THROW);
CPPUNIT_ASSERT(xReturnValue.is());
return xReturnValue;
}
-void ScXDataPilotFieldGrouping::setUp()
+void ScDataPilotFieldObj::setUp()
{
- nTest += 1;
+ nTest++;
UnoApiTest::setUp();
}
-void ScXDataPilotFieldGrouping::tearDown()
+void ScDataPilotFieldObj::tearDown()
{
if (nTest == NUMBER_OF_TESTS)
{
- uno::Reference< util::XCloseable > xCloseable(xComponent, UNO_QUERY_THROW);
- xCloseable->close( false );
+ closeDocument(mxComponent);
}
UnoApiTest::tearDown();
@@ -138,11 +111,12 @@ void ScXDataPilotFieldGrouping::tearDown()
if (nTest == NUMBER_OF_TESTS)
{
mxDesktop->terminate();
- uno::Reference< lang::XComponent>(m_xContext, UNO_QUERY_THROW)->dispose();
}
}
-CPPUNIT_TEST_SUITE_REGISTRATION(ScXDataPilotFieldGrouping);
+CPPUNIT_TEST_SUITE_REGISTRATION(ScDataPilotFieldObj);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
}
diff --git a/sc/qa/extras/xdatapilottable.cxx b/sc/qa/extras/scdatapilottableobj.cxx
index c19c484d8e96..6d07b8fb8838 100644
--- a/sc/qa/extras/xdatapilottable.cxx
+++ b/sc/qa/extras/scdatapilottableobj.cxx
@@ -27,93 +27,71 @@
*/
#include <test/unoapi_test.hxx>
+#include <test/sheet/xdatapilottable.hxx>
+#include <test/sheet/xdatapilotdescriptor.hxx>
+
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp>
#include <com/sun/star/sheet/XDataPilotTables.hpp>
#include <com/sun/star/sheet/XDataPilotTable.hpp>
-#include <com/sun/star/table/XCell.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <com/sun/star/table/CellRangeAddress.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-
-#include <rtl/oustringostreaminserter.hxx>
-namespace ScDataPilotDescriptorBase
-{
+namespace sc_apitest {
-#define NUMBER_OF_TESTS 2
+#define NUMBER_OF_TESTS 9
-class ScXDataPilotTable : public UnoApiTest
+class ScDataPilotTableObj : public UnoApiTest, apitest::XDataPilotDescriptor, apitest::XDataPilotTable
{
public:
-
virtual void setUp();
virtual void tearDown();
+ virtual uno::Reference< uno::XInterface > init();
- void testGetOutputRange();
- void testRefresh();
- CPPUNIT_TEST_SUITE(ScXDataPilotTable);
+ CPPUNIT_TEST_SUITE(ScDataPilotTableObj);
+ //CPPUNIT_TEST(testRefresh);
+ //CPPUNIT_TEST(testGetHiddenFields);
CPPUNIT_TEST(testGetOutputRange);
- CPPUNIT_TEST(testRefresh);
+ CPPUNIT_TEST(testSourceRange);
+ CPPUNIT_TEST(testTag);
+ CPPUNIT_TEST(testGetFilterDescriptor);
+ CPPUNIT_TEST(testGetDataPilotFields);
+ CPPUNIT_TEST(testGetColumnFields);
+ CPPUNIT_TEST(testGetRowFields);
+ CPPUNIT_TEST(testGetPageFields);
+ CPPUNIT_TEST(testGetDataFields);
CPPUNIT_TEST_SUITE_END();
-private:
- uno::Reference< sheet::XDataPilotTable > init();
-
- static int nTest;
- static uno::Reference< lang::XComponent > xComponent;
-
- uno::Reference< table::XCell > xCellForChange;
- uno::Reference< table::XCell > xCellForCheck;
+private:
+ static sal_Int32 nTest;
+ static uno::Reference< lang::XComponent > mxComponent;
};
-int ScXDataPilotTable::nTest = 0;
-uno::Reference< lang::XComponent > ScXDataPilotTable::xComponent;
+sal_Int32 ScDataPilotTableObj::nTest = 0;
+uno::Reference< lang::XComponent > ScDataPilotTableObj::mxComponent;
-void ScXDataPilotTable::testGetOutputRange()
-{
- uno::Reference< sheet::XDataPilotTable > xDPTable = init();
-
- table::CellRangeAddress aRange = xDPTable->getOutputRange();
- CPPUNIT_ASSERT( aRange.Sheet == 0 );
- CPPUNIT_ASSERT( aRange.StartColumn == 7 );
- CPPUNIT_ASSERT( aRange.StartRow == 8 );
-}
-
-void ScXDataPilotTable::testRefresh()
-{
- uno::Reference< sheet::XDataPilotTable > xDPTable = init();
- xCellForChange->setValue( 5 );
-
- double aOldData = xCellForCheck->getValue();
- xDPTable->refresh();
- double aNewData = xCellForCheck->getValue();
- CPPUNIT_ASSERT_MESSAGE("value needs to change", aOldData != aNewData);
-}
-
-uno::Reference< sheet::XDataPilotTable > ScXDataPilotTable::init()
+uno::Reference< uno::XInterface > ScDataPilotTableObj::init()
{
rtl::OUString aFileURL;
- const rtl::OUString aFileBase(RTL_CONSTASCII_USTRINGPARAM("ScDataPilotTableObj.ods"));
- createFileURL(aFileBase, aFileURL);
- std::cout << rtl::OUStringToOString(aFileURL, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
- if( !xComponent.is())
- xComponent = loadFromDesktop(aFileURL);
- uno::Reference< sheet::XSpreadsheetDocument> xDoc (xComponent, UNO_QUERY_THROW);
+ createFileURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScDataPilotTableObj.ods")), aFileURL);
+ if(!mxComponent.is())
+ mxComponent = loadFromDesktop(aFileURL);
+ CPPUNIT_ASSERT(mxComponent.is());
+
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW);
- // set variables
+ // set variables from xdatapilottable.[ch]xx
xCellForChange = xSheet->getCellByPosition( 1, 5 );
xCellForCheck = xSheet->getCellByPosition( 7, 11 );
+ CPPUNIT_ASSERT(xCellForCheck.is());
+ CPPUNIT_ASSERT(xCellForChange.is());
CPPUNIT_ASSERT_MESSAGE("Could not create interface of type XSpreadsheet", xSheet.is());
uno::Reference< sheet::XDataPilotTablesSupplier > xDPTS(xSheet, UNO_QUERY_THROW);
CPPUNIT_ASSERT(xDPTS.is());
uno::Reference< sheet::XDataPilotTables > xDPT = xDPTS->getDataPilotTables();
CPPUNIT_ASSERT(xDPT.is());
- uno::Sequence<rtl::OUString> aElementNames = xDPT->getElementNames();
uno::Reference< sheet::XDataPilotTable > xDPTable(xDPT->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataPilotTable"))),UNO_QUERY_THROW);
@@ -121,18 +99,17 @@ uno::Reference< sheet::XDataPilotTable > ScXDataPilotTable::init()
return xDPTable;
}
-void ScXDataPilotTable::setUp()
+void ScDataPilotTableObj::setUp()
{
- nTest += 1;
+ nTest++;
UnoApiTest::setUp();
}
-void ScXDataPilotTable::tearDown()
+void ScDataPilotTableObj::tearDown()
{
if (nTest == NUMBER_OF_TESTS)
{
- uno::Reference< util::XCloseable > xCloseable(xComponent, UNO_QUERY_THROW);
- xCloseable->close( false );
+ closeDocument(mxComponent);
}
UnoApiTest::tearDown();
@@ -140,10 +117,13 @@ void ScXDataPilotTable::tearDown()
if (nTest == NUMBER_OF_TESTS)
{
mxDesktop->terminate();
- uno::Reference< lang::XComponent>(m_xContext, UNO_QUERY_THROW)->dispose();
}
}
+CPPUNIT_TEST_SUITE_REGISTRATION(ScDataPilotTableObj);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/extras/scnamedrangeobj.cxx b/sc/qa/extras/scnamedrangeobj.cxx
new file mode 100644
index 000000000000..2d7240276ed0
--- /dev/null
+++ b/sc/qa/extras/scnamedrangeobj.cxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <test/sheet/xnamedrange.hxx>
+#include <test/unoapi_test.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+
+namespace sc_apitest {
+
+#define NUMBER_OF_TESTS 6
+
+class ScNamedRangeObj : public UnoApiTest, apitest::XNamedRange
+{
+public:
+ virtual void setUp();
+ virtual void tearDown();
+
+ virtual uno::Reference< uno::XInterface > init();
+ virtual uno::Reference< sheet::XNamedRange > getNamedRange(const rtl::OUString& rRangeName);
+
+ CPPUNIT_TEST_SUITE(ScNamedRangeObj);
+ CPPUNIT_TEST(testGetContent);
+ CPPUNIT_TEST(testSetContent);
+ CPPUNIT_TEST(testGetType);
+ CPPUNIT_TEST(testSetType);
+ CPPUNIT_TEST(testGetReferencePosition);
+ CPPUNIT_TEST(testSetReferencePosition);
+ CPPUNIT_TEST_SUITE_END();
+private:
+ static sal_Int32 nTest;
+ static uno::Reference< lang::XComponent > mxComponent;
+};
+
+sal_Int32 ScNamedRangeObj::nTest = 0;
+uno::Reference< lang::XComponent > ScNamedRangeObj::mxComponent;
+
+uno::Reference< sheet::XNamedRange> ScNamedRangeObj::getNamedRange(const rtl::OUString& rRangeName)
+{
+ uno::Reference< container::XNameAccess > xNamedAccess(init(), UNO_QUERY_THROW);
+ uno::Reference< sheet::XNamedRange > xNamedRange(xNamedAccess->getByName(rRangeName), UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xNamedRange.is());
+
+ return xNamedRange;
+}
+
+uno::Reference< uno::XInterface > ScNamedRangeObj::init()
+{
+ rtl::OUString aFileURL;
+ createFileURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rangenames.ods")), aFileURL);
+ if(!mxComponent.is())
+ mxComponent = loadFromDesktop(aFileURL);
+ CPPUNIT_ASSERT(mxComponent.is());
+
+ uno::Reference< beans::XPropertySet > xPropSet (mxComponent, UNO_QUERY_THROW);
+ rtl::OUString aNamedRangesPropertyString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
+ uno::Reference< container::XNameAccess > xNamedRangesNameAccess(xPropSet->getPropertyValue(aNamedRangesPropertyString), UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xNamedRangesNameAccess.is());
+
+ return xNamedRangesNameAccess;
+}
+
+void ScNamedRangeObj::setUp()
+{
+ nTest++;
+ UnoApiTest::setUp();
+}
+
+void ScNamedRangeObj::tearDown()
+{
+ if (nTest == NUMBER_OF_TESTS)
+ {
+ closeDocument(mxComponent);
+ }
+
+ UnoApiTest::tearDown();
+
+ if (nTest == NUMBER_OF_TESTS)
+ {
+ mxDesktop->terminate();
+ }
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScNamedRangeObj);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/extras/scnamedrangesobj.cxx b/sc/qa/extras/scnamedrangesobj.cxx
new file mode 100644
index 000000000000..f6d2322eadd5
--- /dev/null
+++ b/sc/qa/extras/scnamedrangesobj.cxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/sheet/xnamedranges.hxx>
+
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sheet/XNamedRanges.hpp>
+
+namespace sc_apitest {
+
+#define NUMBER_OF_TESTS 3
+
+class ScNamedRangesObj : public UnoApiTest, apitest::XNamedRanges
+{
+public:
+ virtual void setUp();
+ virtual void tearDown();
+
+ virtual uno::Reference< uno::XInterface > init(sal_Int32 nSheet);
+
+ CPPUNIT_TEST_SUITE(ScNamedRangesObj);
+ CPPUNIT_TEST(testAddNewByName);
+ CPPUNIT_TEST(testAddNewFromTitles);
+ //CPPUNIT_TEST_EXCEPTION(testRemoveByName, uno::RuntimeException);
+ CPPUNIT_TEST(testOutputList);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ static sal_Int32 nTest;
+ static uno::Reference< lang::XComponent > mxComponent;
+};
+
+sal_Int32 ScNamedRangesObj::nTest = 0;
+uno::Reference< lang::XComponent > ScNamedRangesObj::mxComponent;
+
+uno::Reference< uno::XInterface > ScNamedRangesObj::init(sal_Int32 nSheet)
+{
+ rtl::OUString aFileURL;
+ createFileURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rangenames.ods")), aFileURL);
+ if(!mxComponent.is())
+ mxComponent = loadFromDesktop(aFileURL);
+ CPPUNIT_ASSERT(mxComponent.is());
+
+ uno::Reference< beans::XPropertySet > xPropSet (mxComponent, UNO_QUERY_THROW);
+ rtl::OUString aNamedRangesPropertyString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
+ uno::Reference< sheet::XNamedRanges > xNamedRanges(xPropSet->getPropertyValue(aNamedRangesPropertyString), UNO_QUERY_THROW);
+
+ //set value from xnamedranges.hxx
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
+ uno::Reference< container::XIndexAccess > xIndexAccess(xDoc->getSheets(), UNO_QUERY_THROW);
+ xSheet = uno::Reference< sheet::XSpreadsheet >(xIndexAccess->getByIndex(nSheet),UNO_QUERY_THROW);
+
+ return xNamedRanges;
+}
+
+void ScNamedRangesObj::setUp()
+{
+ nTest++;
+ UnoApiTest::setUp();
+}
+
+void ScNamedRangesObj::tearDown()
+{
+ if (nTest == NUMBER_OF_TESTS)
+ {
+ closeDocument(mxComponent);
+ }
+
+ UnoApiTest::tearDown();
+
+ if (nTest == NUMBER_OF_TESTS)
+ {
+ mxDesktop->terminate();
+ }
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScNamedRangesObj);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/extras/sctablesheetsobj.cxx b/sc/qa/extras/sctablesheetsobj.cxx
new file mode 100644
index 000000000000..8b0b5e963f19
--- /dev/null
+++ b/sc/qa/extras/sctablesheetsobj.cxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/sheet/xspreadsheets2.hxx>
+#include <test/container/xnamecontainer.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+
+namespace sc_apitest {
+
+#define NUMBER_OF_TESTS 13
+
+class ScTableSheetsObj : public UnoApiTest, public ::apitest::XSpreadsheets2, apitest::XNameContainer
+{
+public:
+ ScTableSheetsObj();
+
+ virtual void setUp();
+ virtual void tearDown();
+
+ CPPUNIT_TEST_SUITE(ScTableSheetsObj);
+ CPPUNIT_TEST(testImportValue);
+ CPPUNIT_TEST(testImportString);
+ CPPUNIT_TEST(testImportedSheetNameAndIndex);
+ CPPUNIT_TEST(testImportString);
+ CPPUNIT_TEST(testImportValue);
+ CPPUNIT_TEST(testImportFormulaBasicMath);
+ CPPUNIT_TEST(testImportFormulaWithNamedRange);
+ CPPUNIT_TEST(testImportOverExistingNamedRange);
+ CPPUNIT_TEST(testImportNamedRangeDefinedInSource);
+ CPPUNIT_TEST(testImportNamedRangeRedefinedInSource);
+ CPPUNIT_TEST(testImportNewNamedRange);
+ CPPUNIT_TEST(testImportCellStyle);
+ CPPUNIT_TEST(testRemoveByName);
+ CPPUNIT_TEST_SUITE_END();
+
+ virtual uno::Reference< lang::XComponent > getComponent();
+ virtual void createFileURL(const rtl::OUString& rFileBase, rtl::OUString& rFileURL);
+ virtual uno::Reference< lang::XComponent > loadFromDesktop(const rtl::OUString& rString);
+ virtual uno::Reference< uno::XInterface > init();
+protected:
+ static uno::Reference< lang::XComponent > mxComponent;
+ static sal_Int32 nTest;
+};
+
+uno::Reference< lang::XComponent > ScTableSheetsObj::mxComponent;
+sal_Int32 ScTableSheetsObj::nTest = 0;
+
+ScTableSheetsObj::ScTableSheetsObj():
+ apitest::XNameContainer(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Sheet2")))
+{
+
+}
+
+uno::Reference< lang::XComponent > ScTableSheetsObj::getComponent()
+{
+ return mxComponent;
+}
+
+void ScTableSheetsObj::createFileURL(const rtl::OUString& rFileBase, rtl::OUString& rFileURL)
+{
+ UnoApiTest::createFileURL(rFileBase, rFileURL);
+}
+
+uno::Reference< lang::XComponent > ScTableSheetsObj::loadFromDesktop(const rtl::OUString& rString)
+{
+ return UnoApiTest::loadFromDesktop(rString);
+}
+
+uno::Reference< uno::XInterface > ScTableSheetsObj::init()
+{
+ rtl::OUString aFileURL;
+ createFileURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rangenamessrc.ods")), aFileURL);
+ if(!mxComponent.is())
+ mxComponent = loadFromDesktop(aFileURL);
+ CPPUNIT_ASSERT(mxComponent.is());
+ xDocument = uno::Reference< sheet::XSpreadsheetDocument >(mxComponent, UNO_QUERY_THROW);
+ uno::Reference< uno::XInterface > xReturn( xDocument->getSheets(), UNO_QUERY_THROW);
+
+ return xReturn;
+}
+
+void ScTableSheetsObj::setUp()
+{
+ nTest++;
+ CPPUNIT_ASSERT(nTest <= NUMBER_OF_TESTS);
+ UnoApiTest::setUp();
+}
+
+void ScTableSheetsObj::tearDown()
+{
+ if (nTest == NUMBER_OF_TESTS)
+ {
+ closeDocument(mxComponent);
+ }
+
+ UnoApiTest::tearDown();
+
+ if (nTest == NUMBER_OF_TESTS)
+ {
+ mxDesktop->terminate();
+ }
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScTableSheetsObj);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/extras/testdocuments/rangenamessrc.ods b/sc/qa/extras/testdocuments/rangenamessrc.ods
index f6546e960c8f..d22702bda2da 100644
--- a/sc/qa/extras/testdocuments/rangenamessrc.ods
+++ b/sc/qa/extras/testdocuments/rangenamessrc.ods
Binary files differ
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 802b0f71dc98..649fa1e75036 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -67,6 +67,17 @@ $(eval $(call gb_Library_use_external,subsequenttest,cppunit))
$(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/unoapi_test \
+ test/source/container/xnamecontainer \
+ test/source/sheet/cellproperties \
+ test/source/sheet/datapilotfield \
+ test/source/sheet/xcellrangesquery \
+ test/source/sheet/xdatabaserange \
+ test/source/sheet/xdatapilotdescriptor \
+ test/source/sheet/xdatapilotfieldgrouping \
+ test/source/sheet/xdatapilottable \
+ test/source/sheet/xnamedrange \
+ test/source/sheet/xnamedranges \
+ test/source/sheet/xspreadsheets2 \
))
# vim: set noet sw=4 ts=4:
diff --git a/test/Package_inc.mk b/test/Package_inc.mk
index 13b70cf99592..aeb82f1ae73b 100644
--- a/test/Package_inc.mk
+++ b/test/Package_inc.mk
@@ -29,5 +29,16 @@ $(eval $(call gb_Package_Package,test_inc,$(SRCDIR)/test/inc))
$(eval $(call gb_Package_add_file,test_inc,inc/test/bootstrapfixture.hxx,test/bootstrapfixture.hxx))
$(eval $(call gb_Package_add_file,test_inc,inc/test/testdllapi.hxx,test/testdllapi.hxx))
$(eval $(call gb_Package_add_file,test_inc,inc/test/unoapi_test.hxx,test/unoapi_test.hxx))
+$(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xdatapilotdescriptor.hxx,test/sheet/xdatapilotdescriptor.hxx))
+$(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xcellrangesquery.hxx,test/sheet/xcellrangesquery.hxx))
+$(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xnamedranges.hxx,test/sheet/xnamedranges.hxx))
+$(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xnamedrange.hxx,test/sheet/xnamedrange.hxx))
+$(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xdatabaserange.hxx,test/sheet/xdatabaserange.hxx))
+$(eval $(call gb_Package_add_file,test_inc,inc/test/container/xnamecontainer.hxx,test/container/xnamecontainer.hxx))
+$(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/cellproperties.hxx,test/sheet/cellproperties.hxx))
+$(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xdatapilottable.hxx,test/sheet/xdatapilottable.hxx))
+$(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xdatapilotfieldgrouping.hxx,test/sheet/xdatapilotfieldgrouping.hxx))
+$(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/datapilotfield.hxx,test/sheet/datapilotfield.hxx))
+$(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xspreadsheets2.hxx,test/sheet/xspreadsheets2.hxx))
# vim: set noet sw=4 ts=4:
diff --git a/test/inc/test/container/xnamecontainer.hxx b/test/inc/test/container/xnamecontainer.hxx
new file mode 100644
index 000000000000..6f296d7c5905
--- /dev/null
+++ b/test/inc/test/container/xnamecontainer.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+using namespace com::sun::star;
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XNameContainer
+{
+public:
+ // removes default entry
+ XNameContainer();
+ // removes given entry
+ XNameContainer(const rtl::OUString& rName);
+
+ virtual uno::Reference< uno::XInterface > init() = 0;
+
+ void testRemoveByName();
+
+private:
+ rtl::OUString maNameToRemove;
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/test/inc/test/sheet/cellproperties.hxx b/test/inc/test/sheet/cellproperties.hxx
new file mode 100644
index 000000000000..f2a3b7150060
--- /dev/null
+++ b/test/inc/test/sheet/cellproperties.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <test/testdllapi.hxx>
+
+using namespace com::sun::star;
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST CellProperties
+{
+public:
+ virtual uno::Reference < uno::XInterface > init() = 0;
+
+ void testVertJustify();
+ void testRotateReference();
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/test/inc/test/sheet/datapilotfield.hxx b/test/inc/test/sheet/datapilotfield.hxx
new file mode 100644
index 000000000000..c87dfc07537b
--- /dev/null
+++ b/test/inc/test/sheet/datapilotfield.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+using namespace com::sun::star;
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST DataPilotField
+{
+public:
+ virtual uno::Reference< uno::XInterface > init() = 0;
+
+ void testSortInfo();
+ void testLayoutInfo();
+ void testAutoShowInfo();
+ void testReference();
+ void testIsGroupField();
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/test/inc/test/sheet/tableautoformatfield.hxx b/test/inc/test/sheet/tableautoformatfield.hxx
new file mode 100644
index 000000000000..ae262f59d34a
--- /dev/null
+++ b/test/inc/test/sheet/tableautoformatfield.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+using namespace com::sun::star;
+
+namespace apitest {
+
+class TableAutoFormatField
+{
+public:
+ //don't use virtual init() here
+ uno::Reference< beans::XPropertySet > initTest();
+
+ virtual uno::Reference< > getServiceFactory() = 0;
+
+ void testRotateReference();
+ void testVertJustify();
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/test/inc/test/sheet/xcellrangesquery.hxx b/test/inc/test/sheet/xcellrangesquery.hxx
new file mode 100644
index 000000000000..c315163f5b90
--- /dev/null
+++ b/test/inc/test/sheet/xcellrangesquery.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * [ Copyright (C) 2011 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer) ]
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <test/testdllapi.hxx>
+
+using namespace com::sun::star;
+
+
+namespace apitest {
+
+
+class OOO_DLLPUBLIC_TEST XCellRangesQuery
+{
+public:
+
+ virtual uno::Reference< uno::XInterface > init() = 0;
+
+ //Testcases
+ void testQueryColumnDifference();
+ void testQueryContentDifference();
+ void testQueryEmptyCells();
+ void testQueryFormulaCells();
+ void testQueryIntersection();
+ void testQueryRowDifference();
+ void testQueryVisibleCells();
+
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/test/inc/test/sheet/xdatabaserange.hxx b/test/inc/test/sheet/xdatabaserange.hxx
new file mode 100644
index 000000000000..6c5eac04d977
--- /dev/null
+++ b/test/inc/test/sheet/xdatabaserange.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+using namespace com::sun::star;
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XDatabaseRange
+{
+public:
+ virtual uno::Reference< uno::XInterface > init(const rtl::OUString& rDBName) = 0;
+
+ void testDataArea();
+ void testGetSortDescriptor();
+ void testGetSubtotalDescriptor();
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/test/inc/test/sheet/xdatapilotdescriptor.hxx b/test/inc/test/sheet/xdatapilotdescriptor.hxx
new file mode 100644
index 000000000000..9eca14ca4c51
--- /dev/null
+++ b/test/inc/test/sheet/xdatapilotdescriptor.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/sheet/XDataPilotDescriptor.hpp>
+
+#include <test/testdllapi.hxx>
+
+#include <vector>
+
+using namespace com::sun::star;
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XDataPilotDescriptor
+{
+public:
+ void testSourceRange();
+ void testTag();
+ void testGetFilterDescriptor();
+ void testGetDataPilotFields();
+ void testGetColumnFields();
+ void testGetRowFields();
+ void testGetPageFields();
+ void testGetDataFields();
+ void testGetHiddenFields();
+
+ virtual uno::Reference< uno::XInterface > init() = 0;
+private:
+
+ void testGetDataPilotFields_Impl( uno::Reference< sheet::XDataPilotDescriptor > xDescr );
+
+ void checkName( uno::Reference< container::XIndexAccess > xIndex, sal_Int32 nIndex );
+ static std::vector<rtl::OUString> maFieldNames;
+};
+
+std::vector< rtl::OUString > XDataPilotDescriptor::maFieldNames;
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/test/inc/test/sheet/xdatapilotfieldgrouping.hxx b/test/inc/test/sheet/xdatapilotfieldgrouping.hxx
new file mode 100644
index 000000000000..b1e086461693
--- /dev/null
+++ b/test/inc/test/sheet/xdatapilotfieldgrouping.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <test/testdllapi.hxx>
+
+using namespace com::sun::star;
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XDataPilotFieldGrouping
+{
+public:
+ void testCreateNameGroup();
+ void testCreateDateGroup();
+
+ virtual uno::Reference< uno::XInterface > init() = 0;
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/test/inc/test/sheet/xdatapilottable.hxx b/test/inc/test/sheet/xdatapilottable.hxx
new file mode 100644
index 000000000000..7d67f97e7f7c
--- /dev/null
+++ b/test/inc/test/sheet/xdatapilottable.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/table/XCell.hpp>
+#include <test/testdllapi.hxx>
+
+#include "cppunit/extensions/HelperMacros.h"
+
+using namespace com::sun::star;
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XDataPilotTable
+{
+public:
+ virtual uno::Reference< uno::XInterface > init() = 0;
+
+ void testGetOutputRange();
+ void testRefresh();
+
+protected:
+ uno::Reference< table::XCell > xCellForChange;
+ uno::Reference< table::XCell > xCellForCheck;
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/test/inc/test/sheet/xnamedrange.hxx b/test/inc/test/sheet/xnamedrange.hxx
new file mode 100644
index 000000000000..1859237a5c96
--- /dev/null
+++ b/test/inc/test/sheet/xnamedrange.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 Laurent Godard lgodard.libre@laposte.net (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/sheet/XNamedRange.hpp>
+#include <test/testdllapi.hxx>
+
+using namespace com::sun::star;
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XNamedRange
+{
+public:
+ virtual uno::Reference< uno::XInterface > init() = 0;
+
+ // XNamedRange
+ void testGetContent();
+ void testSetContent();
+ void testGetType();
+ void testSetType();
+ void testGetReferencePosition();
+ void testSetReferencePosition();
+protected:
+ virtual uno::Reference< sheet::XNamedRange> getNamedRange(const rtl::OUString&) = 0;
+
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/test/inc/test/sheet/xnamedranges.hxx b/test/inc/test/sheet/xnamedranges.hxx
new file mode 100644
index 000000000000..508fec5f2180
--- /dev/null
+++ b/test/inc/test/sheet/xnamedranges.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 Laurent Godard lgodard.libre@laposte.net (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <test/testdllapi.hxx>
+
+using namespace com::sun::star;
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XNamedRanges
+{
+public:
+ // remove default entry
+ XNamedRanges();
+ // removes given entry
+ XNamedRanges(const rtl::OUString& rNameToRemove);
+
+ virtual uno::Reference< uno::XInterface > init(sal_Int32 nSheets = 0) = 0;
+
+ // XNamedRanges
+ void testAddNewByName();
+ void testAddNewFromTitles();
+ void testRemoveByName();
+ void testOutputList();
+
+protected:
+ uno::Reference< sheet::XSpreadsheet > xSheet;
+
+private:
+ rtl::OUString maNameToRemove;
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/test/inc/test/sheet/xspreadsheets2.hxx b/test/inc/test/sheet/xspreadsheets2.hxx
new file mode 100644
index 000000000000..cb8f5c2181c2
--- /dev/null
+++ b/test/inc/test/sheet/xspreadsheets2.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 Laurent Godard lgodard.libre@laposte.net (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "test/testdllapi.hxx"
+
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/sheet/XNamedRanges.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include <rtl/ustring.hxx>
+
+using namespace com::sun::star;
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XSpreadsheets2
+{
+public:
+ XSpreadsheets2();
+
+ // XSpreadsheets2
+ void testImportedSheetNameAndIndex();
+ void testImportString();
+ void testImportValue();
+ void testImportFormulaBasicMath();
+ void testImportFormulaWithNamedRange();
+ void testImportOverExistingNamedRange();
+ void testImportNamedRangeDefinedInSource();
+ void testImportNamedRangeRedefinedInSource();
+ void testImportNewNamedRange();
+ void testImportCellStyle();
+
+ virtual uno::Reference< lang::XComponent > getComponent() = 0;
+ virtual uno::Reference< uno::XInterface > init() = 0;
+ virtual uno::Reference< lang::XComponent > loadFromDesktop(const rtl::OUString&) = 0;
+ virtual void createFileURL(const rtl::OUString&, rtl::OUString&) = 0;
+
+protected:
+ uno::Reference< sheet::XSpreadsheetDocument> xDocument;
+
+private:
+ uno::Reference< sheet::XSpreadsheetDocument> getDoc(const rtl::OUString&, uno::Reference< lang::XComponent >&);
+ uno::Reference< sheet::XNamedRanges> getNamedRanges(uno::Reference< sheet::XSpreadsheetDocument >);
+ void importSheetToCopy();
+ bool isExternalReference(const rtl::OUString& aDestContent, const rtl::OUString& aSrcContent );
+
+ uno::Reference< sheet::XSpreadsheetDocument> xDestDoc;
+ uno::Reference< sheet::XSpreadsheet > xDestSheet;
+ uno::Reference< sheet::XSpreadsheet > xSrcSheet;
+ rtl::OUString aSrcSheetName;
+ rtl::OUString aSrcFileName;
+ rtl::OUString aDestFileBase;
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/test/inc/test/unoapi_test.hxx b/test/inc/test/unoapi_test.hxx
index 54dcff854b41..b3e341a188d2 100644
--- a/test/inc/test/unoapi_test.hxx
+++ b/test/inc/test/unoapi_test.hxx
@@ -29,17 +29,10 @@
#include <sal/config.h>
#include <test/bootstrapfixture.hxx>
#include <unotest/macros_test.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
#include <rtl/ustrbuf.hxx>
#include <osl/file.hxx>
-#define ODS_FORMAT_TYPE 50331943
-#define XLS_FORMAT_TYPE 318767171
-#define XLSX_FORMAT_TYPE 268959811
-
-#define ODS 0
-#define XLS 1
-#define XLSX 2
-
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -55,6 +48,9 @@ public:
virtual void setUp();
virtual void tearDown();
+protected:
+ void closeDocument( uno::Reference< lang::XComponent > xDocument );
+
private:
uno::Reference<uno::XInterface> m_xCalcComponent;
diff --git a/sc/qa/extras/xnamecontainer.cxx b/test/source/container/xnamecontainer.cxx
index 0a4233577ed4..17f8f0eee2c8 100644
--- a/sc/qa/extras/xnamecontainer.cxx
+++ b/test/source/container/xnamecontainer.cxx
@@ -26,37 +26,37 @@
* instead of those above.
*/
-#include <test/unoapi_test.hxx>
+#include <test/container/xnamecontainer.hxx>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include "cppunit/extensions/HelperMacros.h"
+#include <iostream>
-namespace ScTableSheetsObj
-{
+using namespace com::sun::star::uno;
-class ScXNameContainer : public UnoApiTest
-{
- uno::Reference< container::XNameContainer > init();
+namespace apitest {
- void testRemoveByName();
+XNameContainer::XNameContainer(): maNameToRemove(RTL_CONSTASCII_USTRINGPARAM("XNameContainer"))
+{
+}
- CPPUNIT_TEST_SUITE(ScXNameContainer);
- CPPUNIT_TEST(testRemoveByName);
- CPPUNIT_TEST_SUITE_END();
-};
+XNameContainer::XNameContainer(const rtl::OUString& rNameToRemove):
+ maNameToRemove(rNameToRemove)
+{
+}
-void ScXNameContainer::testRemoveByName()
+void XNameContainer::testRemoveByName()
{
- rtl::OUString aSheet2(RTL_CONSTASCII_USTRINGPARAM("Sheet2"));
- uno::Reference< container::XNameContainer > xNameContainer = init();
- CPPUNIT_ASSERT(xNameContainer->hasByName(aSheet2));
- xNameContainer->removeByName(aSheet2);
- CPPUNIT_ASSERT(!xNameContainer->hasByName(aSheet2));
+ uno::Reference< container::XNameContainer > xNameContainer(init(),UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xNameContainer->hasByName(maNameToRemove));
+ xNameContainer->removeByName(maNameToRemove);
+ CPPUNIT_ASSERT(!xNameContainer->hasByName(maNameToRemove));
bool bExceptionThrown = false;
try
{
- xNameContainer->removeByName(aSheet2);
+ xNameContainer->removeByName(maNameToRemove);
}
catch( const container::NoSuchElementException& )
{
@@ -67,19 +67,6 @@ void ScXNameContainer::testRemoveByName()
CPPUNIT_ASSERT_MESSAGE("no exception thrown", bExceptionThrown);
}
-uno::Reference< container::XNameContainer > ScXNameContainer::init()
-{
- uno::Reference< lang::XComponent > xComponent;
- xComponent = loadFromDesktop(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc")));
- CPPUNIT_ASSERT(xComponent.is());
- uno::Reference< sheet::XSpreadsheetDocument> xDoc (xComponent, UNO_QUERY_THROW);
- uno::Reference< container::XNameContainer > xNameContainer ( xDoc->getSheets(), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xNameContainer.is());
- return xNameContainer;
-}
-
-CPPUNIT_TEST_SUITE_REGISTRATION(ScXNameContainer);
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/extras/cellproperties.cxx b/test/source/sheet/cellproperties.cxx
index 29379153c54a..d9d5fc00891b 100644
--- a/sc/qa/extras/cellproperties.cxx
+++ b/test/source/sheet/cellproperties.cxx
@@ -26,46 +26,21 @@
* instead of those above.
*/
-#include <test/unoapi_test.hxx>
+#include <test/sheet/cellproperties.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/table/CellVertJustify.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
-#include <com/sun/star/table/XCellRange.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-namespace ScCellRangeBase {
+#include "cppunit/extensions/HelperMacros.h"
+#include <iostream>
-#define NUMBER_OF_TESTS 2
-
-class ScCellProperties : public UnoApiTest
-{
-public:
- virtual void setUp();
- virtual void tearDown();
-
- void testVertJustify();
- void testRotateReference();
- CPPUNIT_TEST_SUITE(ScCellProperties);
- CPPUNIT_TEST(testVertJustify);
- CPPUNIT_TEST(testRotateReference);
- CPPUNIT_TEST_SUITE_END();
-
-private:
- uno::Reference < beans::XPropertySet > init();
-
- static int nTest;
- static uno::Reference< lang::XComponent > xComponent;
-};
-
-int ScCellProperties::nTest = 0;
-uno::Reference< lang::XComponent > ScCellProperties::xComponent;
+using namespace com::sun::star::uno;
+namespace apitest {
-void ScCellProperties::testVertJustify()
+void CellProperties::testVertJustify()
{
- uno::Reference< beans::XPropertySet > xCellRangeBase = init();
+ uno::Reference< beans::XPropertySet > xCellRangeBase(init(),UNO_QUERY_THROW);
rtl::OUString aVertJustify(RTL_CONSTASCII_USTRINGPARAM("VertJustify"));
uno::Any aOldVertJustify = xCellRangeBase->getPropertyValue(aVertJustify);
sal_Int32 aValue = 0;
@@ -81,9 +56,9 @@ void ScCellProperties::testVertJustify()
CPPUNIT_ASSERT_MESSAGE("value has not been changed", aValue == 3);
}
-void ScCellProperties::testRotateReference()
+void CellProperties::testRotateReference()
{
- uno::Reference< beans::XPropertySet > xCellRangeBase = init();
+ uno::Reference< beans::XPropertySet > xCellRangeBase(init(),UNO_QUERY_THROW);
rtl::OUString aRotateReference(RTL_CONSTASCII_USTRINGPARAM("RotateReference"));
uno::Any aOldRotateReference = xCellRangeBase->getPropertyValue(aRotateReference);
sal_Int32 aValue = 0;
@@ -99,50 +74,6 @@ void ScCellProperties::testRotateReference()
CPPUNIT_ASSERT_MESSAGE("value has not been changed", aValue == 3);
}
-uno::Reference< beans::XPropertySet > ScCellProperties::init()
-{
- rtl::OUString aFileURL;
- const rtl::OUString aFileBase(RTL_CONSTASCII_USTRINGPARAM("xcellrangesquery.ods"));
- createFileURL(aFileBase, aFileURL);
- if( !xComponent.is())
- xComponent = loadFromDesktop(aFileURL);
- uno::Reference< sheet::XSpreadsheetDocument> xDoc (xComponent, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xDoc.is());
-
- uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
- uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW);
-
- CPPUNIT_ASSERT_MESSAGE("Could not create interface of type XSpreadsheet", xSheet.is());
-
- uno::Reference< table::XCellRange > xCellRange(xSheet->getCellRangeByPosition(0,0,3,4), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xCellRange.is());
-
- uno::Reference< beans::XPropertySet > xReturn(xCellRange, UNO_QUERY_THROW);
-
- CPPUNIT_ASSERT_MESSAGE("Could not create object of type XPropertySet", xReturn.is());
- return xReturn;
-}
-
-void ScCellProperties::setUp()
-{
- nTest += 1;
- UnoApiTest::setUp();
-}
-
-void ScCellProperties::tearDown()
-{
- if (nTest == NUMBER_OF_TESTS)
- {
- uno::Reference< util::XCloseable > xCloseable(xComponent, UNO_QUERY_THROW);
- xCloseable->close( false );
- }
-
- UnoApiTest::tearDown();
-
-}
-
-CPPUNIT_TEST_SUITE_REGISTRATION(ScCellProperties);
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/extras/datapilotfieldobj.cxx b/test/source/sheet/datapilotfield.cxx
index 8ebc424b4f2d..3a323bee9d2a 100644
--- a/sc/qa/extras/datapilotfieldobj.cxx
+++ b/test/source/sheet/datapilotfield.cxx
@@ -26,7 +26,7 @@
* instead of those above.
*/
-#include <test/unoapi_test.hxx>
+#include <test/sheet/datapilotfieldobj.hxx>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp>
@@ -42,32 +42,16 @@
#include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
#include <rtl/oustringostreaminserter.hxx>
+#include "cppunit/extensions/HelperMacros.h"
+#include <iostream>
-namespace ScDataPilotFieldObj {
+using namespace com::sun::star::uno;
-class ScDataPilotField : public UnoApiTest
-{
-
- uno::Reference< beans::XPropertySet > init();
-
- void testSortInfo();
- void testLayoutInfo();
- void testAutoShowInfo();
- void testReference();
- void testIsGroupField();
-
- CPPUNIT_TEST_SUITE(ScDataPilotField);
- CPPUNIT_TEST(testSortInfo);
- CPPUNIT_TEST(testLayoutInfo);
- CPPUNIT_TEST(testAutoShowInfo);
- CPPUNIT_TEST(testReference);
- CPPUNIT_TEST(testIsGroupField);
- CPPUNIT_TEST_SUITE_END();
-};
+namespace apitest {
-void ScDataPilotField::testSortInfo()
+void DataPilotField::testSortInfo()
{
- uno::Reference< beans::XPropertySet> xPropSet = init();
+ uno::Reference< beans::XPropertySet> xPropSet(init(),UNO_QUERY_THROW);
sheet::DataPilotFieldSortInfo aSortInfoValue;
rtl::OUString aSortInfo(RTL_CONSTASCII_USTRINGPARAM("SortInfo"));
aSortInfoValue.Field = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Col1"));
@@ -99,9 +83,9 @@ void ScDataPilotField::testSortInfo()
CPPUNIT_ASSERT_MESSAGE("should have no sort info", !bHasSortInfo);
}
-void ScDataPilotField::testLayoutInfo()
+void DataPilotField::testLayoutInfo()
{
- uno::Reference< beans::XPropertySet > xPropSet = init();
+ uno::Reference< beans::XPropertySet > xPropSet(init(),UNO_QUERY_THROW);
sheet::DataPilotFieldLayoutInfo aLayoutInfoValue;
rtl::OUString aLayoutInfo(RTL_CONSTASCII_USTRINGPARAM("LayoutInfo"));
aLayoutInfoValue.AddEmptyLines = false;
@@ -132,9 +116,9 @@ void ScDataPilotField::testLayoutInfo()
CPPUNIT_ASSERT_MESSAGE("should have no longer sort information", !bHasLayoutInfo);
}
-void ScDataPilotField::testAutoShowInfo()
+void DataPilotField::testAutoShowInfo()
{
- uno::Reference< beans::XPropertySet > xPropSet = init();
+ uno::Reference< beans::XPropertySet > xPropSet(init(),UNO_QUERY_THROW);
sheet::DataPilotFieldAutoShowInfo aAutoShowInfoValue;
aAutoShowInfoValue.DataField = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Col1"));
aAutoShowInfoValue.IsEnabled = true;
@@ -165,9 +149,9 @@ void ScDataPilotField::testAutoShowInfo()
CPPUNIT_ASSERT_MESSAGE("should have no longer AutoShow information", !bHasAutoShowInfo);
}
-void ScDataPilotField::testReference()
+void DataPilotField::testReference()
{
- uno::Reference< beans::XPropertySet > xPropSet = init();
+ uno::Reference< beans::XPropertySet > xPropSet(init(),UNO_QUERY_THROW);
sheet::DataPilotFieldReference aReferenceValue;
aReferenceValue.ReferenceField = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Col1"));
aReferenceValue.ReferenceItemType = sheet::DataPilotFieldReferenceItemType::NAMED;
@@ -198,9 +182,9 @@ void ScDataPilotField::testReference()
CPPUNIT_ASSERT_MESSAGE("should have no longer reference information", !bHasReference);
}
-void ScDataPilotField::testIsGroupField()
+void DataPilotField::testIsGroupField()
{
- uno::Reference< beans::XPropertySet > xPropSet = init();
+ uno::Reference< beans::XPropertySet > xPropSet(init(),UNO_QUERY_THROW);
uno::Any xValue;
rtl::OUString aIsGroupField(RTL_CONSTASCII_USTRINGPARAM("IsGroupField"));
sal_Bool bIsGroupField;
@@ -222,43 +206,6 @@ void ScDataPilotField::testIsGroupField()
std::cout << "Could not test IsGroupField" << std::endl;
}
-uno::Reference< beans::XPropertySet > ScDataPilotField::init()
-{
- rtl::OUString aFileURL;
- const rtl::OUString aFileBase(RTL_CONSTASCII_USTRINGPARAM("scdatapilotfieldobj.ods"));
- createFileURL(aFileBase, aFileURL);
- std::cout << rtl::OUStringToOString(aFileURL, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
- static uno::Reference< lang::XComponent > xComponent;
- if( !xComponent.is())
- xComponent = loadFromDesktop(aFileURL);
- uno::Reference< sheet::XSpreadsheetDocument> xDoc (xComponent, UNO_QUERY_THROW);
- uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
- uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(1), UNO_QUERY_THROW);
-
- CPPUNIT_ASSERT_MESSAGE("Could not create interface of type XSpreadsheet", xSheet.is());
- uno::Reference< sheet::XDataPilotTablesSupplier > xDPTS(xSheet, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xDPTS.is());
- uno::Reference< sheet::XDataPilotTables > xDPT = xDPTS->getDataPilotTables();
- CPPUNIT_ASSERT(xDPT.is());
- uno::Sequence<rtl::OUString> aElementNames = xDPT->getElementNames();
- for (int i = 0; i < aElementNames.getLength(); ++i)
- {
- std::cout << "PivotTable: " << aElementNames[i] << std::endl;
- }
-
- uno::Reference< sheet::XDataPilotDescriptor > xDPDsc(xDPT->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataPilot1"))),UNO_QUERY_THROW);
-
- CPPUNIT_ASSERT(xDPDsc.is());
- uno::Reference< container::XIndexAccess > xIA( xDPDsc->getDataPilotFields(), UNO_QUERY_THROW);
- uno::Reference< beans::XPropertySet > xReturnValue( xIA->getByIndex(0), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xReturnValue.is());
- return xReturnValue;
-}
-
-CPPUNIT_TEST_SUITE_REGISTRATION(ScDataPilotField);
-
-CPPUNIT_PLUGIN_IMPLEMENT();
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/extras/tableautoformatfield.cxx b/test/source/sheet/tableautoformatfield.cxx
index ac0ad8c53692..c846b6a22503 100644
--- a/sc/qa/extras/tableautoformatfield.cxx
+++ b/test/source/sheet/tableautoformatfield.cxx
@@ -13,7 +13,7 @@
* License.
*
* Major Contributor(s):
- * Copyright (C) 2011 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
+ * Copyright (C) 2011 Markus Mohrhard <markus.mohrhard@googlemail.com> (initTestial developer)
*
* All Rights Reserved.
*
@@ -26,41 +26,18 @@
* instead of those above.
*/
-#include <test/unoapi_test.hxx>
-
-#include <com/sun/star/beans/XPropertySet.hpp>
+#include <test/sheet/tableautoformatfield.hxx>
#include <iostream>
+#include "cppunit/extensions/HelperMacros.h"
-namespace ScAutoFormatFieldObj {
-
-#define NUMBER_OF_TESTS 2
-
-class ScTableAutoFormatField : public UnoApiTest
-{
-public:
-
- virtual void setUp();
- virtual void tearDown();
-
- uno::Reference< beans::XPropertySet > init(); void testRotateReference();
- void testVertJustify();
-
- CPPUNIT_TEST_SUITE(ScTableAutoFormatField);
- CPPUNIT_TEST(testRotateReference);
- CPPUNIT_TEST(testVertJustify);
- CPPUNIT_TEST_SUITE_END();
-
-private:
-
- static int nTest;
-};
+using namespace com::sun::star::uno;
-int ScTableAutoFormatField::nTest = 0;
+namespace apitest {
-uno::Reference< beans::XPropertySet > ScTableAutoFormatField::init()
+uno::Reference< beans::XPropertySet > TableAutoFormatField::initTest()
{
- uno::Reference< container::XIndexAccess > xAutoFormatFields( m_xSFactory->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.TableAutoFormats"))), UNO_QUERY_THROW );
+ uno::Reference< container::XIndexAccess > xAutoFormatFields( getServiceFactory()->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.TableAutoFormats"))), UNO_QUERY_THROW );
CPPUNIT_ASSERT(xAutoFormatFields.is());
uno::Reference< container::XIndexAccess > xIndex( xAutoFormatFields->getByIndex(0), UNO_QUERY_THROW );
CPPUNIT_ASSERT(xIndex.is());
@@ -69,9 +46,9 @@ uno::Reference< beans::XPropertySet > ScTableAutoFormatField::init()
return xReturn;
}
-void ScTableAutoFormatField::testRotateReference()
+void TableAutoFormatField::testRotateReference()
{
- uno::Reference< beans::XPropertySet > xTableAutoFormatField = init();
+ uno::Reference< beans::XPropertySet > xTableAutoFormatField = initTest();
rtl::OUString aRotateReference(RTL_CONSTASCII_USTRINGPARAM("RotateReference"));
uno::Any aOldRotateReference = xTableAutoFormatField->getPropertyValue(aRotateReference);
sal_Int32 aValue = 0;
@@ -87,9 +64,9 @@ void ScTableAutoFormatField::testRotateReference()
CPPUNIT_ASSERT_MESSAGE("value has not been changed", aValue == 3);
}
-void ScTableAutoFormatField::testVertJustify()
+void TableAutoFormatField::testVertJustify()
{
- uno::Reference< beans::XPropertySet > xTableAutoFormatField = init();
+ uno::Reference< beans::XPropertySet > xTableAutoFormatField = initTest();
rtl::OUString aVertJustify(RTL_CONSTASCII_USTRINGPARAM("VertJustify"));
uno::Any aOldVertJustify = xTableAutoFormatField->getPropertyValue(aVertJustify);
sal_Int32 aValue = 0;
@@ -105,27 +82,6 @@ void ScTableAutoFormatField::testVertJustify()
CPPUNIT_ASSERT_MESSAGE("value has not been changed", aValue == 3);
}
-void ScTableAutoFormatField::setUp()
-{
- nTest += 1;
- UnoApiTest::setUp();
-}
-
-void ScTableAutoFormatField::tearDown()
-{
- UnoApiTest::tearDown();
-
- if (nTest == NUMBER_OF_TESTS)
- {
- mxDesktop->terminate();
- uno::Reference< lang::XComponent>(m_xContext, UNO_QUERY_THROW)->dispose();
- }
-}
-
-CPPUNIT_TEST_SUITE_REGISTRATION(ScTableAutoFormatField);
-
-CPPUNIT_PLUGIN_IMPLEMENT();
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/extras/xcellrangesquery.cxx b/test/source/sheet/xcellrangesquery.cxx
index a5a5a6fb926c..b1f55e05d3f4 100644
--- a/sc/qa/extras/xcellrangesquery.cxx
+++ b/test/source/sheet/xcellrangesquery.cxx
@@ -26,171 +26,91 @@
* instead of those above.
*/
-#include <test/unoapi_test.hxx>
+#include <test/sheet/xcellrangesquery.hxx>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/sheet/XCellRangesQuery.hpp>
#include <com/sun/star/sheet/XSheetCellRanges.hpp>
#include <com/sun/star/table/CellAddress.hpp>
#include <com/sun/star/sheet/CellFlags.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-using namespace com::sun::star;
-
-
-namespace ScCellRangeBase {
-
-#define NUMBER_OF_TESTS 5
-
-class ScXCellRangesQuery : public UnoApiTest
-{
-public:
-
- virtual void setUp();
- virtual void tearDown();
-
- //Testcases
- void testQueryColumnDifference();
- void testQueryContentDifference();
- void testQueryEmptyCells();
- void testQueryFormulaCells();
- void testQueryIntersection();
- void testQueryRowDifference();
- void testQueryVisibleCells();
-
- CPPUNIT_TEST_SUITE(ScXCellRangesQuery);
- CPPUNIT_TEST(testQueryColumnDifference);
- CPPUNIT_TEST(testQueryContentDifference);
- CPPUNIT_TEST(testQueryEmptyCells);
- //looks broken
- //CPPUNIT_TEST(testQueryFormulaCells);
- CPPUNIT_TEST(testQueryIntersection);
- CPPUNIT_TEST(testQueryRowDifference);
- CPPUNIT_TEST_SUITE_END();
-
-private:
- uno::Reference<sheet::XCellRangesQuery> init();
-
- static int nTest;
- static uno::Reference< lang::XComponent > xComponent;
-};
-
-int ScXCellRangesQuery::nTest = 0;
-uno::Reference< lang::XComponent > ScXCellRangesQuery::xComponent;
-
-uno::Reference<sheet::XCellRangesQuery> ScXCellRangesQuery::init()
-{
- rtl::OUString aFileURL;
- const rtl::OUString aFileBase(RTL_CONSTASCII_USTRINGPARAM("xcellrangesquery.ods"));
- createFileURL(aFileBase, aFileURL);
- std::cout << rtl::OUStringToOString(aFileURL, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
- if( !xComponent.is())
- xComponent = loadFromDesktop(aFileURL);
- uno::Reference< sheet::XSpreadsheetDocument> xDoc (xComponent, UNO_QUERY_THROW);
- uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
- uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW);
+#include "cppunit/extensions/HelperMacros.h"
- CPPUNIT_ASSERT_MESSAGE("Could not create interface of type XSpreadsheet", xSheet.is());
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
- uno::Reference<sheet::XCellRangesQuery> xReturn(xSheet->getCellRangeByPosition(0,0,3,4), UNO_QUERY_THROW);
- CPPUNIT_ASSERT_MESSAGE("Could not create object of type XCellRangesQuery", xReturn.is());
- return xReturn;
-}
+namespace apitest {
-void ScXCellRangesQuery::testQueryColumnDifference()
+void XCellRangesQuery::testQueryColumnDifference()
{
rtl::OUString aExpected(RTL_CONSTASCII_USTRINGPARAM("Sheet1.B1:C1,Sheet1.B3:C5"));
- uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery = init();
+ uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryColumnDifferences(table::CellAddress(0, 1, 1));
rtl::OUString aResult = xRanges->getRangeAddressesAsString();
std::cout << "testQueryColumnDifference: Result: " << rtl::OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
CPPUNIT_ASSERT_MESSAGE("testQueryColumnDifference", aResult == aExpected);
}
-void ScXCellRangesQuery::testQueryContentDifference()
+void XCellRangesQuery::testQueryContentDifference()
{
rtl::OUString aExpected(RTL_CONSTASCII_USTRINGPARAM("Sheet1.B2:B3"));
- uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery = init();
+ uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryContentCells(sheet::CellFlags::VALUE);
rtl::OUString aResult = xRanges->getRangeAddressesAsString();
std::cout << "testQueryContentDifference: Result: " << rtl::OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
CPPUNIT_ASSERT_MESSAGE("testQueryContentDifference", aResult == aExpected);
}
-void ScXCellRangesQuery::testQueryEmptyCells()
+void XCellRangesQuery::testQueryEmptyCells()
{
rtl::OUString aExpected(RTL_CONSTASCII_USTRINGPARAM("Sheet1.A1:A5,Sheet1.B1:C1,Sheet1.B5,Sheet1.C3:C5,Sheet1.D1:D5"));
- uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery = init();
+ uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryEmptyCells();
rtl::OUString aResult = xRanges->getRangeAddressesAsString();
std::cout << "testQueryEmptyCells: Result: " << rtl::OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
CPPUNIT_ASSERT_MESSAGE("testQueryEmptyCells", aResult == aExpected);
}
-void ScXCellRangesQuery::testQueryFormulaCells()
+void XCellRangesQuery::testQueryFormulaCells()
{
rtl::OUString aExpected(RTL_CONSTASCII_USTRINGPARAM("Sheet1.C2"));
- uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery = init();
+ uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryFormulaCells(sheet::CellFlags::FORMULA);
rtl::OUString aResult = xRanges->getRangeAddressesAsString();
std::cout << "testQueryFormulaCells: Result: " << rtl::OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
CPPUNIT_ASSERT_MESSAGE("testQueryFormulaCells", aResult == aExpected);
}
-void ScXCellRangesQuery::testQueryIntersection()
+void XCellRangesQuery::testQueryIntersection()
{
rtl::OUString aExpected(RTL_CONSTASCII_USTRINGPARAM("Sheet1.D4:D5"));
- uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery = init();
+ uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryIntersection(table::CellRangeAddress(0,3,3,7,7));
rtl::OUString aResult = xRanges->getRangeAddressesAsString();
std::cout << "testQueryIntersection: Result: " << rtl::OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
CPPUNIT_ASSERT_MESSAGE("testQueryFormulaCells", aResult == aExpected);
}
-void ScXCellRangesQuery::testQueryRowDifference()
+void XCellRangesQuery::testQueryRowDifference()
{
rtl::OUString aExpected(RTL_CONSTASCII_USTRINGPARAM("Sheet1.A2:A4,Sheet1.C2:D4"));
- uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery = init();
+ uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryRowDifferences(table::CellAddress(0,1,1));
rtl::OUString aResult = xRanges->getRangeAddressesAsString();
std::cout << "testQueryRowDifference: Result: " << rtl::OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
CPPUNIT_ASSERT_MESSAGE("testQueryFormulaCells", aResult == aExpected);
}
-void ScXCellRangesQuery::testQueryVisibleCells()
+void XCellRangesQuery::testQueryVisibleCells()
{
- rtl::OUString aExpected(RTL_CONSTASCII_USTRINGPARAM("Sheet1.A2"));
- uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery = init();
+ rtl::OUString aExpected(RTL_CONSTASCII_USTRINGPARAM("Sheet1.A1:D5"));
+ uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryVisibleCells();
rtl::OUString aResult = xRanges->getRangeAddressesAsString();
std::cout << "testQueryVisibleCells: Result: " << rtl::OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
CPPUNIT_ASSERT_MESSAGE("testQueryFormulaCells", aResult == aExpected);
}
-void ScXCellRangesQuery::setUp()
-{
- nTest += 1;
- UnoApiTest::setUp();
-}
-
-void ScXCellRangesQuery::tearDown()
-{
- if (nTest == NUMBER_OF_TESTS)
- {
- uno::Reference< util::XCloseable > xCloseable(xComponent, UNO_QUERY_THROW);
- xCloseable->close( false );
- }
-
- UnoApiTest::tearDown();
-
-}
-
-CPPUNIT_TEST_SUITE_REGISTRATION(ScXCellRangesQuery);
-
-CPPUNIT_PLUGIN_IMPLEMENT();
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/extras/xdatabaserange.cxx b/test/source/sheet/xdatabaserange.cxx
index 22a2680c9805..d8cf5e4a1929 100644
--- a/sc/qa/extras/xdatabaserange.cxx
+++ b/test/source/sheet/xdatabaserange.cxx
@@ -26,7 +26,8 @@
* instead of those above.
*/
-#include <test/unoapi_test.hxx>
+#include <test/sheet/xdatabaserange.hxx>
+
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/sheet/XSubTotalDescriptor.hpp>
@@ -36,42 +37,21 @@
#include <com/sun/star/table/CellRangeAddress.hpp>
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <rtl/oustringostreaminserter.hxx>
-
-namespace ScDatabaseRangeObj {
-
-#define NUMBER_OF_TESTS 3
-
-class ScXDatabaseRange : public UnoApiTest
-{
- virtual void setUp();
- virtual void tearDown();
-
- void testDataArea();
- void testGetSortDescriptor();
- void testGetSubtotalDescriptor();
- CPPUNIT_TEST_SUITE(ScXDatabaseRange);
- CPPUNIT_TEST(testDataArea);
- CPPUNIT_TEST(testGetSortDescriptor);
- CPPUNIT_TEST(testGetSubtotalDescriptor);
- CPPUNIT_TEST_SUITE_END();
-private:
- uno::Reference< sheet::XDatabaseRange > init(const rtl::OUString& rName);
+#include <rtl/oustringostreaminserter.hxx>
+#include "cppunit/extensions/HelperMacros.h"
+#include <iostream>
- static int nTest;
- static uno::Reference< lang::XComponent > xComponent;
-};
+using namespace com::sun::star::uno;
-int ScXDatabaseRange::nTest = 0;
-uno::Reference< lang::XComponent > ScXDatabaseRange::xComponent;
+namespace apitest {
/**
* tests setDataArea and getDataArea
*/
-void ScXDatabaseRange::testDataArea()
+void XDatabaseRange::testDataArea()
{
- uno::Reference< sheet::XDatabaseRange > xDBRange = init(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataArea")));
+ uno::Reference< sheet::XDatabaseRange > xDBRange(init(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataArea"))), UNO_QUERY_THROW);
table::CellRangeAddress aCellAddress;
aCellAddress.Sheet = 0;
@@ -89,16 +69,16 @@ void ScXDatabaseRange::testDataArea()
CPPUNIT_ASSERT( aCellAddress.EndColumn == aValue.EndColumn );
}
-void ScXDatabaseRange::testGetSubtotalDescriptor()
+void XDatabaseRange::testGetSubtotalDescriptor()
{
- uno::Reference< sheet::XDatabaseRange > xDBRange = init(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SubtotalDescriptor")));
+ uno::Reference< sheet::XDatabaseRange > xDBRange(init(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SubtotalDescriptor"))), UNO_QUERY_THROW);
uno::Reference< sheet::XSubTotalDescriptor> xSubtotalDescr = xDBRange->getSubTotalDescriptor();
CPPUNIT_ASSERT(xSubtotalDescr.is());
}
-void ScXDatabaseRange::testGetSortDescriptor()
+void XDatabaseRange::testGetSortDescriptor()
{
- uno::Reference< sheet::XDatabaseRange > xDBRange = init(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SortDescriptor")));
+ uno::Reference< sheet::XDatabaseRange > xDBRange(init(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SortDescriptor"))), UNO_QUERY_THROW);
uno::Sequence< beans::PropertyValue > xSortDescr = xDBRange->getSortDescriptor();
for (sal_Int32 i = 0; i < xSortDescr.getLength(); ++i)
{
@@ -160,50 +140,6 @@ void ScXDatabaseRange::testGetSortDescriptor()
}
}
-uno::Reference< sheet::XDatabaseRange > ScXDatabaseRange::init(const rtl::OUString& rName)
-{
- rtl::OUString aFileURL;
- const rtl::OUString aFileBase(RTL_CONSTASCII_USTRINGPARAM("xdatabaserange.ods"));
- createFileURL(aFileBase, aFileURL);
- std::cout << rtl::OUStringToOString(aFileURL, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
- if( !xComponent.is())
- xComponent = loadFromDesktop(aFileURL);
- uno::Reference< sheet::XSpreadsheetDocument> xDoc (xComponent, UNO_QUERY_THROW);
- uno::Reference< beans::XPropertySet > xPropSet(xDoc,UNO_QUERY_THROW);
- uno::Reference< sheet::XDatabaseRanges > xDBRanges( xPropSet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DatabaseRanges"))), UNO_QUERY_THROW );
- uno::Reference< container::XNameAccess > xName( xDBRanges, UNO_QUERY_THROW);
- uno::Reference< sheet::XDatabaseRange > xDBRange( xName->getByName(rName), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xDBRange.is());
- return xDBRange;
-}
-
-void ScXDatabaseRange::setUp()
-{
- nTest += 1;
- UnoApiTest::setUp();
-}
-
-void ScXDatabaseRange::tearDown()
-{
- if (nTest == NUMBER_OF_TESTS)
- {
- uno::Reference< util::XCloseable > xCloseable(xComponent, UNO_QUERY_THROW);
- xCloseable->close( false );
- }
-
- UnoApiTest::tearDown();
-
- if (nTest == NUMBER_OF_TESTS)
- {
- mxDesktop->terminate();
- uno::Reference< lang::XComponent>(m_xContext, UNO_QUERY_THROW)->dispose();
- }
-}
-
-CPPUNIT_TEST_SUITE_REGISTRATION(ScXDatabaseRange);
-
-CPPUNIT_PLUGIN_IMPLEMENT();
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/extras/xdatapilotdescriptor.cxx b/test/source/sheet/xdatapilotdescriptor.cxx
index e58c1453b2b5..aa39416d0be6 100644
--- a/sc/qa/extras/xdatapilotdescriptor.cxx
+++ b/test/source/sheet/xdatapilotdescriptor.cxx
@@ -26,82 +26,33 @@
* instead of those above.
*/
-#include <test/unoapi_test.hxx>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
-#include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp>
-#include <com/sun/star/sheet/XDataPilotTables.hpp>
+#include "test/sheet/xdatapilotdescriptor.hxx"
+
#include <com/sun/star/sheet/XDataPilotDescriptor.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include "cppunit/extensions/HelperMacros.h"
+
#include <rtl/oustringostreaminserter.hxx>
-#include <vector>
-namespace ScDataPilotDescriptorBase
-{
+using namespace com::sun::star::uno;
-#define NUMBER_OF_TESTS 9
+namespace apitest {
-class ScXDataPilotDescriptor : public UnoApiTest
-{
-public:
-
- virtual void setUp();
- virtual void tearDown();
-
- void testSourceRange();
- void testTag();
- void testGetFilterDescriptor();
- void testGetDataPilotFields();
- void testGetColumnFields();
- void testGetRowFields();
- void testGetPageFields();
- void testGetDataFields();
- void testGetHiddenFields();
- CPPUNIT_TEST_SUITE(ScXDataPilotDescriptor);
- CPPUNIT_TEST(testSourceRange);
- CPPUNIT_TEST(testTag);
- CPPUNIT_TEST(testGetFilterDescriptor);
- CPPUNIT_TEST(testGetDataPilotFields);
- CPPUNIT_TEST(testGetColumnFields);
- CPPUNIT_TEST(testGetRowFields);
- CPPUNIT_TEST(testGetPageFields);
- CPPUNIT_TEST(testGetDataFields);
- CPPUNIT_TEST(testGetHiddenFields);
- CPPUNIT_TEST_SUITE_END();
-
-
-private:
-
- uno::Reference< sheet::XDataPilotDescriptor > init();
-
- void testGetDataPilotFields_Impl( uno::Reference< sheet::XDataPilotDescriptor > xDescr );
-
- void checkName( uno::Reference< container::XIndexAccess > xIndex, sal_Int32 nIndex );
- static std::vector<rtl::OUString> maFieldNames;
- static int nTest;
- static uno::Reference< lang::XComponent > xComponent;
-};
-
-std::vector< rtl::OUString > ScXDataPilotDescriptor::maFieldNames;
-int ScXDataPilotDescriptor::nTest = 0;
-uno::Reference< lang::XComponent > ScXDataPilotDescriptor::xComponent;
-
-void ScXDataPilotDescriptor::testTag()
+void XDataPilotDescriptor::testTag()
{
rtl::OUString aTag(RTL_CONSTASCII_USTRINGPARAM("DataPilotDescriptor_Tag"));
- uno::Reference< sheet::XDataPilotDescriptor > xDescr = init();
+ uno::Reference< sheet::XDataPilotDescriptor > xDescr(init(), UNO_QUERY_THROW);
xDescr->setTag(aTag);
rtl::OUString aNewTag = xDescr->getTag();
CPPUNIT_ASSERT( aTag == aNewTag );
}
-void ScXDataPilotDescriptor::testSourceRange()
+void XDataPilotDescriptor::testSourceRange()
{
- uno::Reference< sheet::XDataPilotDescriptor > xDescr = init();
+ uno::Reference< sheet::XDataPilotDescriptor > xDescr(init(), UNO_QUERY_THROW);
table::CellRangeAddress aOldAddress = xDescr->getSourceRange();
table::CellRangeAddress aAddress;
@@ -125,15 +76,22 @@ void ScXDataPilotDescriptor::testSourceRange()
xDescr->setSourceRange(aOldAddress);
}
-void ScXDataPilotDescriptor::testGetFilterDescriptor()
+void XDataPilotDescriptor::testGetFilterDescriptor()
{
- uno::Reference< sheet::XDataPilotDescriptor > xDescr = init();
+ uno::Reference< sheet::XDataPilotDescriptor > xDescr(init(), UNO_QUERY_THROW);
uno::Reference< sheet::XSheetFilterDescriptor > xSheetFilterDescr = xDescr->getFilterDescriptor();
CPPUNIT_ASSERT(xSheetFilterDescr.is());
}
-void ScXDataPilotDescriptor::testGetDataPilotFields_Impl( uno::Reference< sheet::XDataPilotDescriptor > xDescr)
+void XDataPilotDescriptor::testGetDataPilotFields_Impl( uno::Reference< sheet::XDataPilotDescriptor > xDescr)
{
+ //this method should only be called once but needs to be called before any of the other tests
+ static bool bCalled = false;
+ if (bCalled)
+ return;
+ else
+ bCalled = true;
+
uno::Reference< container::XIndexAccess > xIndex(xDescr->getDataPilotFields(), UNO_QUERY_THROW);
CPPUNIT_ASSERT( xIndex.is());
@@ -194,80 +152,59 @@ void ScXDataPilotDescriptor::testGetDataPilotFields_Impl( uno::Reference< sheet:
}
}
-void ScXDataPilotDescriptor::testGetDataPilotFields()
+void XDataPilotDescriptor::testGetDataPilotFields()
{
- uno::Reference< sheet::XDataPilotDescriptor > xDescr = init();
+ uno::Reference< sheet::XDataPilotDescriptor > xDescr(init(), UNO_QUERY_THROW);
testGetDataPilotFields_Impl( xDescr );
}
-void ScXDataPilotDescriptor::testGetColumnFields()
+void XDataPilotDescriptor::testGetColumnFields()
{
- uno::Reference< sheet::XDataPilotDescriptor > xDescr = init();
+ uno::Reference< sheet::XDataPilotDescriptor > xDescr(init(),UNO_QUERY_THROW);
+ testGetDataPilotFields_Impl( xDescr );
uno::Reference< container::XIndexAccess > xIndex(xDescr->getColumnFields(), UNO_QUERY_THROW);
checkName( xIndex, 0 );
}
-void ScXDataPilotDescriptor::testGetRowFields()
+void XDataPilotDescriptor::testGetRowFields()
{
- uno::Reference< sheet::XDataPilotDescriptor > xDescr = init();
+ uno::Reference< sheet::XDataPilotDescriptor > xDescr(init(),UNO_QUERY_THROW);
+ testGetDataPilotFields_Impl( xDescr );
uno::Reference< container::XIndexAccess > xIndex(xDescr->getRowFields(), UNO_QUERY_THROW);
//checkName( xIndex, 1 );
}
-void ScXDataPilotDescriptor::testGetPageFields()
+void XDataPilotDescriptor::testGetPageFields()
{
- uno::Reference< sheet::XDataPilotDescriptor > xDescr = init();
+ uno::Reference< sheet::XDataPilotDescriptor > xDescr(init(), UNO_QUERY_THROW);
+ testGetDataPilotFields_Impl( xDescr );
uno::Reference< container::XIndexAccess > xIndex(xDescr->getPageFields(), UNO_QUERY_THROW);
checkName( xIndex, 4 );
}
-void ScXDataPilotDescriptor::testGetDataFields()
+void XDataPilotDescriptor::testGetDataFields()
{
- uno::Reference< sheet::XDataPilotDescriptor > xDescr = init();
+ uno::Reference< sheet::XDataPilotDescriptor > xDescr(init(),UNO_QUERY_THROW);
+ testGetDataPilotFields_Impl( xDescr );
uno::Reference< container::XIndexAccess > xIndex(xDescr->getDataFields(), UNO_QUERY_THROW);
checkName( xIndex, 2 );
}
-void ScXDataPilotDescriptor::testGetHiddenFields()
+void XDataPilotDescriptor::testGetHiddenFields()
{
- uno::Reference< sheet::XDataPilotDescriptor > xDescr = init();
+ std::cout << "testGetHiddenFields" <<std::endl;
+ uno::Reference< sheet::XDataPilotDescriptor > xDescr(init(),UNO_QUERY_THROW);;
+ testGetDataPilotFields_Impl( xDescr );
uno::Reference< container::XIndexAccess > xIndex(xDescr->getHiddenFields(), UNO_QUERY_THROW);
checkName( xIndex, 3 );
}
-uno::Reference< sheet::XDataPilotDescriptor> ScXDataPilotDescriptor::init()
-{
- rtl::OUString aFileURL;
- const rtl::OUString aFileBase(RTL_CONSTASCII_USTRINGPARAM("ScDataPilotTableObj.ods"));
- createFileURL(aFileBase, aFileURL);
- std::cout << rtl::OUStringToOString(aFileURL, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
- if( !xComponent.is())
- xComponent = loadFromDesktop(aFileURL);
- uno::Reference< sheet::XSpreadsheetDocument> xDoc (xComponent, UNO_QUERY_THROW);
- uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
- uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW);
-
- CPPUNIT_ASSERT_MESSAGE("Could not create interface of type XSpreadsheet", xSheet.is());
- uno::Reference< sheet::XDataPilotTablesSupplier > xDPTS(xSheet, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xDPTS.is());
- uno::Reference< sheet::XDataPilotTables > xDPT = xDPTS->getDataPilotTables();
- CPPUNIT_ASSERT(xDPT.is());
- uno::Sequence<rtl::OUString> aElementNames = xDPT->getElementNames();
-
- uno::Reference< sheet::XDataPilotDescriptor > xDPDsc(xDPT->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataPilotTable"))),UNO_QUERY_THROW);
-
- testGetDataPilotFields_Impl( xDPDsc );
-
- CPPUNIT_ASSERT(xDPDsc.is());
- return xDPDsc;
-}
-
-void ScXDataPilotDescriptor::checkName( uno::Reference< container::XIndexAccess > xIndex, sal_Int32 nIndex )
+void XDataPilotDescriptor::checkName( uno::Reference< container::XIndexAccess > xIndex, sal_Int32 nIndex )
{
CPPUNIT_ASSERT(xIndex.is());
CPPUNIT_ASSERT(maFieldNames.size() >= static_cast<size_t>(nIndex));
@@ -275,37 +212,11 @@ void ScXDataPilotDescriptor::checkName( uno::Reference< container::XIndexAccess
for (sal_Int32 i = 0; i < xIndex->getCount(); ++i)
{
uno::Reference< container::XNamed > xNamed( xIndex->getByIndex(i), UNO_QUERY_THROW);
+ std::cout << "Expected: " << maFieldNames[nIndex] << " Got: " << xNamed->getName() << std::endl;
CPPUNIT_ASSERT( xNamed->getName() == maFieldNames[nIndex] );
}
}
-void ScXDataPilotDescriptor::setUp()
-{
- nTest += 1;
- UnoApiTest::setUp();
-}
-
-void ScXDataPilotDescriptor::tearDown()
-{
- if (nTest == NUMBER_OF_TESTS)
- {
- uno::Reference< util::XCloseable > xCloseable(xComponent, UNO_QUERY_THROW);
- xCloseable->close( false );
- }
-
- UnoApiTest::tearDown();
-
- if (nTest == NUMBER_OF_TESTS)
- {
- mxDesktop->terminate();
- uno::Reference< lang::XComponent>(m_xContext, UNO_QUERY_THROW)->dispose();
- }
-}
-
-CPPUNIT_TEST_SUITE_REGISTRATION(ScXDataPilotDescriptor);
-
-CPPUNIT_PLUGIN_IMPLEMENT();
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/test/source/sheet/xdatapilotfieldgrouping.cxx b/test/source/sheet/xdatapilotfieldgrouping.cxx
new file mode 100644
index 000000000000..942addc2a25c
--- /dev/null
+++ b/test/source/sheet/xdatapilotfieldgrouping.cxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <test/sheet/xdatapilotfieldgrouping.hxx>
+
+#include <com/sun/star/sheet/XDataPilotFieldGrouping.hpp>
+#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
+
+#include "cppunit/extensions/HelperMacros.h"
+
+using namespace com::sun::star::uno;
+
+namespace apitest {
+
+void XDataPilotFieldGrouping::testCreateNameGroup()
+{
+ uno::Reference< sheet::XDataPilotFieldGrouping > xDataPilotFieldGrouping(init(),UNO_QUERY_THROW);
+ uno::Reference< sheet::XDataPilotField > xDataPilotField( xDataPilotFieldGrouping, UNO_QUERY_THROW );
+ uno::Reference< container::XNameAccess > xNameAccess( xDataPilotField->getItems(), UNO_QUERY_THROW );
+ CPPUNIT_ASSERT(xNameAccess->hasElements());
+
+ uno::Sequence< rtl::OUString > aElements = xNameAccess->getElementNames();
+ xDataPilotFieldGrouping->createNameGroup( aElements );
+}
+
+void XDataPilotFieldGrouping::testCreateDateGroup()
+{
+ uno::Reference< sheet::XDataPilotFieldGrouping > xDataPilotFieldGrouping(init(),UNO_QUERY_THROW);
+ sheet::DataPilotFieldGroupInfo aGroupInfo;
+ aGroupInfo.GroupBy = sheet::DataPilotFieldGroupBy::MONTHS;
+ aGroupInfo.HasDateValues = true;
+ xDataPilotFieldGrouping->createDateGroup(aGroupInfo);
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/test/source/sheet/xdatapilottable.cxx b/test/source/sheet/xdatapilottable.cxx
new file mode 100644
index 000000000000..64bc81364dd2
--- /dev/null
+++ b/test/source/sheet/xdatapilottable.cxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <test/sheet/xdatapilottable.hxx>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp>
+#include <com/sun/star/sheet/XDataPilotTables.hpp>
+#include <com/sun/star/sheet/XDataPilotTable.hpp>
+#include <com/sun/star/table/XCell.hpp>
+#include <com/sun/star/util/XCloseable.hpp>
+#include <com/sun/star/table/CellRangeAddress.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <rtl/oustringostreaminserter.hxx>
+
+using namespace com::sun::star::uno;
+
+namespace apitest
+{
+
+void XDataPilotTable::testGetOutputRange()
+{
+ uno::Reference< sheet::XDataPilotTable > xDPTable(init(),UNO_QUERY_THROW);
+
+ table::CellRangeAddress aRange = xDPTable->getOutputRange();
+ CPPUNIT_ASSERT( aRange.Sheet == 0 );
+ CPPUNIT_ASSERT( aRange.StartColumn == 7 );
+ CPPUNIT_ASSERT( aRange.StartRow == 8 );
+}
+
+void XDataPilotTable::testRefresh()
+{
+ uno::Reference< sheet::XDataPilotTable > xDPTable(init(),UNO_QUERY_THROW);
+ std::cout << "xCellForChange: Old Value: " << xCellForChange->getValue() << std::endl;
+ std::cout << "xCellForCheck: Old Value: " << xCellForCheck->getValue() << std::endl;
+ double aOldData = xCellForCheck->getValue();
+ xCellForChange->setValue( 5 );
+
+ xDPTable->refresh();
+ xDPTable->refresh();
+ std::cout << "xCellForChange: Old Value: " << xCellForChange->getValue() << std::endl;
+ std::cout << "xCellForCheck: Old Value: " << xCellForCheck->getValue() << std::endl;
+ double aNewData = xCellForCheck->getValue();
+ CPPUNIT_ASSERT_MESSAGE("value needs to change", aOldData != aNewData);
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/extras/xnamedrange.cxx b/test/source/sheet/xnamedrange.cxx
index 616c8353b79f..1c910852e4be 100644
--- a/sc/qa/extras/xnamedrange.cxx
+++ b/test/source/sheet/xnamedrange.cxx
@@ -26,7 +26,7 @@
* instead of those above.
*/
-#include <test/unoapi_test.hxx>
+#include <test/sheet/xnamedrange.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
@@ -44,47 +44,26 @@
#include <com/sun/star/sheet/Border.hpp>
#include <com/sun/star/sheet/NamedRangeFlag.hpp>
+#include "cppunit/extensions/HelperMacros.h"
#include <rtl/oustringostreaminserter.hxx>
-namespace ScNamedRangeObj {
+using namespace com::sun::star::uno;
-class ScXNamedRange : public UnoApiTest
-{
- uno::Reference< sheet::XSpreadsheetDocument> init();
- uno::Reference< sheet::XNamedRange> getTestedNamedRange(const rtl::OUString&);
-
- // XNamedRange
- void testGetContent();
- void testSetContent();
- void testGetType();
- void testSetType();
- void testGetReferencePosition();
- void testSetReferencePosition();
-
- CPPUNIT_TEST_SUITE(ScXNamedRange);
- CPPUNIT_TEST(testGetContent);
- CPPUNIT_TEST(testSetContent);
- CPPUNIT_TEST(testGetType);
- CPPUNIT_TEST(testSetType);
- CPPUNIT_TEST(testGetReferencePosition);
- CPPUNIT_TEST(testSetReferencePosition);
- CPPUNIT_TEST_SUITE_END();
-};
-
-
-void ScXNamedRange::testGetContent()
+namespace apitest {
+
+void XNamedRange::testGetContent()
{
rtl::OUString aTestedNamedRangeString(RTL_CONSTASCII_USTRINGPARAM("initial1"));
- uno::Reference< sheet::XNamedRange > xNamedRange = getTestedNamedRange(aTestedNamedRangeString);
+ uno::Reference< sheet::XNamedRange > xNamedRange = getNamedRange(aTestedNamedRangeString);
rtl::OUString aExpectedContent(RTL_CONSTASCII_USTRINGPARAM("$Sheet1.$B$1"));
CPPUNIT_ASSERT_MESSAGE("Wrong expected content for initial1 on GetContent", xNamedRange->getContent().equals(aExpectedContent));
}
-void ScXNamedRange::testSetContent()
+void XNamedRange::testSetContent()
{
rtl::OUString aTestedNamedRangeString(RTL_CONSTASCII_USTRINGPARAM("initial1"));
- uno::Reference< sheet::XNamedRange > xNamedRange = getTestedNamedRange(aTestedNamedRangeString);
+ uno::Reference< sheet::XNamedRange > xNamedRange = getNamedRange(aTestedNamedRangeString);
rtl::OUString aExpectedContent;
@@ -106,17 +85,17 @@ void ScXNamedRange::testSetContent()
}
-void ScXNamedRange::testGetType()
+void XNamedRange::testGetType()
{
rtl::OUString aTestedNamedRangeString(RTL_CONSTASCII_USTRINGPARAM("initial1"));
- uno::Reference< sheet::XNamedRange > xNamedRange = getTestedNamedRange(aTestedNamedRangeString);
+ uno::Reference< sheet::XNamedRange > xNamedRange = getNamedRange(aTestedNamedRangeString);
CPPUNIT_ASSERT_MESSAGE("Wrong expected Type", xNamedRange->getType() == 0);
}
-void ScXNamedRange::testSetType()
+void XNamedRange::testSetType()
{
rtl::OUString aTestedNamedRangeString(RTL_CONSTASCII_USTRINGPARAM("initial1"));
- uno::Reference< sheet::XNamedRange > xNamedRange = getTestedNamedRange(aTestedNamedRangeString);
+ uno::Reference< sheet::XNamedRange > xNamedRange = getNamedRange(aTestedNamedRangeString);
sal_Int32 nType = ::sheet::NamedRangeFlag::ROW_HEADER;;
xNamedRange->setType(nType);
@@ -139,10 +118,10 @@ void ScXNamedRange::testSetType()
CPPUNIT_ASSERT_MESSAGE("Wrong expected Type 0 after setting it", xNamedRange->getType() == nType);
}
-void ScXNamedRange::testGetReferencePosition()
+void XNamedRange::testGetReferencePosition()
{
rtl::OUString aTestedNamedRangeString(RTL_CONSTASCII_USTRINGPARAM("initial2"));
- uno::Reference< sheet::XNamedRange > xNamedRange = getTestedNamedRange(aTestedNamedRangeString);
+ uno::Reference< sheet::XNamedRange > xNamedRange = getNamedRange(aTestedNamedRangeString);
table::CellAddress xCellAddress = xNamedRange->getReferencePosition();
// the expeted address is on B1, as it was the active cell when intial2 created
@@ -151,10 +130,10 @@ void ScXNamedRange::testGetReferencePosition()
CPPUNIT_ASSERT_MESSAGE("Wrong ROW reference position", xCellAddress.Row == 0);
}
-void ScXNamedRange::testSetReferencePosition()
+void XNamedRange::testSetReferencePosition()
{
rtl::OUString aTestedNamedRangeString(RTL_CONSTASCII_USTRINGPARAM("initial1"));
- uno::Reference< sheet::XNamedRange > xNamedRange = getTestedNamedRange(aTestedNamedRangeString);
+ uno::Reference< sheet::XNamedRange > xNamedRange = getNamedRange(aTestedNamedRangeString);
table::CellAddress aBaseAddress = table::CellAddress(1,2,3);
@@ -166,35 +145,7 @@ void ScXNamedRange::testSetReferencePosition()
CPPUNIT_ASSERT_MESSAGE("Wrong ROW reference position after setting it", xCellAddress.Row == 3);
}
-uno::Reference< sheet::XSpreadsheetDocument> ScXNamedRange::init()
-{
- rtl::OUString aFileURL;
- const rtl::OUString aFileBase(RTL_CONSTASCII_USTRINGPARAM("rangenames.ods"));
- createFileURL(aFileBase, aFileURL);
- static uno::Reference< lang::XComponent > xComponent;
- if( !xComponent.is())
- xComponent = loadFromDesktop(aFileURL);
- uno::Reference< sheet::XSpreadsheetDocument> xDoc (xComponent, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xDoc.is());
-
- return xDoc;
-}
-
-uno::Reference< sheet::XNamedRange> ScXNamedRange::getTestedNamedRange(const rtl::OUString& aTestedNamedRangeString)
-{
- uno::Reference< sheet::XSpreadsheetDocument> xDoc = init();
- uno::Reference< beans::XPropertySet > xPropSet (xDoc, UNO_QUERY_THROW);
- rtl::OUString aNamedRangesPropertyString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
- uno::Reference< container::XNameAccess > xNamedRangesNameAccess(xPropSet->getPropertyValue(aNamedRangesPropertyString), UNO_QUERY_THROW);
-
- uno::Reference< sheet::XNamedRange > xNamedRange(xNamedRangesNameAccess->getByName(aTestedNamedRangeString), UNO_QUERY_THROW);
-
- return xNamedRange;
-}
-
-CPPUNIT_TEST_SUITE_REGISTRATION(ScXNamedRange);
-CPPUNIT_PLUGIN_IMPLEMENT();
}
diff --git a/sc/qa/extras/xnamedranges.cxx b/test/source/sheet/xnamedranges.cxx
index 70a599698e57..9f5b3aa07a42 100644
--- a/sc/qa/extras/xnamedranges.cxx
+++ b/test/source/sheet/xnamedranges.cxx
@@ -26,7 +26,7 @@
* instead of those above.
*/
-#include <test/unoapi_test.hxx>
+#include <test/sheet/xnamedranges.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
@@ -38,6 +38,7 @@
#include <com/sun/star/sheet/XNamedRange.hpp>
#include <com/sun/star/table/XCell.hpp>
#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/table/CellAddress.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
@@ -45,39 +46,29 @@
#include <com/sun/star/sheet/NamedRangeFlag.hpp>
#include <rtl/oustringostreaminserter.hxx>
+#include "cppunit/extensions/HelperMacros.h"
+#include <iostream>
-namespace ScNamedRangesObj {
+using namespace com::sun::star::uno;
-class ScXNamedRanges : public UnoApiTest
+namespace apitest {
+
+XNamedRanges::XNamedRanges():
+ maNameToRemove(RTL_CONSTASCII_USTRINGPARAM("initial1"))
{
- uno::Reference< sheet::XSpreadsheetDocument> init();
- // XNamedRanges
- void testAddNewByName();
- void testAddNewFromTitles();
- void testRemoveByName();
- void testOutputList();
+}
- CPPUNIT_TEST_SUITE(ScXNamedRanges);
- CPPUNIT_TEST(testAddNewByName);
- CPPUNIT_TEST(testAddNewFromTitles);
- //fix first warning in ExceptionsTestCaseDecorator
- //CPPUNIT_TEST_EXCEPTION(testRemoveByName, uno::RuntimeException);
- CPPUNIT_TEST(testOutputList);
- CPPUNIT_TEST_SUITE_END();
-};
+XNamedRanges::XNamedRanges(const rtl::OUString& rNameToRemove):
+ maNameToRemove(rNameToRemove)
+{
+}
-void ScXNamedRanges::testAddNewByName()
+void XNamedRanges::testAddNewByName()
{
- uno::Reference< sheet::XSpreadsheetDocument> xDoc = init();
- uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
- uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW);
-
- uno::Reference< beans::XPropertySet > xPropSet (xDoc, UNO_QUERY_THROW);
- rtl::OUString aNamedRangesString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
- uno::Reference< sheet::XNamedRanges > xNamedRanges(xPropSet->getPropertyValue(aNamedRangesString), UNO_QUERY_THROW);
- uno::Reference< container::XNameAccess > xNamedRangesNameAccess(xPropSet->getPropertyValue(aNamedRangesString), UNO_QUERY_THROW);
+ uno::Reference< sheet::XNamedRanges > xNamedRanges(init(), UNO_QUERY_THROW);
+ uno::Reference< container::XNameAccess > xNamedRangesNameAccess(init(1), UNO_QUERY_THROW);
table::CellAddress aBaseAddress = table::CellAddress(0,0,0);
@@ -113,18 +104,11 @@ void ScXNamedRanges::testAddNewByName()
}
-void ScXNamedRanges::testAddNewFromTitles()
+void XNamedRanges::testAddNewFromTitles()
{
-
- uno::Reference< sheet::XSpreadsheetDocument> xDoc = init();
- uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
- uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(1), UNO_QUERY_THROW);
-
- uno::Reference< beans::XPropertySet > xPropSet (xDoc, UNO_QUERY_THROW);
- rtl::OUString aNamedRangesString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
- uno::Reference< sheet::XNamedRanges > xNamedRanges(xPropSet->getPropertyValue(aNamedRangesString), UNO_QUERY_THROW);
- uno::Reference< container::XIndexAccess > xNamedRangesIndex(xPropSet->getPropertyValue(aNamedRangesString), UNO_QUERY_THROW);
- uno::Reference< container::XNameAccess > xNamedRangesNameAccess(xPropSet->getPropertyValue(aNamedRangesString), UNO_QUERY_THROW);
+ uno::Reference< sheet::XNamedRanges > xNamedRanges(init(1), UNO_QUERY_THROW);
+ uno::Reference< container::XIndexAccess > xNamedRangesIndex(xNamedRanges, UNO_QUERY_THROW);
+ uno::Reference< container::XNameAccess > xNamedRangesNameAccess(xNamedRanges, UNO_QUERY_THROW);
table::CellRangeAddress aCellRangeAddress = table::CellRangeAddress(1,0,0,3,3);
@@ -139,7 +123,7 @@ void ScXNamedRanges::testAddNewFromTitles()
xCell = xSheet->getCellByPosition(i,0);
uno::Reference< text::XTextRange > xTextRange(xCell, UNO_QUERY_THROW);
aString = xTextRange->getString();
- std::cout << "verify " << aString << std::endl;
+ std::cout << "addNewFromTitles: verify " << aString << std::endl;
CPPUNIT_ASSERT_MESSAGE("Non existing NamedRange", xNamedRanges->hasByName(aString));
// verify it points on the right cell
@@ -182,45 +166,33 @@ void ScXNamedRanges::testAddNewFromTitles()
}
}
-void ScXNamedRanges::testRemoveByName()
+void XNamedRanges::testRemoveByName()
{
- uno::Reference< sheet::XSpreadsheetDocument> xDoc = init();
- uno::Reference< beans::XPropertySet > xPropSet (xDoc, UNO_QUERY_THROW);
- rtl::OUString aNamedRangesString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
- uno::Reference< sheet::XNamedRanges > xNamedRanges(xPropSet->getPropertyValue(aNamedRangesString), UNO_QUERY_THROW);
- uno::Reference< container::XIndexAccess > xIndex(xPropSet->getPropertyValue(aNamedRangesString), UNO_QUERY_THROW);
-
- rtl::OUString aNr1(RTL_CONSTASCII_USTRINGPARAM("initial1"));
- bool bHasIt = xNamedRanges->hasByName(aNr1);
+ uno::Reference< sheet::XNamedRanges > xNamedRanges(init(), UNO_QUERY_THROW);
+ uno::Reference< container::XIndexAccess > xIndex(xNamedRanges, UNO_QUERY_THROW);
+
+ bool bHasIt = xNamedRanges->hasByName(maNameToRemove);
CPPUNIT_ASSERT_MESSAGE("NamedRange initial1 des not exits, can't remove it", bHasIt);
if (bHasIt)
{
// remove existing
sal_Int32 nInitialCount = xIndex->getCount();
- xNamedRanges->removeByName(aNr1);
+ xNamedRanges->removeByName(maNameToRemove);
sal_Int32 nNewCount = xIndex->getCount();
CPPUNIT_ASSERT_MESSAGE("NamedRange initial1 not removed", nNewCount == nInitialCount - 1);
- CPPUNIT_ASSERT_MESSAGE("Wrong NamedRange removed, initial1 still present", !xNamedRanges->hasByName(aNr1));
+ CPPUNIT_ASSERT_MESSAGE("Wrong NamedRange removed, initial1 still present", !xNamedRanges->hasByName(maNameToRemove));
// try to remove non existing
rtl::OUString aNr2(RTL_CONSTASCII_USTRINGPARAM("dummyNonExistingNamedRange"));
xNamedRanges->removeByName(aNr2);// an exception should be raised here
}
}
-void ScXNamedRanges::testOutputList()
+void XNamedRanges::testOutputList()
{
-
- uno::Reference< sheet::XSpreadsheetDocument> xDoc = init();
- uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
- uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW);
-
table::CellAddress xCellAddress = table::CellAddress (0,2,0);
-
- uno::Reference< beans::XPropertySet > xPropSet (xDoc, UNO_QUERY_THROW);
- rtl::OUString aNamedRangesString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
- uno::Reference< sheet::XNamedRanges > xNamedRanges(xPropSet->getPropertyValue(aNamedRangesString), UNO_QUERY_THROW);
- uno::Reference< container::XIndexAccess > xNamedRangesIndex(xPropSet->getPropertyValue(aNamedRangesString), UNO_QUERY_THROW);
+ uno::Reference< sheet::XNamedRanges > xNamedRanges(init(), UNO_QUERY_THROW);
+ uno::Reference< container::XIndexAccess > xNamedRangesIndex(init(), UNO_QUERY_THROW);
sal_Int32 nElementsCount = xNamedRangesIndex->getCount();
xNamedRanges->outputList(xCellAddress);
@@ -238,22 +210,6 @@ void ScXNamedRanges::testOutputList()
}
}
-uno::Reference< sheet::XSpreadsheetDocument> ScXNamedRanges::init()
-{
- rtl::OUString aFileURL;
- const rtl::OUString aFileBase(RTL_CONSTASCII_USTRINGPARAM("rangenames.ods"));
- createFileURL(aFileBase, aFileURL);
- static uno::Reference< lang::XComponent > xComponent;
- if( !xComponent.is())
- xComponent = loadFromDesktop(aFileURL);
- uno::Reference< sheet::XSpreadsheetDocument> xDoc (xComponent, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xDoc.is());
-
- return xDoc;
-}
-
-CPPUNIT_TEST_SUITE_REGISTRATION(ScXNamedRanges);
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/extras/xspreadsheets2.cxx b/test/source/sheet/xspreadsheets2.cxx
index f694556b0313..263425995a81 100644
--- a/sc/qa/extras/xspreadsheets2.cxx
+++ b/test/source/sheet/xspreadsheets2.cxx
@@ -26,7 +26,7 @@
* instead of those above.
*/
-#include <test/unoapi_test.hxx>
+#include <test/sheet/xspreadsheets2.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
@@ -39,8 +39,7 @@
#include <com/sun/star/sheet/XNamedRange.hpp>
#include <com/sun/star/table/XCell.hpp>
#include <com/sun/star/text/XTextRange.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/table/CellAddress.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
@@ -52,89 +51,20 @@
#include <com/sun/star/table/CellVertJustify.hpp>
#include <rtl/oustringostreaminserter.hxx>
-#include <rtl/string.hxx>
+#include "cppunit/extensions/HelperMacros.h"
+using namespace com::sun::star::uno;
+namespace apitest {
-namespace ScSpreadsheetObj {
-
-#define NUMBER_OF_TESTS 1
-
-class ScXSpreadsheets2 : public UnoApiTest
+XSpreadsheets2::XSpreadsheets2():
+ aSrcSheetName(RTL_CONSTASCII_USTRINGPARAM("SheetToCopy")),
+ aSrcFileName(RTL_CONSTASCII_USTRINGPARAM("rangenamessrc.ods")),
+ aDestFileBase(RTL_CONSTASCII_USTRINGPARAM("rangenames.ods"))
{
-public:
-
- virtual void setUp();
- virtual void tearDown();
-
- // XSpreadsheets2
- void testImportedSheetNameAndIndex();
- void testImportString();
- void testImportValue();
- void testImportFormulaBasicMath();
- void testImportFormulaWithNamedRange();
- void testImportOverExistingNamedRange();
- void testImportNamedRangeDefinedInSource();
- void testImportNamedRangeRedefinedInSource();
- void testImportNewNamedRange();
- void testImportCellStyle();
-
- CPPUNIT_TEST_SUITE(ScXSpreadsheets2);
- CPPUNIT_TEST(testImportedSheetNameAndIndex);
- CPPUNIT_TEST(testImportString);
- CPPUNIT_TEST(testImportValue);
- CPPUNIT_TEST(testImportFormulaBasicMath);
- CPPUNIT_TEST(testImportFormulaWithNamedRange);
- CPPUNIT_TEST(testImportOverExistingNamedRange);
- CPPUNIT_TEST(testImportNamedRangeDefinedInSource);
- CPPUNIT_TEST(testImportNamedRangeRedefinedInSource);
- CPPUNIT_TEST(testImportNewNamedRange);
- CPPUNIT_TEST(testImportCellStyle);
-
- CPPUNIT_TEST_SUITE_END();
-
-private:
- uno::Reference< sheet::XSpreadsheetDocument> getDoc(const rtl::OUString, uno::Reference< lang::XComponent >&);
- uno::Reference< sheet::XNamedRanges> getNamedRanges(uno::Reference< sheet::XSpreadsheetDocument >);
- void importSheetToCopy();
- bool isExternalReference(const rtl::OUString aDestContent, const rtl::OUString aSrcContent );
-
- static int nTest;
- static uno::Reference< lang::XComponent > xComponent;
-
- static bool bIsSheetImported;
- static uno::Reference< sheet::XSpreadsheetDocument> xSrcDoc;
- static uno::Reference< sheet::XSpreadsheetDocument> xDestDoc;
- static uno::Reference< container::XNameAccess > xSrcNamedRangesNameAccess;
- static uno::Reference< container::XNameAccess > xDestNamedRangesNameAccess;
- static uno::Reference< container::XNameAccess > xDestSheetNameAccess;
- static uno::Reference< sheet::XSpreadsheet > xDestSheet;
- static uno::Reference< sheet::XSpreadsheet > xSrcSheet;
- static sal_Int32 nDestPosEffective;
- static rtl::OUString aSrcSheetName;
- static rtl::OUString aSrcFileBase;
- static rtl::OUString aDestFileBase;
- static sal_Int32 nDestPos;
-};
-
-int ScXSpreadsheets2::nTest = 0;
-uno::Reference< lang::XComponent > ScXSpreadsheets2::xComponent;
-
-bool ScXSpreadsheets2::bIsSheetImported = false;
-uno::Reference< sheet::XSpreadsheetDocument> ScXSpreadsheets2::xSrcDoc;
-uno::Reference< sheet::XSpreadsheetDocument> ScXSpreadsheets2::xDestDoc;
-uno::Reference< container::XNameAccess > ScXSpreadsheets2::xSrcNamedRangesNameAccess;
-uno::Reference< container::XNameAccess > ScXSpreadsheets2::xDestNamedRangesNameAccess;
-uno::Reference< container::XNameAccess > ScXSpreadsheets2::xDestSheetNameAccess;
-uno::Reference< sheet::XSpreadsheet > ScXSpreadsheets2::xDestSheet;
-uno::Reference< sheet::XSpreadsheet > ScXSpreadsheets2::xSrcSheet;
-rtl::OUString ScXSpreadsheets2::aSrcSheetName(RTL_CONSTASCII_USTRINGPARAM("SheetToCopy"));
-rtl::OUString ScXSpreadsheets2::aSrcFileBase(RTL_CONSTASCII_USTRINGPARAM("rangenamessrc.ods"));
-rtl::OUString ScXSpreadsheets2::aDestFileBase(RTL_CONSTASCII_USTRINGPARAM("rangenames.ods"));
-sal_Int32 ScXSpreadsheets2::nDestPos = 0;
-sal_Int32 ScXSpreadsheets2::nDestPosEffective = 0;
-
-void ScXSpreadsheets2::testImportedSheetNameAndIndex()
+}
+
+void XSpreadsheets2::testImportedSheetNameAndIndex()
{
/**
Verfiy that the imported sheet has the correct name and is placed at the right requested index
@@ -142,12 +72,12 @@ void ScXSpreadsheets2::testImportedSheetNameAndIndex()
importSheetToCopy();
+ uno::Reference< container::XNameAccess > xDestSheetNameAccess(xDestDoc->getSheets(), UNO_QUERY_THROW);
CPPUNIT_ASSERT_MESSAGE("Wrong sheet name", xDestSheetNameAccess->hasByName(aSrcSheetName));
- CPPUNIT_ASSERT_MESSAGE("Wrong sheet index", nDestPosEffective == nDestPos);
}
-void ScXSpreadsheets2::testImportString()
+void XSpreadsheets2::testImportString()
{
/**
tests the cell A1 containing a string correctly imported
@@ -165,7 +95,7 @@ void ScXSpreadsheets2::testImportString()
CPPUNIT_ASSERT_MESSAGE("Wrong string imported", aDestString.equals(aSrcString));
}
-void ScXSpreadsheets2::testImportValue()
+void XSpreadsheets2::testImportValue()
{
/**
tests the cell B1 containing a value correctly imported
@@ -181,7 +111,7 @@ void ScXSpreadsheets2::testImportValue()
CPPUNIT_ASSERT_MESSAGE("Wrong value imported", aSrcValue == aDestValue);
}
-void ScXSpreadsheets2::testImportFormulaBasicMath()
+void XSpreadsheets2::testImportFormulaBasicMath()
{
/**
tests the cell C1 containing an arithmetic formula correctly imported
@@ -199,7 +129,7 @@ void ScXSpreadsheets2::testImportFormulaBasicMath()
CPPUNIT_ASSERT_MESSAGE("Wrong formula imported", aDestFormula.equals(aSrcFormula));
}
-void ScXSpreadsheets2::testImportFormulaWithNamedRange()
+void XSpreadsheets2::testImportFormulaWithNamedRange()
{
/**
tests the cell D1 containing a formula that uses a NamedRange expression
@@ -215,7 +145,7 @@ void ScXSpreadsheets2::testImportFormulaWithNamedRange()
CPPUNIT_ASSERT_MESSAGE("Wrong Namedrange formula imported", aDestFormula.equals(aSrcFormula));
}
-void ScXSpreadsheets2::testImportOverExistingNamedRange()
+void XSpreadsheets2::testImportOverExistingNamedRange()
{
/**
Both Source and Target file define the named range initial1
@@ -228,6 +158,7 @@ void ScXSpreadsheets2::testImportOverExistingNamedRange()
rtl::OUString aNamedRangeString(RTL_CONSTASCII_USTRINGPARAM("initial1"));
+ uno::Reference< container::XNameAccess > xDestNamedRangesNameAccess(getNamedRanges(xDestDoc), UNO_QUERY_THROW);
uno::Any aNr = xDestNamedRangesNameAccess->getByName(aNamedRangeString);
uno::Reference< sheet::XNamedRange > xDestNamedRange(aNr, UNO_QUERY_THROW);
rtl::OUString aNrDestContent = xDestNamedRange->getContent();
@@ -239,7 +170,7 @@ void ScXSpreadsheets2::testImportOverExistingNamedRange()
}
-void ScXSpreadsheets2::testImportNamedRangeDefinedInSource()
+void XSpreadsheets2::testImportNamedRangeDefinedInSource()
{
/**
in Source file, InSheetRangeName named range is defined in the copied sheet
@@ -250,6 +181,7 @@ void ScXSpreadsheets2::testImportNamedRangeDefinedInSource()
// New range name defined in imported sheet $SheetToCopy.$A$7
rtl::OUString aNewInSheetNamedRangeString(RTL_CONSTASCII_USTRINGPARAM("InSheetRangeName"));
+ uno::Reference< container::XNameAccess > xDestNamedRangesNameAccess(getNamedRanges(xDestDoc), UNO_QUERY_THROW);
CPPUNIT_ASSERT_MESSAGE("InSheetRangeName", xDestNamedRangesNameAccess->hasByName(aNewInSheetNamedRangeString));
uno::Any aNewInSheetNr = xDestNamedRangesNameAccess->getByName(aNewInSheetNamedRangeString);
@@ -262,7 +194,7 @@ void ScXSpreadsheets2::testImportNamedRangeDefinedInSource()
CPPUNIT_ASSERT_MESSAGE("Wrong address for InSheetRangeName", aNewInSheetNrDestContent.equals(aNewInSheetExpectedContent));
}
-void ScXSpreadsheets2::testImportNamedRangeRedefinedInSource()
+void XSpreadsheets2::testImportNamedRangeRedefinedInSource()
{
/**
in Source file, initial2 named range is defined in the copied sheet
@@ -273,6 +205,7 @@ void ScXSpreadsheets2::testImportNamedRangeRedefinedInSource()
// the source file redefines an existing named range in the imported sheet --> the target should not be changed
rtl::OUString aRedefinedInSheetNamedRangeString(RTL_CONSTASCII_USTRINGPARAM("initial2"));
+ uno::Reference< container::XNameAccess > xDestNamedRangesNameAccess(getNamedRanges(xDestDoc), UNO_QUERY_THROW);
CPPUNIT_ASSERT_MESSAGE("aRedefinedInSheetNamedRangeString", xDestNamedRangesNameAccess->hasByName(aRedefinedInSheetNamedRangeString));
uno::Any aRedefinedInSheetNr = xDestNamedRangesNameAccess->getByName(aRedefinedInSheetNamedRangeString);
@@ -283,7 +216,7 @@ void ScXSpreadsheets2::testImportNamedRangeRedefinedInSource()
CPPUNIT_ASSERT_MESSAGE("Wrong address for Redefined InSheet named range", aRedefinedInSheetNrDestContent.equals(aRedefinedInSheetExpectedContent));
}
-void ScXSpreadsheets2::testImportNewNamedRange()
+void XSpreadsheets2::testImportNewNamedRange()
{
/**
in Soucre file, new_rangename range named is defined outside the copied sheet
@@ -294,6 +227,7 @@ void ScXSpreadsheets2::testImportNewNamedRange()
//formula with a non-existant named range in dest - new_rangename
rtl::OUString aNewNamedRangeString(RTL_CONSTASCII_USTRINGPARAM("new_rangename"));
+ uno::Reference< container::XNameAccess > xDestNamedRangesNameAccess(getNamedRanges(xDestDoc), UNO_QUERY_THROW);
CPPUNIT_ASSERT_MESSAGE("New NamedRange not created", xDestNamedRangesNameAccess->hasByName(aNewNamedRangeString));
// verify the content of this new namedrange, pointing on $Sheet1.$B$1 in source. This address is already defined in target as NR content
@@ -309,7 +243,7 @@ void ScXSpreadsheets2::testImportNewNamedRange()
CPPUNIT_ASSERT_MESSAGE("Wrong New NamedRange formula string value", isExternalReference(aNewNrDestContent, aNewExpectedContent));
}
-void ScXSpreadsheets2::testImportCellStyle()
+void XSpreadsheets2::testImportCellStyle()
{
/**
in source file, imported sheet uses a cellstyle that does not exists in target
@@ -352,7 +286,7 @@ void ScXSpreadsheets2::testImportCellStyle()
CPPUNIT_ASSERT_MESSAGE("New style: VertJustify not set", aVertJustify == table::CellVertJustify_CENTER);
}
-uno::Reference< sheet::XSpreadsheetDocument> ScXSpreadsheets2::getDoc(const rtl::OUString aFileBase, uno::Reference< lang::XComponent >& xComp)
+uno::Reference< sheet::XSpreadsheetDocument> XSpreadsheets2::getDoc(const rtl::OUString& aFileBase, uno::Reference< lang::XComponent >& xComp)
{
rtl::OUString aFileURL;
createFileURL(aFileBase, aFileURL);
@@ -367,7 +301,7 @@ uno::Reference< sheet::XSpreadsheetDocument> ScXSpreadsheets2::getDoc(const rtl:
return xDoc;
}
-uno::Reference< sheet::XNamedRanges> ScXSpreadsheets2::getNamedRanges(uno::Reference< sheet::XSpreadsheetDocument> xDoc)
+uno::Reference< sheet::XNamedRanges> XSpreadsheets2::getNamedRanges(uno::Reference< sheet::XSpreadsheetDocument> xDoc)
{
uno::Reference< beans::XPropertySet > xPropSet (xDoc, UNO_QUERY_THROW);
rtl::OUString NamedRangesPropertyString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
@@ -377,71 +311,42 @@ uno::Reference< sheet::XNamedRanges> ScXSpreadsheets2::getNamedRanges(uno::Refer
return xNamedRanges;
}
-void ScXSpreadsheets2::importSheetToCopy()
+void XSpreadsheets2::importSheetToCopy()
{
- if (!bIsSheetImported)
- {
- xSrcDoc = getDoc(aSrcFileBase, xComponent);
- CPPUNIT_ASSERT(xSrcDoc.is());
- xSrcNamedRangesNameAccess = uno::Reference< container::XNameAccess> (getNamedRanges(xSrcDoc), UNO_QUERY_THROW);
+ uno::Reference< container::XNameAccess> xSrcNameAccess(init(),UNO_QUERY_THROW);
+ xSrcSheet = uno::Reference< sheet::XSpreadsheet >( xSrcNameAccess->getByName(aSrcSheetName), UNO_QUERY_THROW);
- uno::Reference< lang::XComponent > xDestComponent;
+ static uno::Reference< lang::XComponent > xDestComponent;
+ if (!xDestComponent.is())
+ {
xDestDoc = getDoc(aDestFileBase, xDestComponent);
CPPUNIT_ASSERT(xDestDoc.is());
- xDestNamedRangesNameAccess = uno::Reference< container::XNameAccess > (getNamedRanges(xDestDoc), UNO_QUERY_THROW);
// import sheet
uno::Reference< sheet::XSpreadsheets2 > xDestSheets (xDestDoc->getSheets(), UNO_QUERY_THROW);
- nDestPosEffective = xDestSheets->importSheet(xSrcDoc, aSrcSheetName, nDestPos);
-
- uno::Reference< container::XNameAccess > xSrcSheetNameAccess (xSrcDoc->getSheets(), UNO_QUERY_THROW);
- xSrcSheet = uno::Reference< sheet::XSpreadsheet > (xSrcSheetNameAccess->getByName(aSrcSheetName), UNO_QUERY_THROW);
-
- xDestSheetNameAccess = uno::Reference< container::XNameAccess > (xDestDoc->getSheets(), UNO_QUERY_THROW);
- xDestSheet = uno::Reference< sheet::XSpreadsheet > ( xDestSheetNameAccess->getByName(aSrcSheetName), UNO_QUERY_THROW);
-
- bIsSheetImported = true;
+ sal_Int32 nDestPos = 0;
+ sal_Int32 nDestPosEffective = xDestSheets->importSheet(xDocument, aSrcSheetName, nDestPos);
+ CPPUNIT_ASSERT_MESSAGE("Wrong sheet index", nDestPosEffective == nDestPos);
+ }
+ else
+ {
+ xDestDoc = uno::Reference< sheet::XSpreadsheetDocument >(xDestComponent,UNO_QUERY_THROW);
}
+
+ uno::Reference< container::XNameAccess > xDestSheetNameAccess (xDestDoc->getSheets(), UNO_QUERY_THROW);
+ xDestSheet = uno::Reference< sheet::XSpreadsheet > ( xDestSheetNameAccess->getByName(aSrcSheetName), UNO_QUERY_THROW);
}
-bool ScXSpreadsheets2::isExternalReference(rtl::OUString aDestContent, rtl::OUString aSrcContent )
+bool XSpreadsheets2::isExternalReference(const rtl::OUString& aDestContent, const rtl::OUString& aSrcContent )
{
rtl::OUString aStart(RTL_CONSTASCII_USTRINGPARAM("'file://"));
const sal_Char* sSrcContent = rtl::OUStringToOString( aSrcContent, RTL_TEXTENCODING_UTF8 ).getStr();
return (aDestContent.endsWithIgnoreAsciiCaseAsciiL(sSrcContent, aSrcContent.getLength()) // same cell address
&& aDestContent.indexOf(aStart)==0 // starts with 'file://
- && aDestContent.indexOf(aSrcFileBase)>0); // contains source file name
-}
-
-void ScXSpreadsheets2::setUp()
-{
- nTest += 1;
- UnoApiTest::setUp();
+ && aDestContent.indexOf(aSrcFileName)>0); // contains source file name
}
-void ScXSpreadsheets2::tearDown()
-{
- //closing the document fails ATM
- if (nTest == NUMBER_OF_TESTS)
- {
- //uno::Reference< util::XCloseable > xCloseable(xComponent, UNO_QUERY_THROW);
- //xCloseable->close( false );
- }
-
- UnoApiTest::tearDown();
-
- if (nTest == NUMBER_OF_TESTS)
- {
- //mxDesktop->terminate();
- //uno::Reference< lang::XComponent>(m_xContext, UNO_QUERY_THROW)->dispose();
- }
-}
-
-CPPUNIT_TEST_SUITE_REGISTRATION(ScXSpreadsheets2);
-
-CPPUNIT_PLUGIN_IMPLEMENT();
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/test/source/unoapi_test.cxx b/test/source/unoapi_test.cxx
index 0a6f4aa4adf0..2d9292a87041 100644
--- a/test/source/unoapi_test.cxx
+++ b/test/source/unoapi_test.cxx
@@ -28,6 +28,8 @@
#include "test/unoapi_test.hxx"
+#include <com/sun/star/util/XCloseable.hpp>
+
UnoApiTest::UnoApiTest()
: m_aBaseString(RTL_CONSTASCII_USTRINGPARAM("/sc/qa/extras/testdocuments"))
{
@@ -64,4 +66,10 @@ void UnoApiTest::createFileURL(const rtl::OUString& aFileBase, rtl::OUString& rF
rFilePath = aBuffer.makeStringAndClear();
}
+void UnoApiTest::closeDocument( uno::Reference< lang::XComponent > xDocument )
+{
+ uno::Reference< util::XCloseable > xCloseable(xDocument, UNO_QUERY_THROW);
+ xCloseable->close(false);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */