vcl/qa/cppunit/complextext.cxx | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
New commits: commit eb7b03b052ffe8c2c577b2349987653db6c53f76 Author: Khaled Hosny <khaledho...@eglug.org> Date: Sun Feb 26 21:52:28 2017 +0200 Make vcl_complextext test actually test something Change-Id: If63fc55722a414388dfda8330cd7de00305567d5 Reviewed-on: https://gerrit.libreoffice.org/34658 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Khaled Hosny <khaledho...@eglug.org> diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx index a7aa56a..58c1080 100644 --- a/vcl/qa/cppunit/complextext.cxx +++ b/vcl/qa/cppunit/complextext.cxx @@ -36,9 +36,6 @@ public: void VclComplexTextTest::testArabic() { -#if !defined (LINUX) - return; -#else // only tested on Linux so far const unsigned char pOneTwoThreeUTF8[] = { 0xd9, 0x88, 0xd8, 0xa7, 0xd8, 0xad, 0xd9, 0x90, 0xd8, 0xaf, 0xd9, 0x92, 0x20, 0xd8, 0xa5, 0xd8, @@ -52,14 +49,23 @@ void VclComplexTextTest::testArabic() ScopedVclPtrInstance<WorkWindow> pWin(static_cast<vcl::Window *>(nullptr)); CPPUNIT_ASSERT( pWin ); - OutputDevice *pOutDev = pWin.get(); + vcl::Font aFont("DejaVu Sans", "Book", Size(0, 12)); - vcl::Font aFont = OutputDevice::GetDefaultFont( - DefaultFontType::CTL_SPREADSHEET, - LANGUAGE_ARABIC_SAUDI_ARABIA, - GetDefaultFontFlags::OnlyOne ); + OutputDevice *pOutDev = pWin.get(); pOutDev->SetFont( aFont ); + // text advance width and line height + CPPUNIT_ASSERT_EQUAL(72L, pOutDev->GetTextWidth(aOneTwoThree)); + CPPUNIT_ASSERT_EQUAL(13L, pOutDev->GetTextHeight()); + + // exact bounding rectangle, not essentially the same as text width/height +#ifndef MACOSX + // FIXME: fails on mac, probably different rounding strategy. + Rectangle aBoundRect; + pOutDev->GetTextBoundRect(aBoundRect, aOneTwoThree); + CPPUNIT_ASSERT_EQUAL(Rectangle(0, 1, 71, 15), aBoundRect); +#endif + // normal orientation Rectangle aInput; Rectangle aRect = pOutDev->GetTextRect( aInput, aOneTwoThree ); @@ -72,6 +78,8 @@ void VclComplexTextTest::testArabic() // Check that we did do the rotation ... #if 0 + // FIXME: This seems to be wisthful thinking, GetTextRect() does not take + // rotation into account. fprintf( stderr, "%ld %ld %ld %ld\n", aRect.GetWidth(), aRect.GetHeight(), aRectRot.GetWidth(), aRectRot.GetHeight() ); @@ -80,7 +88,6 @@ void VclComplexTextTest::testArabic() #else (void)aRect; (void)aRectRot; #endif -#endif } #if defined(_WIN32) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits