diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-05-11 17:23:34 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-05-11 17:23:34 (GMT) |
commit | 806d49e49be10ca7a478b1f0afc4fd0c98321480 (patch) | |
tree | f7e2dd74463c0e2de5f853c2687311d9071f0b47 /tests/auto/qrawfont/tst_qrawfont.cpp | |
parent | c21312c60231b3958981c72e6a190cba381b5720 (diff) | |
parent | c5846314dfd80e7f7f32ba737f1884dcccbbd80d (diff) | |
download | Qt-806d49e49be10ca7a478b1f0afc4fd0c98321480.zip Qt-806d49e49be10ca7a478b1f0afc4fd0c98321480.tar.gz Qt-806d49e49be10ca7a478b1f0afc4fd0c98321480.tar.bz2 |
Merge branch 'master' of git://scm.dev.nokia.troll.no/qt/qt-fire-team
* 'master' of git://scm.dev.nokia.troll.no/qt/qt-fire-team:
Fix QGLWidget::renderPixmap for raster engine on Mac
Check if OES_texture_npot is present on OpenGL ES 2.
Fix tst_QVariant::invalidColor
Move QTextCursor::MoveStyle to Qt namespace
Move the painting redirection to the unified toolbar surface.
Fix misspelled word in comment.
Build fix for tst_qrawfont
Add some QRawFont related low level functions to avoid extra copying
Compile on Mac
Rename QGlyphs -> QGlyphRun
Fix QRawFont::setPixelSize() on Mac
Remove warning from QColor::setNamedColor().
Add internal documentation for QUnifiedToolbarSurface.
Fix QPainter::drawGlyphs() with non-affine transformation
Diffstat (limited to 'tests/auto/qrawfont/tst_qrawfont.cpp')
-rw-r--r-- | tests/auto/qrawfont/tst_qrawfont.cpp | 52 |
1 files changed, 44 insertions, 8 deletions
diff --git a/tests/auto/qrawfont/tst_qrawfont.cpp b/tests/auto/qrawfont/tst_qrawfont.cpp index 4b42c74..8c58407 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) |