From 62592cf1ebcc8ef381fe53855684342d963e6138 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Wed, 1 Mar 2017 01:38:58 +0200 Subject: 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 Reviewed-by: Khaled Hosny --- vcl/qa/cppunit/complextext.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'vcl/qa/cppunit/complextext.cxx') diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx index 4b0d243a6d1d..fd6a72f2efa6 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 aCharWidths(aOneTwoThree.getLength(), 0); + long nTextWidth = pOutDev->GetTextArray(aOneTwoThree, aCharWidths.data()); + CPPUNIT_ASSERT_EQUAL(72L, nTextWidth); + CPPUNIT_ASSERT_EQUAL(nTextWidth, aCharWidths.back()); + std::vector 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()); -- cgit