diff options
-rw-r--r-- | include/test/sheet/xstyleloader.hxx | 5 | ||||
-rw-r--r-- | sc/qa/extras/testdocuments/ScStyleLoaderObj.ods | bin | 18045 -> 12488 bytes | |||
-rw-r--r-- | test/source/sheet/xstyleloader.cxx | 36 |
3 files changed, 22 insertions, 19 deletions
diff --git a/include/test/sheet/xstyleloader.hxx b/include/test/sheet/xstyleloader.hxx index 7986cb74d9b4..59b1b402dd92 100644 --- a/include/test/sheet/xstyleloader.hxx +++ b/include/test/sheet/xstyleloader.hxx @@ -12,6 +12,8 @@ #include <rtl/ustring.hxx> #include <com/sun/star/style/XStyleLoader2.hpp> +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> + #include <test/testdllapi.hxx> namespace apitest { @@ -30,6 +32,9 @@ public: // XStyleLoader2 void testLoadStylesFromDocument(); +private: + void checkStyleProperties(css::uno::Reference< css::style::XStyleFamiliesSupplier > xFamilySupplier); + protected: ~XStyleLoader() {} diff --git a/sc/qa/extras/testdocuments/ScStyleLoaderObj.ods b/sc/qa/extras/testdocuments/ScStyleLoaderObj.ods Binary files differindex 3cfb3bac62ef..0cc718c98bfe 100644 --- a/sc/qa/extras/testdocuments/ScStyleLoaderObj.ods +++ b/sc/qa/extras/testdocuments/ScStyleLoaderObj.ods diff --git a/test/source/sheet/xstyleloader.cxx b/test/source/sheet/xstyleloader.cxx index 41528b809002..01ed053b712b 100644 --- a/test/source/sheet/xstyleloader.cxx +++ b/test/source/sheet/xstyleloader.cxx @@ -12,7 +12,6 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/sheet/XSpreadsheetDocument.hpp> -#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/style/XStyleLoader.hpp> @@ -20,7 +19,6 @@ #include <com/sun/star/style/XStyle.hpp> - #include <rtl/ustring.hxx> #include "cppunit/extensions/HelperMacros.h" @@ -44,22 +42,7 @@ void XStyleLoader::testLoadStylesFromURL() xTargetStyleLoader->loadStylesFromURL(aFileURL, aOptions); - // 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); - - OUString aCellStyleName("CellBackColor"); - uno::Any aBackColor = xPropSet->getPropertyValue(aCellStyleName); - uno::Any expectedBackColor(sal_Int32(16724787)); - - CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong CellBackColor" , expectedBackColor, aBackColor); + checkStyleProperties(xFamilySupplier); } @@ -77,7 +60,13 @@ void XStyleLoader::testLoadStylesFromDocument() xTargetStyleLoader->loadStylesFromDocument(xSourceDoc, aOptions); - // check if targetDocument has myStyle + checkStyleProperties(xFamilySupplier); + +} + +void XStyleLoader::checkStyleProperties( uno::Reference< style::XStyleFamiliesSupplier > 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); @@ -93,6 +82,15 @@ void XStyleLoader::testLoadStylesFromDocument() 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); } } |