Kaydet (Commit) 92da8fc4 authored tarafından Miklos Vajna's avatar Miklos Vajna

sw: add textframe gradient RTF roundtrip testcase

Change-Id: I8e4f6b926123c79ad1a62ddd4c5feebf5fe06cf0
üst d3f7925c
{\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
}
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment