[Libreoffice-commits] core.git: sw/qa

Mark Hung marklh9 at gmail.com
Sat Apr 22 09:00:52 UTC 2017


 sw/qa/extras/uiwriter/uiwriter.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit ae39c98544b92de42066abd32649076d368b3c9c
Author: Mark Hung <marklh9 at gmail.com>
Date:   Fri Apr 21 23:23:25 2017 +0800

    sw: skip part of uiwriter/testTdf107025 if not testable.
    
    The unit test is about textgrid and uses DFKAI-SB that
    shipped with Windows. Required font might not installed
    in some build environment. Not having width in the first
    implies that the case is not testable.
    
    Change-Id: I98f9b9f6291eea95a1b36f1890b1be903ccb26dd
    Reviewed-on: https://gerrit.libreoffice.org/36802
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mark Hung <marklh9 at gmail.com>

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index ca017f473e5e..43f5856540ec 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -4443,20 +4443,23 @@ void SwUiWriterTest::testTdf107025()
     // Tdf107025 - characters advance with wrong distance, so that
     // they are cluttered because of negative value or
     // break into multiple lines because of overflow.
+    // The test document uses DFKAI-SB shipped with Windows.
     createDoc("tdf107025.odt");
     xmlDocPtr pXmlDoc = parseLayoutDump();
     // Verify the number of characters in each line.
     CPPUNIT_ASSERT_EQUAL( sal_Int32(1), getXPath(pXmlDoc, "(//Text[@nType='POR_TXT'])[1]", "nLength").toInt32());
     CPPUNIT_ASSERT_EQUAL( sal_Int32(9), getXPath(pXmlDoc, "(//Text[@nType='POR_TXT'])[2]", "nLength").toInt32());
 
+    // Do the subsequent test only if the first line can be displayed,
+    // in case that the required font does not exist.
+    sal_Int32 nWidth1 = getXPath(pXmlDoc, "(//Text[@nType='POR_TXT'])[1]", "nWidth").toInt32();
+    if (!nWidth1)
+        return;
 
-    CPPUNIT_ASSERT(!parseDump("(//Text[@nType='POR_TXT'])[1]", "nWidth").isEmpty());
     CPPUNIT_ASSERT(!parseDump("(//Text[@nType='POR_TXT'])[2]", "nWidth").isEmpty());
     // Width of the second line is expected to be 9 times of the first.
-    sal_Int32 nWidth1 = getXPath(pXmlDoc, "(//Text[@nType='POR_TXT'])[1]", "nWidth").toInt32();
     sal_Int32 nWidth2 = getXPath(pXmlDoc, "(//Text[@nType='POR_TXT'])[2]", "nWidth").toInt32();
 
-    CPPUNIT_ASSERT( nWidth1 != 0 );
     CPPUNIT_ASSERT_EQUAL( sal_Int32(9), nWidth2 / nWidth1 );
 }
 


More information about the Libreoffice-commits mailing list