summaryrefslogtreecommitdiff
path: root/sw/qa/extras
diff options
context:
space:
mode:
authorZolnai Tamás <zolnaitamas2000@gmail.com>2013-09-08 10:46:12 +0200
committerZolnai Tamás <zolnaitamas2000@gmail.com>2013-09-08 11:23:46 +0200
commit05e1439107deacb8416c9aee1b6fb2c72a171eaf (patch)
tree333dc102d1faf5144b859e964b4a534f25e2f508 /sw/qa/extras
parentcfc64c7e895d990023400573d8416ce80cf0da29 (diff)
CharBrd 9.3: RTF filters
-Use sprm:CBrc attribute for all MS filter (for ooxml too). -Extract general code to FormatCharBorder() method, it selects the border side and decides whether add shadow to the border. -RTF export has a color table, which must be filled with border colors before the actual export.temp Change-Id: Ic3ceae6e19ddc2ed5aaa8de85617f9a592289b4f
Diffstat (limited to 'sw/qa/extras')
-rw-r--r--sw/qa/extras/ooxmlexport/data/charborder.odtbin8042 -> 8052 bytes
-rw-r--r--sw/qa/extras/rtfexport/data/charborder.odtbin0 -> 8052 bytes
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx40
3 files changed, 40 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/charborder.odt b/sw/qa/extras/ooxmlexport/data/charborder.odt
index 149abfc6ffe7..67dd89b099e0 100644
--- a/sw/qa/extras/ooxmlexport/data/charborder.odt
+++ b/sw/qa/extras/ooxmlexport/data/charborder.odt
Binary files differ
diff --git a/sw/qa/extras/rtfexport/data/charborder.odt b/sw/qa/extras/rtfexport/data/charborder.odt
new file mode 100644
index 000000000000..bea79c147153
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/charborder.odt
Binary files differ
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 81340e43af36..2cd5cfa4dbf5 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -68,6 +68,7 @@ public:
void testTextframeTable();
void testFdo66682();
void testParaShadow();
+ void testCharacterBorder();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -125,6 +126,7 @@ void Test::run()
{"textframe-table.rtf", &Test::testTextframeTable},
{"fdo66682.rtf", &Test::testFdo66682},
{"para-shadow.rtf", &Test::testParaShadow},
+ {"charborder.odt", &Test::testCharacterBorder},
};
// Don't test the first import of these, for some reason those tests fail
const char* aBlacklist[] = {
@@ -633,6 +635,44 @@ void Test::testParaShadow()
CPPUNIT_ASSERT_EQUAL(sal_Int16(TWIP_TO_MM100(60)), aShadow.ShadowWidth);
}
+void Test::testCharacterBorder()
+{
+ uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1),1), uno::UNO_QUERY);
+ // RTF has just one border attribute(chbrdr) for text border so all side has
+ // the same border with the same padding
+ // Border
+ {
+ const table::BorderLine2 aTopBorder = getProperty<table::BorderLine2>(xRun,"CharTopBorder");
+ CPPUNIT_ASSERT_EQUAL_BORDER(table::BorderLine2(16737792,0,318,0,0,318), aTopBorder);
+ CPPUNIT_ASSERT_EQUAL_BORDER(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharLeftBorder"));
+ CPPUNIT_ASSERT_EQUAL_BORDER(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharBottomBorder"));
+ CPPUNIT_ASSERT_EQUAL_BORDER(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharRightBorder"));
+ }
+
+ // Padding (brsp)
+ {
+ const sal_Int32 nTopPadding = getProperty<sal_Int32>(xRun,"CharTopBorderDistance");
+ // In the original odt file it is 150, but the unit conversion round it down.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(141), nTopPadding);
+ CPPUNIT_ASSERT_EQUAL(nTopPadding, getProperty<sal_Int32>(xRun,"CharLeftBorderDistance"));
+ CPPUNIT_ASSERT_EQUAL(nTopPadding, getProperty<sal_Int32>(xRun,"CharBottomBorderDistance"));
+ CPPUNIT_ASSERT_EQUAL(nTopPadding, getProperty<sal_Int32>(xRun,"CharRightBorderDistance"));
+ }
+
+ // Shadow (brdrsh)
+ /* RTF use just one bool value for shadow so the next conversions
+ are made during an export-import round
+ color: any -> black
+ location: any -> bottom-right
+ width: any -> border width */
+ {
+ const table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(xRun, "CharShadowFormat");
+ CPPUNIT_ASSERT_EQUAL(COL_BLACK, sal_uInt32(aShadow.Color));
+ CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(318), aShadow.ShadowWidth);
+ }
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();