summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJens Carl <j.carl43@gmx.de>2019-01-16 02:22:58 +0000
committerJens Carl <j.carl43@gmx.de>2019-01-16 18:57:49 +0100
commit7b7cc20d83f48a0d114f3e726c9d5710aabc1a4c (patch)
treeb6784b08c656d3f35b60212ec26f452e9b3e29d6 /test
parent86501f577638b44042c35e601d13651992b64fd5 (diff)
Move XStyleLoader2 tests to ScStyleFamiliesObj
Change-Id: Ibba0464d17a9517eb48f3f33b46db2455093ac52 Reviewed-on: https://gerrit.libreoffice.org/66413 Tested-by: Jenkins Reviewed-by: Jens Carl <j.carl43@gmx.de>
Diffstat (limited to 'test')
-rw-r--r--test/Library_subsequenttest.mk2
-rw-r--r--test/source/sheet/xstyleloader.cxx97
-rw-r--r--test/source/style/xstyleloader.cxx93
3 files changed, 94 insertions, 98 deletions
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 8895df3e24a0..081763980f95 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -144,7 +144,6 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/xspreadsheets \
test/source/sheet/xspreadsheets2 \
test/source/sheet/xspreadsheetview \
- test/source/sheet/xstyleloader \
test/source/sheet/xsubtotalcalculatable \
test/source/sheet/xsubtotaldescriptor \
test/source/sheet/xsubtotalfield \
@@ -153,6 +152,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/xviewfreezable \
test/source/sheet/xviewpane \
test/source/sheet/xviewsplitable \
+ test/source/style/xstyleloader \
test/source/table/xcell \
test/source/table/xcellcursor \
test/source/table/xcolumnrowrange \
diff --git a/test/source/sheet/xstyleloader.cxx b/test/source/sheet/xstyleloader.cxx
deleted file mode 100644
index ce019a9e7c5f..000000000000
--- a/test/source/sheet/xstyleloader.cxx
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <test/sheet/xstyleloader.hxx>
-
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-
-#include <com/sun/star/container/XNameContainer.hpp>
-
-#include <com/sun/star/style/XStyleLoader.hpp>
-#include <com/sun/star/style/XStyleLoader2.hpp>
-
-#include <com/sun/star/style/XStyle.hpp>
-
-#include <rtl/ustring.hxx>
-#include <cppunit/extensions/HelperMacros.h>
-
-using namespace css;
-using namespace css::uno;
-
-namespace apitest {
-
-
-void XStyleLoader::testLoadStylesFromURL()
-{
-
- uno::Reference< sheet::XSpreadsheetDocument > xTargetDoc(init(), UNO_QUERY_THROW);
-
- OUString aFileURL = getTestURL();
-
- uno::Reference< style::XStyleFamiliesSupplier > xFamilySupplier (xTargetDoc, UNO_QUERY_THROW);
- uno::Reference< style::XStyleLoader > xTargetStyleLoader (xFamilySupplier->getStyleFamilies(), UNO_QUERY_THROW);
-
- uno::Sequence< beans::PropertyValue > aOptions = xTargetStyleLoader->getStyleLoaderOptions();
-
- xTargetStyleLoader->loadStylesFromURL(aFileURL, aOptions);
-
- checkStyleProperties(xFamilySupplier);
-
-}
-
-void XStyleLoader::testLoadStylesFromDocument()
-{
-
- uno::Reference< sheet::XSpreadsheetDocument > xTargetDoc(init(), UNO_QUERY_THROW);
-
- uno::Reference< lang::XComponent > xSourceDoc (getSourceComponent(), UNO_QUERY_THROW);
-
- uno::Reference< style::XStyleFamiliesSupplier > xFamilySupplier (xTargetDoc, UNO_QUERY_THROW);
- uno::Reference< style::XStyleLoader2 > xTargetStyleLoader (xFamilySupplier->getStyleFamilies(), UNO_QUERY_THROW);
-
- uno::Sequence< beans::PropertyValue > aOptions = xTargetStyleLoader->getStyleLoaderOptions();
-
- xTargetStyleLoader->loadStylesFromDocument(xSourceDoc, aOptions);
-
- checkStyleProperties(xFamilySupplier);
-
-}
-
-void XStyleLoader::checkStyleProperties( uno::Reference< style::XStyleFamiliesSupplier > const & xFamilySupplier)
-{
- // check if targetDocument has myStyle
- uno::Reference< container::XNameAccess > xFamilies(xFamilySupplier->getStyleFamilies(), UNO_QUERY_THROW);
- uno::Reference< container::XNameContainer > xCellStyles(xFamilies->getByName("CellStyles"), UNO_QUERY_THROW);
-
- CPPUNIT_ASSERT_MESSAGE("Style not imported", xCellStyles->hasByName("myStyle"));
-
- // test the backgroundcolor is correctly imported
- uno::Reference< style::XStyle > xMyStyle (xCellStyles->getByName("myStyle"), UNO_QUERY_THROW);
- uno::Reference< beans::XPropertySet > xPropSet (xMyStyle, UNO_QUERY_THROW);
-
- uno::Any aBackColor = xPropSet->getPropertyValue("CellBackColor");
- uno::Any expectedBackColor(sal_Int32(16724787));
-
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong CellBackColor" , expectedBackColor, aBackColor);
-
- // test default pageStyle
-
- uno::Reference< container::XNameContainer > xPageStyles(xFamilies->getByName("PageStyles"), UNO_QUERY_THROW);
- uno::Reference<beans::XPropertySet> xPagePropSet(xPageStyles->getByName("Default"), UNO_QUERY_THROW);
-
- uno::Any aPageBackColor = xPagePropSet->getPropertyValue("BackColor");
- uno::Any expectedPageBackColor(sal_Int32(13434879));
-
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong page style BackColor" , expectedPageBackColor, aPageBackColor);
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/test/source/style/xstyleloader.cxx b/test/source/style/xstyleloader.cxx
new file mode 100644
index 000000000000..5b684eab16a8
--- /dev/null
+++ b/test/source/style/xstyleloader.cxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/style/xstyleloader.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/style/XStyleLoader2.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <rtl/ustring.hxx>
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace css;
+using namespace css::uno;
+
+namespace apitest
+{
+void XStyleLoader::testLoadStylesFromURL()
+{
+ uno::Reference<style::XStyleLoader2> xStyleLoader(init(), uno::UNO_QUERY_THROW);
+
+ uno::Reference<sheet::XSpreadsheetDocument> xDoc(getTargetDoc(), uno::UNO_QUERY_THROW);
+ const OUString aFileURL = getTestURL();
+
+ uno::Sequence<beans::PropertyValue> aOptions = xStyleLoader->getStyleLoaderOptions();
+ xStyleLoader->loadStylesFromURL(aFileURL, aOptions);
+
+ uno::Reference<style::XStyleFamiliesSupplier> xFamilySupplier(xDoc, UNO_QUERY_THROW);
+ checkStyleProperties(xFamilySupplier);
+}
+
+void XStyleLoader::testLoadStylesFromDocument()
+{
+ uno::Reference<style::XStyleLoader2> xStyleLoader(init(), uno::UNO_QUERY_THROW);
+
+ uno::Reference<sheet::XSpreadsheetDocument> xDoc(getTargetDoc(), uno::UNO_QUERY_THROW);
+ uno::Reference<lang::XComponent> xSrcComponent(getSourceComponent(), UNO_QUERY_THROW);
+
+ uno::Sequence<beans::PropertyValue> aOptions = xStyleLoader->getStyleLoaderOptions();
+ xStyleLoader->loadStylesFromDocument(xSrcComponent, aOptions);
+
+ uno::Reference<style::XStyleFamiliesSupplier> xFamilySupplier(xDoc, UNO_QUERY_THROW);
+ checkStyleProperties(xFamilySupplier);
+}
+
+void XStyleLoader::checkStyleProperties(
+ uno::Reference<style::XStyleFamiliesSupplier> const& xFamilySupplier)
+{
+ // check if targetDocument has myStyle
+ uno::Reference<container::XNameAccess> xFamilies(xFamilySupplier->getStyleFamilies(),
+ UNO_QUERY_THROW);
+ uno::Reference<container::XNameContainer> xCellStyles(xFamilies->getByName("CellStyles"),
+ UNO_QUERY_THROW);
+
+ CPPUNIT_ASSERT_MESSAGE("Style not imported", xCellStyles->hasByName("myStyle"));
+
+ // test the backgroundcolor is correctly imported
+ uno::Reference<style::XStyle> xMyStyle(xCellStyles->getByName("myStyle"), UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPropSet(xMyStyle, UNO_QUERY_THROW);
+
+ uno::Any aBackColor = xPropSet->getPropertyValue("CellBackColor");
+ uno::Any expectedBackColor(sal_Int32(16724787));
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong CellBackColor", expectedBackColor, aBackColor);
+
+ // test default pageStyle
+
+ uno::Reference<container::XNameContainer> xPageStyles(xFamilies->getByName("PageStyles"),
+ UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPagePropSet(xPageStyles->getByName("Default"),
+ UNO_QUERY_THROW);
+
+ uno::Any aPageBackColor = xPagePropSet->getPropertyValue("BackColor");
+ uno::Any expectedPageBackColor(sal_Int32(13434879));
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong page style BackColor", expectedPageBackColor,
+ aPageBackColor);
+}
+
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */