summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-04-15 13:31:01 +0200
committerMiklos Vajna <vmiklos@suse.cz>2013-04-15 13:36:56 +0200
commitbb9fce28d6d5f1cabc2af533bfdc7997ffb7184a (patch)
tree407dcc56fd10839594080eeeb17a0500f881e592 /sw
parentd74ba0c4147f33abd9d0c03883cc88f15e160ee5 (diff)
sw: RTF export of TextFrame border/shadow testcase
Change-Id: I85b85afb6d1b170d71633f93d56f7ce4fffdf0a3
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/rtfexport/data/textframe-borders.rtf49
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx21
2 files changed, 70 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfexport/data/textframe-borders.rtf b/sw/qa/extras/rtfexport/data/textframe-borders.rtf
new file mode 100644
index 000000000000..9aa180542410
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/textframe-borders.rtf
@@ -0,0 +1,49 @@
+{\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 fFitShapeToText}
+{\sv 1}
+}
+{\sp
+{\sn fillColor}
+{\sv 9737689}
+}
+{\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}
+}
+{\shptxt aaa
+}
+}
+}
+\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index ba8defd3a117..f9ca432fc376 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -28,6 +28,8 @@
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
+#include <com/sun/star/table/ShadowFormat.hpp>
#include <com/sun/star/text/XFootnotesSupplier.hpp>
#include <com/sun/star/text/XPageCursor.hpp>
#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
@@ -77,6 +79,7 @@ public:
void testI120928();
void testBookmark();
void testHyperlink();
+ void testTextFrameBorders();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -128,6 +131,7 @@ void Test::run()
{"i120928.rtf", &Test::testI120928},
{"bookmark.rtf", &Test::testBookmark},
{"hyperlink.rtf", &Test::testHyperlink},
+ {"textframe-borders.rtf", &Test::testTextFrameBorders},
};
// Don't test the first import of these, for some reason those tests fail
const char* aBlacklist[] = {
@@ -557,6 +561,23 @@ void Test::testHyperlink()
CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(getRun(getParagraph(1), 3, "!"), "HyperLinkURL"));
}
+void Test::testTextFrameBorders()
+{
+ uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0xD99594), getProperty<sal_Int32>(xFrame, "BackColor"));
+
+ table::BorderLine2 aBorder = getProperty<table::BorderLine2>(xFrame, "TopBorder");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0xC0504D), aBorder.Color);
+ CPPUNIT_ASSERT_EQUAL(sal_uInt32(35), aBorder.LineWidth);
+
+ table::ShadowFormat aShadowFormat = getProperty<table::ShadowFormat>(xFrame, "ShadowFormat");
+ CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadowFormat.Location);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(48), aShadowFormat.ShadowWidth);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0x622423), aShadowFormat.Color);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();