summaryrefslogtreecommitdiff
path: root/sw/qa/extras/rtfimport
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-03-14 19:03:09 +0100
committerMichael Stahl <mstahl@redhat.com>2014-03-14 19:15:57 +0100
commit84f4de3b65cd0f861e80c69b773004f28f9f8d9f (patch)
tree6bd1ca36368ca49323ccd71233bd2b9ab3f514a4 /sw/qa/extras/rtfimport
parentcc847b5885f89e9292ba6aec1298f3261a966c66 (diff)
fdo#68779: RTF import: set borders without explicit width
Word reportedly uses 0.75pt as a default if \brdrw is missing. Change-Id: I263c56f756c65ff6bb30870aa70806564d5826a6
Diffstat (limited to 'sw/qa/extras/rtfimport')
-rw-r--r--sw/qa/extras/rtfimport/data/fdo68779.rtf25
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx62
2 files changed, 87 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo68779.rtf b/sw/qa/extras/rtfimport/data/fdo68779.rtf
new file mode 100644
index 000000000000..5dc7683fc858
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo68779.rtf
@@ -0,0 +1,25 @@
+{\rtf1\ansi\ansicpg1251
+\paperw11907\paperh16840\psz9\margl1418\margr1984\margt2438\margb1531
+{\colortbl\red0\green0\blue0;}\deflang1049
+
+\trowd
+\clbrdrt\brdrs\clbrdrl\brdrs\clbrdrb\brdrs\clbrdrr\brdrs\cellx8335
+\pard\plain \intbl foo\cell \pard \intbl \row
+\pard \par
+
+\trowd
+\clbrdrt\brdrdot\clbrdrl\brdrdot\clbrdrb\brdrdot\clbrdrr\brdrdot\cellx8335
+\pard\plain \intbl foo\cell \pard \intbl \row
+\pard \par
+
+\trowd
+\clbrdrt\brdrdb\clbrdrl\brdrdb\clbrdrb\brdrdb\clbrdrr\brdrdb\cellx8335
+\pard\plain \intbl foo\cell \pard \intbl \row
+\pard \par
+
+\trowd
+\clbrdrt\brdrtnthmg\clbrdrl\brdrtnthmg\clbrdrb\brdrtnthmg\clbrdrr\brdrtnthmg\cellx8335
+\pard\plain \intbl foo\cell \pard \intbl \row
+\pard \par
+
+\pard \par}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index f11f5ea4133f..0be7aff4a017 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1484,6 +1484,68 @@ DECLARE_RTFIMPORT_TEST(testFdo65090, "fdo65090.rtf")
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators").getLength());
}
+DECLARE_RTFIMPORT_TEST(testTableBorderDefaults, "fdo68779.rtf")
+{
+ // table borders without \brdrw were not imported
+ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xCell.is());
+ table::BorderLine2 solid(
+ 1, 0, 26, 0, table::BorderLineStyle::SOLID, 26);
+ CPPUNIT_ASSERT_BORDER_EQUAL(solid,
+ getProperty<table::BorderLine2>(xCell, "LeftBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(solid,
+ getProperty<table::BorderLine2>(xCell, "RightBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(solid,
+ getProperty<table::BorderLine2>(xCell, "TopBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(solid,
+ getProperty<table::BorderLine2>(xCell, "BottomBorder"));
+
+ xTable.set(xTables->getByIndex(1), uno::UNO_QUERY);
+ xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xCell.is());
+ table::BorderLine2 dotted(
+ 1, 0, 26, 0, table::BorderLineStyle::DOTTED, 26);
+ CPPUNIT_ASSERT_BORDER_EQUAL(dotted,
+ getProperty<table::BorderLine2>(xCell, "LeftBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(dotted,
+ getProperty<table::BorderLine2>(xCell, "RightBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(dotted,
+ getProperty<table::BorderLine2>(xCell, "TopBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(dotted,
+ getProperty<table::BorderLine2>(xCell, "BottomBorder"));
+
+ xTable.set(xTables->getByIndex(2), uno::UNO_QUERY);
+ xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xCell.is());
+ table::BorderLine2 doubled(
+ 1, 26, 26, 26, table::BorderLineStyle::DOUBLE, 79);
+ CPPUNIT_ASSERT_BORDER_EQUAL(doubled,
+ getProperty<table::BorderLine2>(xCell, "LeftBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(doubled,
+ getProperty<table::BorderLine2>(xCell, "RightBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(doubled,
+ getProperty<table::BorderLine2>(xCell, "TopBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(doubled,
+ getProperty<table::BorderLine2>(xCell, "BottomBorder"));
+
+ xTable.set(xTables->getByIndex(3), uno::UNO_QUERY);
+ xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xCell.is());
+ table::BorderLine2 thinThickMG(
+ 1, 14, 26, 14, table::BorderLineStyle::THINTHICK_MEDIUMGAP, 53);
+ CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG,
+ getProperty<table::BorderLine2>(xCell, "LeftBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG,
+ getProperty<table::BorderLine2>(xCell, "RightBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG,
+ getProperty<table::BorderLine2>(xCell, "TopBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG,
+ getProperty<table::BorderLine2>(xCell, "BottomBorder"));
+}
+
DECLARE_RTFIMPORT_TEST(testShpzDhgt, "shpz-dhgt.rtf")
{
// Test that shpz has priority over dhght and not the other way around.