Fix QRawFont autotest in Windows

Can't use style name with Windows native font engine, so do the
comparison using style in case multipleRawFontsFromData().

Also XFAILed the advances() case when using Freetype font engine in
Windows, as some of the advances returned are one pixel wider than
expected.

Task-number: QTBUG-24197
Change-Id: Ib5fecd83a93908e57a4c82ffb5495a92474ce45a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
Miikka Heikkinen 2012-04-24 13:06:33 +03:00 committed by Qt by Nokia
parent 67f58040ea
commit ce75529968
2 changed files with 10 additions and 3 deletions

View File

@ -9,5 +9,3 @@ SOURCES += \
INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/harfbuzz/src
TESTDATA += testfont_bold_italic.ttf testfont.ttf
win32:CONFIG += insignificant_test # QTBUG-24197

View File

@ -295,6 +295,15 @@ void tst_QRawFont::advances()
bool supportsSubPixelPositions = font_d->fontEngine->supportsSubPixelPositions();
QVector<QPointF> advances = font.advancesForGlyphIndexes(glyphIndices);
for (int i=0; i<glyphIndices.size(); ++i) {
#ifdef Q_OS_WIN
// In Windows, freetype engine returns advance of 9 when full hinting is used (default) for
// some of the glyphs.
if (font_d->fontEngine->type() == QFontEngine::Freetype
&& (hintingPreference == QFont::PreferFullHinting || hintingPreference == QFont::PreferDefaultHinting)
&& (i == 0 || i == 5)) {
QEXPECT_FAIL("", "Advance for some glyphs is not the expected with Windows Freetype engine (9 instead of 8)", Continue);
}
#endif
QVERIFY(qFuzzyCompare(qRound(advances.at(i).x()), 8.0));
if (supportsSubPixelPositions)
QVERIFY(advances.at(i).x() > 8.0);
@ -879,7 +888,7 @@ void tst_QRawFont::multipleRawFontsFromData()
testFontBoldItalic.loadFromData(file.readAll(), 11, QFont::PreferDefaultHinting);
QVERIFY(testFont.familyName() != (testFontBoldItalic.familyName())
|| testFont.styleName() != (testFontBoldItalic.styleName()));
|| testFont.style() != (testFontBoldItalic.style()));
}
#endif // QT_NO_RAWFONT