[Libreoffice-commits] core.git: Branch 'feature/cib_contract561' - sw/qa sw/source
Vasily Melenchuk
Vasily.Melenchuk at cib.de
Thu Jun 8 11:08:18 UTC 2017
sw/qa/extras/htmlimport/data/table_border_1px.html | 22 ++++++++++++++
sw/qa/extras/htmlimport/htmlimport.cxx | 32 +++++++++++++++++++++
sw/source/filter/html/htmltab.cxx | 10 ------
3 files changed, 55 insertions(+), 9 deletions(-)
New commits:
commit 50a719755bf64fcfbd0ed490365baa8b84bab22b
Author: Vasily Melenchuk <Vasily.Melenchuk at cib.de>
Date: Tue Jun 6 15:35:17 2017 +0300
Removed ancient hack, causing vertical table borders to disappear
HTML tables with border="1" were parsed and displayed incorrectly:
no vertical borders; invalid border width.
Additional problem is in strange condition allowing setting right
border.
(cherry picked from commit f2d06eefa9f221bdd9212a28697d4d203d1f97f6)
Change-Id: Ibe87e630ef9ef0a4352bbe659340f69c8ebc0d0d
diff --git a/sw/qa/extras/htmlimport/data/table_border_1px.html b/sw/qa/extras/htmlimport/data/table_border_1px.html
new file mode 100644
index 000000000000..6181aa0f82f2
--- /dev/null
+++ b/sw/qa/extras/htmlimport/data/table_border_1px.html
@@ -0,0 +1,22 @@
+<table border="1">
+<tr>
+<td>Schlüssel</td>
+<td>Name_des_Tests</td>
+<td>3</td>
+</tr>
+<tr>
+<td>Öffnen der "Document Type" Maske</td>
+<td>AF01.01</td>
+<td>3</td>
+</tr>
+<tr>
+<td>Öffnen der "Document Type" Maske</td>
+<td>Öffnen der "Document Type" Maske</td>
+<td>3</td>
+</tr>
+<tr>
+<td>Öffnen der "Document Type" Maske</td>
+<td>Öffnen der "Document Type" Maske</td>
+<td>3</td>
+</tr>
+</table>
\ No newline at end of file
diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx b/sw/qa/extras/htmlimport/htmlimport.cxx
index 973b8304bda1..3f421814dec1 100644
--- a/sw/qa/extras/htmlimport/htmlimport.cxx
+++ b/sw/qa/extras/htmlimport/htmlimport.cxx
@@ -84,6 +84,38 @@ DECLARE_HTMLIMPORT_TEST(testInlinedImage, "inlined_image.html")
}
}
+DECLARE_HTMLIMPORT_TEST(testTableBorder1px, "table_border_1px.html")
+{
+ uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+ uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+
+ uno::Reference<text::XTextRange> xCellA1(xTable->getCellByName("A1"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty<table::BorderLine2>(xCellA1,"TopBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,0,2,4,3,2), getProperty<table::BorderLine2>(xCellA1,"BottomBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty<table::BorderLine2>(xCellA1,"LeftBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty<table::BorderLine2>(xCellA1,"RightBorder"));
+
+ uno::Reference<text::XTextRange> xCellB1(xTable->getCellByName("B1"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty<table::BorderLine2>(xCellB1,"TopBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,0,2,4,3,2), getProperty<table::BorderLine2>(xCellB1,"BottomBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,0,2,4,3,2), getProperty<table::BorderLine2>(xCellB1,"LeftBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty<table::BorderLine2>(xCellB1,"RightBorder"));
+
+ uno::Reference<text::XTextRange> xCellA2(xTable->getCellByName("A2"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x0,0,0,0,0,0), getProperty<table::BorderLine2>(xCellA2,"TopBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,0,2,4,3,2), getProperty<table::BorderLine2>(xCellA2,"BottomBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty<table::BorderLine2>(xCellA2,"LeftBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty<table::BorderLine2>(xCellA2,"RightBorder"));
+
+ uno::Reference<text::XTextRange> xCellB2(xTable->getCellByName("B2"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x0,0,0,0,0,0), getProperty<table::BorderLine2>(xCellB2,"TopBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,0,2,4,3,2), getProperty<table::BorderLine2>(xCellB2,"BottomBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,0,2,4,3,2), getProperty<table::BorderLine2>(xCellB2,"LeftBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty<table::BorderLine2>(xCellB2,"RightBorder"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index d7444f36c85b..d73358063f91 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -965,14 +965,6 @@ void HTMLTable::InitCtor( const HTMLTableOptions *pOptions )
if( nBorderOpt==USHRT_MAX )
nPWidth = 0;
- // HACK: ein Pixel-breite Linien sollen zur Haarlinie werden, wenn
- // wir mit doppelter Umrandung arbeiten
- if( pOptions->nCellSpacing!=0 && nBorderOpt==1 )
- {
- nPWidth = 1;
- nPHeight = 1;
- }
-
if ( pOptions->nCellSpacing != 0 )
{
aTopBorderLine.SetBorderLineStyle(table::BorderLineStyle::DOUBLE);
@@ -1455,7 +1447,7 @@ void HTMLTable::FixFrameFormat( SwTableBox *pBox,
nInnerFrmWidth -= GetBorderWidth( rBorderLine );
bSet = true;
}
- if( nCol+nColSpan == nCols && bRightBorder )
+ if( bRightBorder )
{
aBoxItem.SetLine( &aRightBorderLine, SvxBoxItemLine::RIGHT );
nInnerFrmWidth -= GetBorderWidth( aRightBorderLine );
More information about the Libreoffice-commits
mailing list