summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2011-08-08 10:31:58 +1000
committerQt by Nokia <qt-info@nokia.com>2011-08-08 05:53:26 +0200
commit532ba5aa702b6b17dd7489f50c946ba1b02852c7 (patch)
treeaa5f2d54563d7387402071cc64d22abd973e79fd /tests
parent230b088c373f0d8080d730797b477a8de4418605 (diff)
test: fixed usage of QEXPECT_FAIL in tst_qglyphrun::initTestCase
The rest of this test gives unpredictable results if initTestCase fails. Normally, a failure in initTestCase skips the rest of the test, but this is not the case if QEXPECT_FAIL is used. Adjust the test to ensure the rest of it is still correctly skipped. Change-Id: I8ba76161e788f10801029ef10693e9ac275a2897 Reviewed-on: http://codereview.qt.nokia.com/2713 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qglyphrun/tst_qglyphrun.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/tests/auto/qglyphrun/tst_qglyphrun.cpp b/tests/auto/qglyphrun/tst_qglyphrun.cpp
index a5a5cd19cc..e84915428f 100644
--- a/tests/auto/qglyphrun/tst_qglyphrun.cpp
+++ b/tests/auto/qglyphrun/tst_qglyphrun.cpp
@@ -55,6 +55,7 @@ class tst_QGlyphRun: public QObject
#if !defined(QT_NO_RAWFONT)
private slots:
void initTestCase();
+ void init();
void cleanupTestCase();
void constructionAndDestruction();
@@ -78,6 +79,7 @@ private slots:
private:
int m_testFontId;
QFont m_testFont;
+ bool m_testFont_ok;
#endif // QT_NO_RAWFONT
};
@@ -88,16 +90,27 @@ Q_DECLARE_METATYPE(QGlyphRun);
void tst_QGlyphRun::initTestCase()
{
+ m_testFont_ok = false;
+
m_testFontId = QFontDatabase::addApplicationFont(SRCDIR "test.ttf");
QVERIFY(m_testFontId >= 0);
m_testFont = QFont("QtsSpecialTestFont");
#ifdef Q_WS_QPA
- QEXPECT_FAIL("", "QTBUG-20760 fails on qpa", Continue);
+ QEXPECT_FAIL("", "QTBUG-20760 fails on qpa", Abort);
#endif
QCOMPARE(QFontInfo(m_testFont).family(), QString::fromLatin1("QtsSpecialTestFont"));
+
+ m_testFont_ok = true;
+}
+
+void tst_QGlyphRun::init()
+{
+ if (!m_testFont_ok) {
+ QSKIP("Test font is not working correctly", SkipAll);
+ }
}
void tst_QGlyphRun::cleanupTestCase()
@@ -242,10 +255,6 @@ void tst_QGlyphRun::textLayoutGlyphIndexes()
QList<QGlyphRun> listOfGlyphs = layout.glyphRuns();
-#ifdef Q_WS_QPA
- QEXPECT_FAIL("", "QTBUG-20760 fails on qpa", Abort);
-#endif
-
QCOMPARE(listOfGlyphs.size(), 1);
QGlyphRun glyphs = listOfGlyphs.at(0);
@@ -292,10 +301,6 @@ void tst_QGlyphRun::drawExistingGlyphs()
drawGlyphs.save("drawExistingGlyphs_drawGlyphIndexes.png");
#endif
-#ifdef Q_WS_QPA
- QEXPECT_FAIL("", "QTBUG-20760 fails on qpa", Continue);
-#endif
-
QCOMPARE(textLayoutDraw, drawGlyphs);
}