diff options
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/gui/text/qrawfont/testdata.qrc | 1 | ||||
-rw-r--r-- | tests/auto/gui/text/qrawfont/testfont_os2_v1.ttf | bin | 0 -> 72960 bytes | |||
-rw-r--r-- | tests/auto/gui/text/qrawfont/tst_qrawfont.cpp | 30 |
3 files changed, 29 insertions, 2 deletions
diff --git a/tests/auto/gui/text/qrawfont/testdata.qrc b/tests/auto/gui/text/qrawfont/testdata.qrc index 8f8e32ed24..c7ac9641d1 100644 --- a/tests/auto/gui/text/qrawfont/testdata.qrc +++ b/tests/auto/gui/text/qrawfont/testdata.qrc @@ -1,6 +1,7 @@ <RCC> <qresource prefix="/"> <file>testfont_bold_italic.ttf</file> + <file>testfont_os2_v1.ttf</file> <file alias="testfont.ttf">../../../shared/resources/testfont.ttf</file> </qresource> </RCC> diff --git a/tests/auto/gui/text/qrawfont/testfont_os2_v1.ttf b/tests/auto/gui/text/qrawfont/testfont_os2_v1.ttf Binary files differnew file mode 100644 index 0000000000..ee8b67d892 --- /dev/null +++ b/tests/auto/gui/text/qrawfont/testfont_os2_v1.ttf diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp index 471b32dd50..3cf108ed62 100644 --- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp +++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp @@ -93,6 +93,7 @@ private slots: private: QString testFont; QString testFontBoldItalic; + QString testFontOs2V1; #endif // QT_NO_RAWFONT }; @@ -110,6 +111,7 @@ void tst_QRawFont::initTestCase() { testFont = QFINDTESTDATA("testfont.ttf"); testFontBoldItalic = QFINDTESTDATA("testfont_bold_italic.ttf"); + testFontOs2V1 = QFINDTESTDATA("testfont_os2_v1.ttf"); if (testFont.isEmpty() || testFontBoldItalic.isEmpty()) QFAIL("qrawfont unittest font files not found!"); @@ -184,6 +186,7 @@ void tst_QRawFont::correctFontData_data() QTest::addColumn<QFont::HintingPreference>("hintingPreference"); QTest::addColumn<qreal>("unitsPerEm"); QTest::addColumn<qreal>("pixelSize"); + QTest::addColumn<int>("capHeight"); int hintingPreferences[] = { int(QFont::PreferDefaultHinting), @@ -207,7 +210,8 @@ void tst_QRawFont::correctFontData_data() << QFont::Normal << QFont::HintingPreference(*hintingPreference) << qreal(1000.0) - << qreal(10.0); + << qreal(10.0) + << 7; fileName = testFontBoldItalic; title = fileName @@ -221,7 +225,23 @@ void tst_QRawFont::correctFontData_data() << QFont::Bold << QFont::HintingPreference(*hintingPreference) << qreal(1000.0) - << qreal(10.0); + << qreal(10.0) + << 7; + + fileName = testFontOs2V1; + title = fileName + + QLatin1String(": hintingPreference=") + + QString::number(*hintingPreference); + + QTest::newRow(qPrintable(title)) + << fileName + << QString::fromLatin1("QtBidiTestFont") + << QFont::StyleNormal + << QFont::Normal + << QFont::HintingPreference(*hintingPreference) + << qreal(1000.0) + << qreal(10.0) + << 7; ++hintingPreference; } @@ -236,6 +256,7 @@ void tst_QRawFont::correctFontData() QFETCH(QFont::HintingPreference, hintingPreference); QFETCH(qreal, unitsPerEm); QFETCH(qreal, pixelSize); + QFETCH(int, capHeight); QRawFont font(fileName, 10, hintingPreference); QVERIFY(font.isValid()); @@ -246,6 +267,11 @@ void tst_QRawFont::correctFontData() QCOMPARE(font.hintingPreference(), hintingPreference); QCOMPARE(font.unitsPerEm(), unitsPerEm); QCOMPARE(font.pixelSize(), pixelSize); + + // Some platforms return the actual fractional height of the + // H character when the value is missing from the OS/2 table, + // so we ceil it off to match (any touched pixel counts). + QCOMPARE(qCeil(font.capHeight()), capHeight); } void tst_QRawFont::glyphIndices() |