From 8f2f277571091045fb57cec7f225a3391cc374b1 Mon Sep 17 00:00:00 2001 From: Vasily Melenchuk Date: Tue, 20 Jun 2017 16:42:14 +0300 Subject: sw_htmlimport::testTableBorder1px testcase simplified Goal of this testcase is just to ensure that some table cell borders exist while some others do not. There is no reason to do exact width comparison which is causing errors on some MacOS configurations. Change-Id: I574c29220696ae654dea2db0398790a440efd83b Reviewed-on: https://gerrit.libreoffice.org/39015 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- sw/qa/extras/htmlimport/htmlimport.cxx | 50 +++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx b/sw/qa/extras/htmlimport/htmlimport.cxx index 19f51c1824ea..5e704b3f3be9 100644 --- a/sw/qa/extras/htmlimport/htmlimport.cxx +++ b/sw/qa/extras/htmlimport/htmlimport.cxx @@ -228,29 +228,47 @@ DECLARE_HTMLIMPORT_TEST(testTableBorder1px, "table_border_1px.html") CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount()); uno::Reference xTable(xTables->getByIndex(0), uno::UNO_QUERY); + table::BorderLine2 aBorder; + uno::Reference xCellA1(xTable->getCellByName("A1"), uno::UNO_QUERY); - CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty(xCellA1,"TopBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,0,2,4,3,2), getProperty(xCellA1,"BottomBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty(xCellA1,"LeftBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty(xCellA1,"RightBorder")); + aBorder = getProperty(xCellA1, "TopBorder"); + CPPUNIT_ASSERT_MESSAGE("Missing cell top border", aBorder.InnerLineWidth > 0); + aBorder = getProperty(xCellA1, "BottomBorder"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected cell bottom border", sal_Int16(0), aBorder.InnerLineWidth); + aBorder = getProperty(xCellA1, "LeftBorder"); + CPPUNIT_ASSERT_MESSAGE("Missing cell left border", aBorder.InnerLineWidth > 0); + aBorder = getProperty(xCellA1, "RightBorder"); + CPPUNIT_ASSERT_MESSAGE("Missing cell right border", aBorder.InnerLineWidth > 0); uno::Reference xCellB1(xTable->getCellByName("B1"), uno::UNO_QUERY); - CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty(xCellB1,"TopBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,0,2,4,3,2), getProperty(xCellB1,"BottomBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,0,2,4,3,2), getProperty(xCellB1,"LeftBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty(xCellB1,"RightBorder")); + aBorder = getProperty(xCellB1, "TopBorder"); + CPPUNIT_ASSERT_MESSAGE("Missing cell top border", aBorder.InnerLineWidth > 0); + aBorder = getProperty(xCellB1, "BottomBorder"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected cell bottom border", sal_Int16(0), aBorder.InnerLineWidth); + aBorder = getProperty(xCellB1, "LeftBorder"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected cell left border", sal_Int16(0), aBorder.InnerLineWidth); + aBorder = getProperty(xCellB1, "RightBorder"); + CPPUNIT_ASSERT_MESSAGE("Missing cell right border", aBorder.InnerLineWidth > 0); uno::Reference xCellA2(xTable->getCellByName("A2"), uno::UNO_QUERY); - CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x0,0,0,0,0,0), getProperty(xCellA2,"TopBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,0,2,4,3,2), getProperty(xCellA2,"BottomBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty(xCellA2,"LeftBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty(xCellA2,"RightBorder")); + aBorder = getProperty(xCellA2, "TopBorder"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected cell top border", sal_Int16(0), aBorder.InnerLineWidth); + aBorder = getProperty(xCellA2, "BottomBorder"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected cell bottom border", sal_Int16(0), aBorder.InnerLineWidth); + aBorder = getProperty(xCellA2, "LeftBorder"); + CPPUNIT_ASSERT_MESSAGE("Missing cell left border", aBorder.InnerLineWidth > 0); + aBorder = getProperty(xCellA2,"RightBorder"); + CPPUNIT_ASSERT_MESSAGE("Missing cell right border", aBorder.InnerLineWidth > 0); uno::Reference xCellB2(xTable->getCellByName("B2"), uno::UNO_QUERY); - CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x0,0,0,0,0,0), getProperty(xCellB2,"TopBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,0,2,4,3,2), getProperty(xCellB2,"BottomBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,0,2,4,3,2), getProperty(xCellB2,"LeftBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty(xCellB2,"RightBorder")); + aBorder = getProperty(xCellB2, "TopBorder"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected cell top border", sal_Int16(0), aBorder.InnerLineWidth); + aBorder = getProperty(xCellB2, "BottomBorder"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected cell bottom border", sal_Int16(0), aBorder.InnerLineWidth); + aBorder = getProperty(xCellB2, "LeftBorder"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected cell left border", sal_Int16(0), aBorder.InnerLineWidth); + aBorder = getProperty(xCellB2, "RightBorder"); + CPPUNIT_ASSERT_MESSAGE("Missing cell right border", aBorder.InnerLineWidth > 0); } CPPUNIT_PLUGIN_IMPLEMENT(); -- cgit v1.2.3