diff options
author | Bernd Weimer <bweimer@blackberry.com> | 2014-02-21 09:22:22 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-14 15:42:59 +0100 |
commit | 4d09a54b7559f32d4824613f90f4016e9446fbd7 (patch) | |
tree | 458fd3b06d331b7b8cc3b05d4698b2327e6a01a6 /tests/auto/gui/text/qrawfont | |
parent | da2a5ae0e4793064bba6c45f42adbee3446c350a (diff) |
QNX: Make qrawfont auto test pass
FreeType engine on QNX has the same weakness as on Windows, so some
tests are expected to fail.
Change-Id: Icd8fcafae425246ca25ad8e029bf8d6fdc7bd250
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Diffstat (limited to 'tests/auto/gui/text/qrawfont')
-rw-r--r-- | tests/auto/gui/text/qrawfont/tst_qrawfont.cpp | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp index ae6e450301..08c7148342 100644 --- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp +++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp @@ -312,16 +312,24 @@ 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); - } + + // On Windows and QNX, freetype engine returns advance of 9 for some of the glyphs + // when full hinting is used (default on Windows). + bool mayFail = false; +#if defined (Q_OS_WIN) + mayFail = font_d->fontEngine->type() == QFontEngine::Freetype + && (hintingPreference == QFont::PreferFullHinting + || hintingPreference == QFont::PreferDefaultHinting); +#elif defined(Q_OS_QNX) + mayFail = font_d->fontEngine->type() == QFontEngine::Freetype + && hintingPreference == QFont::PreferFullHinting; #endif + + for (int i = 0; i < glyphIndices.size(); ++i) { + if (mayFail && (i == 0 || i == 5)) { + QEXPECT_FAIL("", "FreeType engine reports unexpected advance " + "for some glyphs (9 instead of 8)", Continue); + } QVERIFY(qFuzzyCompare(qRound(advances.at(i).x()), 8.0)); if (supportsSubPixelPositions) QVERIFY(advances.at(i).x() > 8.0); @@ -339,16 +347,11 @@ void tst_QRawFont::advances() QVERIFY(font.advancesForGlyphIndexes(glyphIndices.constData(), advances.data(), numGlyphs)); - 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); + for (int i = 0; i < glyphIndices.size(); ++i) { + if (mayFail && (i == 0 || i == 5)) { + QEXPECT_FAIL("", "FreeType engine reports unexpected advance " + "for some glyphs (9 instead of 8)", Continue); } -#endif QVERIFY(qFuzzyCompare(qRound(advances.at(i).x()), 8.0)); if (supportsSubPixelPositions) QVERIFY(advances.at(i).x() > 8.0); |