summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa')
-rwxr-xr-xsw/qa/extras/ww8import/data/bordercolours.docbin0 -> 29696 bytes
-rw-r--r--sw/qa/extras/ww8import/ww8import.cxx116
2 files changed, 116 insertions, 0 deletions
diff --git a/sw/qa/extras/ww8import/data/bordercolours.doc b/sw/qa/extras/ww8import/data/bordercolours.doc
new file mode 100755
index 000000000000..c442223ead3b
--- /dev/null
+++ b/sw/qa/extras/ww8import/data/bordercolours.doc
Binary files differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index 17296e4ca5ec..861a960ee78f 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -12,6 +12,7 @@
#include <com/sun/star/table/BorderLine2.hpp>
#include <com/sun/star/table/TableBorder.hpp>
+#include <com/sun/star/table/TableBorder2.hpp>
#include <com/sun/star/text/XDependentTextField.hpp>
#include <com/sun/star/text/XTextFramesSupplier.hpp>
#include <com/sun/star/text/XTextTablesSupplier.hpp>
@@ -256,6 +257,121 @@ DECLARE_WW8IMPORT_TEST(testCp1000039, "cp1000039.doc")
CPPUNIT_ASSERT_EQUAL(sal_Int16(RTL_TEXTENCODING_DONTKNOW), getProperty<sal_Int16>(getRun(getParagraph(1), 1), "CharFontCharSet"));
}
+DECLARE_WW8IMPORT_TEST(testBorderColours, "bordercolours.doc")
+{
+ // The following 6 colours can only be represented with WW9 (Word 2000)
+ // BRC (BoRder Control) structures. We can tell that they have been
+ // exported/imported using a WW8 (Word '97) BRC if they instead come
+ // through as one of the 16 colours listed at this link:
+ // http://msdn.microsoft.com/en-us/library/dd773060.aspx
+ table::BorderLine2 expectedTop(0xFA670C, 0, 53, 0, 1, 53);
+ table::BorderLine2 expectedLeft(0xD99594, 0, 79, 0, 0, 79);
+ table::BorderLine2 expectedRight(0xB2A1C7, 53, 53, 53, 3, 159);
+ table::BorderLine2 expectedBottom(0xB6DDE8, 0, 106, 0, 14, 106);
+ table::BorderLine2 expectedDashedRed(0xFA670C, 0, 53, 0, 2, 53);
+ table::BorderLine2 expectedDoubleGreen(0xC2D69B, 26, 106, 26, 4, 159);
+
+ // Paragraph border
+ uno::Reference<text::XBookmarksSupplier> bookmarksSupplier(mxComponent,
+ uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> bookmarks(
+ bookmarksSupplier->getBookmarks(), uno::UNO_QUERY);
+ uno::Reference<text::XTextContent> bookmark(
+ bookmarks->getByName("ParagraphBorder"), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> anchor(bookmark->getAnchor());
+ table::BorderLine2 border;
+ border = getProperty<table::BorderLine2>(anchor, "TopBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
+ border = getProperty<table::BorderLine2>(anchor, "LeftBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedLeft, border);
+ border = getProperty<table::BorderLine2>(anchor, "RightBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border);
+ border = getProperty<table::BorderLine2>(anchor, "BottomBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedBottom, border);
+
+ // Page border
+ OUString pageStyleName = getProperty<OUString>(anchor, "PageStyleName");
+ uno::Reference<style::XStyle> pageStyle(
+ getStyles("PageStyles")->getByName(pageStyleName), uno::UNO_QUERY);
+ border = getProperty<table::BorderLine2>(pageStyle, "TopBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
+ border = getProperty<table::BorderLine2>(pageStyle, "LeftBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedLeft, border);
+ border = getProperty<table::BorderLine2>(pageStyle, "RightBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border);
+ border = getProperty<table::BorderLine2>(pageStyle, "BottomBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedBottom, border);
+
+ // Character border
+ bookmark.set(bookmarks->getByName("CharBorder"), uno::UNO_QUERY);
+ anchor = bookmark->getAnchor();
+ border = getProperty<table::BorderLine2>(anchor, "CharTopBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
+ border = getProperty<table::BorderLine2>(anchor, "CharLeftBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
+ border = getProperty<table::BorderLine2>(anchor, "CharRightBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
+ border = getProperty<table::BorderLine2>(anchor, "CharBottomBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
+
+ // Table border
+ uno::Reference<text::XTextTablesSupplier> tablesSupplier(mxComponent,
+ uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> tables(
+ tablesSupplier->getTextTables(), uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> table(
+ tables->getByName("Table1"), uno::UNO_QUERY);
+ table::TableBorder2 tableBorder = getProperty<table::TableBorder2>(
+ table, "TableBorder2");
+ CPPUNIT_ASSERT_EQUAL(expectedTop.Color, tableBorder.TopLine.Color);
+ CPPUNIT_ASSERT_EQUAL(expectedLeft.Color, tableBorder.LeftLine.Color);
+ CPPUNIT_ASSERT_EQUAL(expectedRight.Color, tableBorder.RightLine.Color);
+ CPPUNIT_ASSERT_EQUAL(expectedBottom.Color, tableBorder.BottomLine.Color);
+
+ // Table cells
+ uno::Reference<table::XCell> cell(
+ table->getCellByName("A2"), uno::UNO_QUERY);
+ border = getProperty<table::BorderLine2>(cell, "TopBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
+ border = getProperty<table::BorderLine2>(cell, "LeftBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedLeft, border);
+ border = getProperty<table::BorderLine2>(cell, "BottomBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedBottom, border);
+
+ cell.set(table->getCellByName("B2"), uno::UNO_QUERY);
+ border = getProperty<table::BorderLine2>(cell, "TopBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedDoubleGreen, border);
+ border = getProperty<table::BorderLine2>(cell, "LeftBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border);
+ border = getProperty<table::BorderLine2>(cell, "BottomBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedDoubleGreen, border);
+
+ cell.set(table->getCellByName("C2"), uno::UNO_QUERY);
+ border = getProperty<table::BorderLine2>(cell, "TopBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedDoubleGreen, border);
+ border = getProperty<table::BorderLine2>(cell, "LeftBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedDashedRed, border);
+ border = getProperty<table::BorderLine2>(cell, "RightBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border);
+ border = getProperty<table::BorderLine2>(cell, "BottomBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedDoubleGreen, border);
+
+ // Picture border
+ // (#if'd out as they are not yet imported with correct colours)
+#if 0
+ bookmark.set(bookmarks->getByName("PictureBorder"),uno::UNO_QUERY);
+ anchor = bookmark->getAnchor();
+ border = getProperty<table::BorderLine2>(anchor, "TopBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
+ border = getProperty<table::BorderLine2>(anchor, "LeftBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedLeft, border);
+ border = getProperty<table::BorderLine2>(anchor, "RightBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border);
+ border = getProperty<table::BorderLine2>(anchor, "BottomBorder");
+ CPPUNIT_ASSERT_BORDER_EQUAL(expectedBottom, border);
+#endif
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();