From 4d09a54b7559f32d4824613f90f4016e9446fbd7 Mon Sep 17 00:00:00 2001 From: Bernd Weimer Date: Fri, 21 Feb 2014 09:22:22 +0100 Subject: [PATCH] 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 Reviewed-by: Rafael Roquetto --- tests/auto/gui/text/qrawfont/tst_qrawfont.cpp | 39 ++++++++++--------- 1 file 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 advances = font.advancesForGlyphIndexes(glyphIndices); - for (int i=0; ifontEngine->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; ifontEngine->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);