From 92da8fc4ebad92a3667e3534db173ab7232c8048 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 15 Apr 2013 15:49:35 +0200 Subject: sw: add textframe gradient RTF roundtrip testcase Change-Id: I8e4f6b926123c79ad1a62ddd4c5feebf5fe06cf0 --- sw/qa/extras/rtfexport/data/textframe-gradient.rtf | 161 +++++++++++++++++++++ sw/qa/extras/rtfexport/rtfexport.cxx | 25 ++++ 2 files changed, 186 insertions(+) create mode 100644 sw/qa/extras/rtfexport/data/textframe-gradient.rtf (limited to 'sw/qa/extras/rtfexport') diff --git a/sw/qa/extras/rtfexport/data/textframe-gradient.rtf b/sw/qa/extras/rtfexport/data/textframe-gradient.rtf new file mode 100644 index 000000000000..67001da5b98b --- /dev/null +++ b/sw/qa/extras/rtfexport/data/textframe-gradient.rtf @@ -0,0 +1,161 @@ +{\rtf1 +{\shp +{\*\shpinst\shpleft-540\shptop152\shpright9900\shpbottom1592\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplid1026 +{\sp +{\sn shapeType} +{\sv 1} +} +{\sp +{\sn fFlipH} +{\sv 0} +} +{\sp +{\sn fFlipV} +{\sv 0} +} +{\sp +{\sn lTxid} +{\sv 65536} +} +{\sp +{\sn hspNext} +{\sv 1026} +} +{\sp +{\sn fillType} +{\sv 7} +} +{\sp +{\sn fillColor} +{\sv 9737689} +} +{\sp +{\sn fillBackColor} +{\sv 5066944} +} +{\sp +{\sn fillFocus} +{\sv 50} +} +{\sp +{\sn lineColor} +{\sv 5066944} +} +{\sp +{\sn lineWidth} +{\sv 12700} +} +{\sp +{\sn shadowType} +{\sv 2} +} +{\sp +{\sn shadowColor} +{\sv 2303074} +} +{\sp +{\sn shadowOffsetX} +{\sv 12700} +} +{\sp +{\sn shadowSecondOffsetX} +{\sv -38100} +} +{\sp +{\sn fShadow} +{\sv 1} +} +{\sp +{\sn dhgt} +{\sv 251660288} +} +{\sp +{\sn fLayoutInCell} +{\sv 1} +} +{\shptxt foo +\par +} +} +} +\par +{\shp +{\*\shpinst\shpleft5760\shptop90\shpright9840\shpbottom1170\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr2\shpwrk0\shpfblwtxt0\shpz1\shplid1027 +{\sp +{\sn shapeType} +{\sv 202} +} +{\sp +{\sn fFlipH} +{\sv 0} +} +{\sp +{\sn fFlipV} +{\sv 0} +} +{\sp +{\sn lTxid} +{\sv 131072} +} +{\sp +{\sn hspNext} +{\sv 1027} +} +{\sp +{\sn fillType} +{\sv 7} +} +{\sp +{\sn fillColor} +{\sv 6710886} +} +{\sp +{\sn fillBackColor} +{\sv 0} +} +{\sp +{\sn fillFocus} +{\sv 50} +} +{\sp +{\sn lineColor} +{\sv 0} +} +{\sp +{\sn lineWidth} +{\sv 12700} +} +{\sp +{\sn shadowType} +{\sv 2} +} +{\sp +{\sn shadowColor} +{\sv 8355711} +} +{\sp +{\sn shadowOffsetX} +{\sv 12700} +} +{\sp +{\sn shadowSecondOffsetX} +{\sv -38100} +} +{\sp +{\sn fShadow} +{\sv 1} +} +{\sp +{\sn dhgt} +{\sv 251661312} +} +{\sp +{\sn fLayoutInCell} +{\sv 1} +} +{\shptxt bar +\par } +} +} +\par +} diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index f9ca432fc376..a9889b752450 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -25,8 +25,10 @@ * instead of those above. */ +#include #include #include +#include #include #include #include @@ -80,6 +82,7 @@ public: void testBookmark(); void testHyperlink(); void testTextFrameBorders(); + void testTextframeGradient(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -132,6 +135,7 @@ void Test::run() {"bookmark.rtf", &Test::testBookmark}, {"hyperlink.rtf", &Test::testHyperlink}, {"textframe-borders.rtf", &Test::testTextFrameBorders}, + {"textframe-gradient.rtf", &Test::testTextframeGradient}, }; // Don't test the first import of these, for some reason those tests fail const char* aBlacklist[] = { @@ -578,6 +582,27 @@ void Test::testTextFrameBorders() CPPUNIT_ASSERT_EQUAL(sal_Int32(0x622423), aShadowFormat.Color); } +void Test::testTextframeGradient() +{ + uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); + + uno::Reference xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty(xFrame, "FillStyle")); + awt::Gradient aGradient = getProperty(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(xFrame, "FillStyle")); + aGradient = getProperty(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(); -- cgit