diff options
-rwxr-xr-x | sw/qa/extras/ooxmlexport/data/textframe-gradient.docx | bin | 0 -> 10916 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 27 |
2 files changed, 26 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/textframe-gradient.docx b/sw/qa/extras/ooxmlexport/data/textframe-gradient.docx Binary files differnew file mode 100755 index 000000000000..e5ed0689d251 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/textframe-gradient.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 4ff3f984c620..d39489a9b7aa 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -26,6 +26,8 @@ */ #include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/drawing/FillStyle.hpp> +#include <com/sun/star/awt/Gradient.hpp> #include <com/sun/star/style/TabStop.hpp> #include <com/sun/star/view/XViewSettingsSupplier.hpp> #include <com/sun/star/text/XTextFrame.hpp> @@ -71,6 +73,7 @@ public: void test1Table1Page(); void testTextFrames(); void testTextFrameBorders(); + void testTextframeGradient(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -111,7 +114,8 @@ void Test::run() {"n789482.docx", &Test::testN789482}, // {"1-table-1-page.docx", &Test::test1Table1Page}, // doesn't work on openSUSE12.2 at least {"textframes.odt", &Test::testTextFrames}, - {"textframe-borders.docx", &Test::testTextFrameBorders} + {"textframe-borders.docx", &Test::testTextFrameBorders}, + {"textframe-gradient.docx", &Test::testTextframeGradient}, }; // Don't test the first import of these, for some reason those tests fail const char* aBlacklist[] = { @@ -539,6 +543,27 @@ void Test::testTextFrameBorders() CPPUNIT_ASSERT_EQUAL(sal_Int32(0x622423), aShadowFormat.Color); } +void Test::testTextframeGradient() +{ + uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); + + uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame, "FillStyle")); + awt::Gradient aGradient = getProperty<awt::Gradient>(xFrame, "FillGradient"); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0xC0504D), aGradient.StartColor); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0xD99594), aGradient.EndColor); + CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_AXIAL, aGradient.Style); + + xFrame.set(xIndexAccess->getByIndex(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame, "FillStyle")); + aGradient = getProperty<awt::Gradient>(xFrame, "FillGradient"); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0x000000), aGradient.StartColor); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0x666666), aGradient.EndColor); + CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_AXIAL, aGradient.Style); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); |