diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-01-29 15:49:44 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-01-30 13:03:19 +0100 |
commit | 64020cebd676e6ff2b16da5af667b41afa04004d (patch) | |
tree | 29ece24ec0b2600d812fe45c1929eeda6c47b105 /sw/qa | |
parent | 94721b2aec614e0d99504138d484b2ad6cd550c7 (diff) |
sw: add textframe gradient ODF roundtrip testcase
Change-Id: I346de7efd4e91f93e3f07ece1c6fe71d1ca53b8e
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/odfexport/data/textframe-gradient.odt | bin | 0 -> 9800 bytes | |||
-rw-r--r-- | sw/qa/extras/odfexport/odfexport.cxx | 25 |
2 files changed, 25 insertions, 0 deletions
diff --git a/sw/qa/extras/odfexport/data/textframe-gradient.odt b/sw/qa/extras/odfexport/data/textframe-gradient.odt Binary files differnew file mode 100644 index 000000000000..cdcae4fff644 --- /dev/null +++ b/sw/qa/extras/odfexport/data/textframe-gradient.odt diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 92c934c9bf4e..4ed23f1a401f 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -26,12 +26,15 @@ */ #include <swmodeltestbase.hxx> +#include <com/sun/star/awt/Gradient.hpp> +#include <com/sun/star/drawing/FillStyle.hpp> class Test : public SwModelTestBase { public: void testFdo38244(); void testFirstHeaderFooter(); + void testTextframeGradient(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -48,6 +51,7 @@ void Test::run() MethodEntry<Test> aMethods[] = { {"fdo38244.odt", &Test::testFdo38244}, {"first-header-footer.odt", &Test::testFirstHeaderFooter}, + {"textframe-gradient.odt", &Test::testTextframeGradient}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -108,6 +112,27 @@ void Test::testFirstHeaderFooter() CPPUNIT_ASSERT_EQUAL(OUString("Left footer2"), parseDump("/root/page[6]/footer/txt/text()")); } +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(); |