vcl/qa/cppunit/complextext.cxx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
New commits: commit 55b42fa3417a547c858ef694ea11bce6840683e6 Author: Khaled Hosny <kha...@libreoffice.org> AuthorDate: Tue Jun 13 13:44:58 2023 +0300 Commit: خالد حسني <kha...@libreoffice.org> CommitDate: Tue Jun 13 16:04:05 2023 +0200 Backport test The missing test part from" commit 87c8b85c273f285110ea3ae6d6fe99ece279b7b0 Author: Khaled Hosny <kha...@libreoffice.org> Date: Mon Jun 12 22:29:11 2023 +0300 tdf#152048: Fix measuring text width with font fallback Change-Id: I41a04a5ba05187b880e0f3ecc1ccd863929e6339 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152956 Tested-by: Jenkins Reviewed-by: خالد حسني <kha...@libreoffice.org> diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx index 36fe89c9c151..9473d5b7b696 100644 --- a/vcl/qa/cppunit/complextext.cxx +++ b/vcl/qa/cppunit/complextext.cxx @@ -400,4 +400,25 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testTdf152048) #endif } +CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testTdf152048_2) +{ +#if HAVE_MORE_FONTS + vcl::Font aFont(u"Noto Naskh Arabic", u"Regular", Size(0, 72)); + + ScopedVclPtrInstance<VirtualDevice> pOutDev; + pOutDev->SetFont(aFont); + + // get an compare the default text array + KernArray aCharWidths; + auto nTextWidth = pOutDev->GetTextArray(u"ع a ع", &aCharWidths); + + // Text width should always be equal to the width of the last glyph in the + // kern array. + // Without the fix this fails with: + // - Expected: 158 + // - Actual : 118 + CPPUNIT_ASSERT_EQUAL(aCharWidths.back(), sal_Int32(nTextWidth)); +#endif +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */