summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui/text/qrawfont/tst_qrawfont.cpp')
-rw-r--r--tests/auto/gui/text/qrawfont/tst_qrawfont.cpp30
1 files changed, 28 insertions, 2 deletions
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()