diff options
-rw-r--r-- | sw/qa/extras/rtfexport/data/textframe-gradient.rtf | 161 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport.cxx | 25 |
2 files changed, 186 insertions, 0 deletions
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 <com/sun/star/awt/Gradient.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> +#include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/table/BorderLine2.hpp> #include <com/sun/star/table/ShadowFormat.hpp> @@ -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<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(); |