summaryrefslogtreecommitdiff
path: root/vcl/qa/cppunit/complextext.cxx
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2017-02-26 21:52:28 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2017-02-26 22:19:29 +0000
commiteb7b03b052ffe8c2c577b2349987653db6c53f76 (patch)
tree5fd350dbb96243383b1ae87ea58899f72f4f8bc1 /vcl/qa/cppunit/complextext.cxx
parent0a5f97f2985ec8e51910770d1748203cd4cd49c7 (diff)
Make vcl_complextext test actually test something
Change-Id: If63fc55722a414388dfda8330cd7de00305567d5 Reviewed-on: https://gerrit.libreoffice.org/34658 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
Diffstat (limited to 'vcl/qa/cppunit/complextext.cxx')
-rw-r--r--vcl/qa/cppunit/complextext.cxx25
1 files changed, 16 insertions, 9 deletions
diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index a7aa56a9f237..58c10803e4c6 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)