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

Khaled Hosny khaledhosny at eglug.org
Wed Mar 1 00:19:40 UTC 2017


 vcl/qa/cppunit/complextext.cxx |   10 ++++++++++
 1 file changed, 10 insertions(+)

New commits:
commit 62592cf1ebcc8ef381fe53855684342d963e6138
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Wed Mar 1 01:38:58 2017 +0200

    Add a test for GetTextArray()
    
    Might help showing the source of differences causing random Windows
    failures.
    
    Change-Id: I435d1d4f7a016b057af30661b1c7016231426149
    Reviewed-on: https://gerrit.libreoffice.org/34731
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>

diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index 4b0d243..fd6a72f 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -54,6 +54,16 @@ void VclComplexTextTest::testArabic()
     OutputDevice *pOutDev = pWin.get();
     pOutDev->SetFont( aFont );
 
+    // absolute character widths AKA text array.
+    std::vector<long> aCharWidths(aOneTwoThree.getLength(), 0);
+    long nTextWidth = pOutDev->GetTextArray(aOneTwoThree, aCharWidths.data());
+    CPPUNIT_ASSERT_EQUAL(72L, nTextWidth);
+    CPPUNIT_ASSERT_EQUAL(nTextWidth, aCharWidths.back());
+    std::vector<long> aRefCharWidths {6,  9,  16, 16, 22, 22, 26, 29, 32, 32,
+                                      36, 40, 49, 53, 56, 63, 63, 66, 72, 72};
+    for (size_t i = 0; i < aCharWidths.size(); i++)
+        CPPUNIT_ASSERT_EQUAL(aRefCharWidths[i], aCharWidths[i]);
+
     // text advance width and line height
     CPPUNIT_ASSERT_EQUAL(72L, pOutDev->GetTextWidth(aOneTwoThree));
     CPPUNIT_ASSERT_EQUAL(13L, pOutDev->GetTextHeight());


More information about the Libreoffice-commits mailing list