summaryrefslogtreecommitdiffstats
path: root/tests/auto/qrawfont/tst_qrawfont.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qrawfont/tst_qrawfont.cpp')
-rw-r--r--tests/auto/qrawfont/tst_qrawfont.cpp52
1 files changed, 44 insertions, 8 deletions
diff --git a/tests/auto/qrawfont/tst_qrawfont.cpp b/tests/auto/qrawfont/tst_qrawfont.cpp
index 4b42c74bb7..8c5840703a 100644
--- a/tests/auto/qrawfont/tst_qrawfont.cpp
+++ b/tests/auto/qrawfont/tst_qrawfont.cpp
@@ -91,6 +91,9 @@ private slots:
void unsupportedWritingSystem_data();
void unsupportedWritingSystem();
+
+ void rawFontSetPixelSize_data();
+ void rawFontSetPixelSize();
#endif // QT_NO_RAWFONT
};
@@ -293,12 +296,12 @@ void tst_QRawFont::textLayout()
layout.createLine();
layout.endLayout();
- QList<QGlyphs> glyphss = layout.glyphs();
- QCOMPARE(glyphss.size(), 1);
+ QList<QGlyphRun> glyphRuns = layout.glyphRuns();
+ QCOMPARE(glyphRuns.size(), 1);
- QGlyphs glyphs = glyphss.at(0);
+ QGlyphRun glyphs = glyphRuns.at(0);
- QRawFont rawFont = glyphs.font();
+ QRawFont rawFont = glyphs.rawFont();
QVERIFY(rawFont.isValid());
QCOMPARE(rawFont.familyName(), familyName);
QCOMPARE(rawFont.pixelSize(), 18.0);
@@ -792,11 +795,11 @@ void tst_QRawFont::unsupportedWritingSystem()
layout.createLine();
layout.endLayout();
- QList<QGlyphs> glyphss = layout.glyphs();
- QCOMPARE(glyphss.size(), 1);
+ QList<QGlyphRun> glyphRuns = layout.glyphRuns();
+ QCOMPARE(glyphRuns.size(), 1);
- QGlyphs glyphs = glyphss.at(0);
- QRawFont layoutFont = glyphs.font();
+ QGlyphRun glyphs = glyphRuns.at(0);
+ QRawFont layoutFont = glyphs.rawFont();
QVERIFY(layoutFont.familyName() != QString::fromLatin1("QtBidiTestFont"));
QCOMPARE(layoutFont.pixelSize(), 12.0);
@@ -807,6 +810,39 @@ void tst_QRawFont::unsupportedWritingSystem()
fontDatabase.removeApplicationFont(id);
}
+void tst_QRawFont::rawFontSetPixelSize_data()
+{
+ QTest::addColumn<QFont::HintingPreference>("hintingPreference");
+
+ QTest::newRow("Default hinting preference") << QFont::PreferDefaultHinting;
+ QTest::newRow("No hinting preference") << QFont::PreferNoHinting;
+ QTest::newRow("Vertical hinting preference") << QFont::PreferVerticalHinting;
+ QTest::newRow("Full hinting preference") << QFont::PreferFullHinting;
+}
+
+void tst_QRawFont::rawFontSetPixelSize()
+{
+ QFETCH(QFont::HintingPreference, hintingPreference);
+
+ QTextLayout layout("Foobar");
+
+ QFont font = layout.font();
+ font.setHintingPreference(hintingPreference);
+ font.setPixelSize(12);
+ layout.setFont(font);
+
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+
+ QGlyphRun glyphs = layout.glyphRuns().at(0);
+ QRawFont rawFont = glyphs.rawFont();
+ QCOMPARE(rawFont.pixelSize(), 12.0);
+
+ rawFont.setPixelSize(24);
+ QCOMPARE(rawFont.pixelSize(), 24.0);
+}
+
#endif // QT_NO_RAWFONT
QTEST_MAIN(tst_QRawFont)