From 0cf6baa2d61ebaad2a2a0530c37f27e719b68f4b Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Fri, 30 Sep 2011 13:19:21 +1000 Subject: Avoid using QSKIP in lieu of compile-time checks QSKIP is intended to be used to skip test functions that are found at run-time to be inapplicable or unsafe. If a test function can be determined to be inapplicable at compile-time, the entire test function should be omitted instead of replacing the body of the test function with a QSKIP, which only serves to slow down test runs and to inflate test run-rates with empty, inapplicable tests. Task-number: QTQAINFRA-278 Change-Id: I31e069f5476f8adf9851e94b33c6afac4394b88e Reviewed-on: http://codereview.qt-project.org/5824 Reviewed-by: Qt Sanity Bot Reviewed-by: Rohan McGovern --- .../qtextscriptengine/tst_qtextscriptengine.cpp | 99 ++++++++-------------- 1 file changed, 36 insertions(+), 63 deletions(-) (limited to 'tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp') diff --git a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp index cbed675cb7..7f30009e56 100644 --- a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp +++ b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp @@ -90,6 +90,7 @@ public slots: void init(); void cleanup(); private slots: +#ifdef Q_WS_X11 void devanagari(); void bengali(); void gurmukhi(); @@ -105,10 +106,15 @@ private slots: void khmer(); void linearB(); void controlInSyllable_qtbug14204(); +#endif +#if (defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)) || defined(Q_WS_X11) void combiningMarks_qtbug15675(); +#endif +#ifndef Q_WS_MAC void mirroredChars_data(); void mirroredChars(); +#endif private: bool haveTestFonts; @@ -198,9 +204,9 @@ static bool shaping( const QFont &f, const ShapeTable *s) } #endif +#ifdef Q_WS_X11 void tst_QTextScriptEngine::devanagari() { -#if defined(Q_WS_X11) if (!haveTestFonts) { QSKIP("Test fonts are not available", SkipAll); } @@ -309,14 +315,12 @@ void tst_QTextScriptEngine::devanagari() QSKIP("couldn't find mangal", SkipAll); } } -#else - QSKIP("X11 specific test", SkipAll); -#endif } +#endif +#ifdef Q_WS_X11 void tst_QTextScriptEngine::bengali() { -#if defined(Q_WS_X11) if (!haveTestFonts) { QSKIP("Test fonts are not available", SkipAll); } @@ -564,14 +568,12 @@ void tst_QTextScriptEngine::bengali() QSKIP("couldn't find Likhan", SkipAll); } } -#else - QSKIP("X11 specific test", SkipAll); -#endif } +#endif +#ifdef Q_WS_X11 void tst_QTextScriptEngine::gurmukhi() { -#if defined(Q_WS_X11) if (!haveTestFonts) { QSKIP("Test fonts are not available", SkipAll); } @@ -595,12 +597,12 @@ void tst_QTextScriptEngine::gurmukhi() QSKIP("couldn't find Lohit Punjabi", SkipAll); } } -#endif } +#endif +#ifdef Q_WS_X11 void tst_QTextScriptEngine::oriya() { -#if defined(Q_WS_X11) if (!haveTestFonts) { QSKIP("Test fonts are not available", SkipAll); } @@ -636,15 +638,12 @@ void tst_QTextScriptEngine::oriya() QSKIP("couldn't find utkal", SkipAll); } } -#else - QSKIP("X11 specific test", SkipAll); -#endif } +#endif - +#ifdef Q_WS_X11 void tst_QTextScriptEngine::tamil() { -#if defined(Q_WS_X11) if (!haveTestFonts) { QSKIP("Test fonts are not available", SkipAll); } @@ -717,15 +716,12 @@ void tst_QTextScriptEngine::tamil() QSKIP("couldn't find AkrutiTml1", SkipAll); } } -#else - QSKIP("X11 specific test", SkipAll); -#endif } +#endif - +#ifdef Q_WS_X11 void tst_QTextScriptEngine::telugu() { -#if defined(Q_WS_X11) if (!haveTestFonts) { QSKIP("Test fonts are not available", SkipAll); } @@ -769,15 +765,12 @@ void tst_QTextScriptEngine::telugu() QSKIP("couldn't find Pothana2000", SkipAll); } } -#else - QSKIP("X11 specific test", SkipAll); -#endif } +#endif - +#ifdef Q_WS_X11 void tst_QTextScriptEngine::kannada() { -#if defined(Q_WS_X11) { if (QFontDatabase().families(QFontDatabase::Kannada).contains("Sampige")) { QFont f("Sampige"); @@ -847,16 +840,12 @@ void tst_QTextScriptEngine::kannada() QSKIP("couldn't find Tunga", SkipAll); } } -#else - QSKIP("X11 specific test", SkipAll); -#endif } +#endif - - +#ifdef Q_WS_X11 void tst_QTextScriptEngine::malayalam() { -#if defined(Q_WS_X11) if (!haveTestFonts) { QSKIP("Test fonts are not available", SkipAll); } @@ -940,15 +929,12 @@ void tst_QTextScriptEngine::malayalam() QSKIP("couldn't find Rachana", SkipAll); } } - -#else - QSKIP("X11 specific test", SkipAll); -#endif } +#endif +#ifdef Q_WS_X11 void tst_QTextScriptEngine::sinhala() { -#if defined(Q_WS_X11) if (!haveTestFonts) { QSKIP("Test fonts are not available", SkipAll); } @@ -982,15 +968,12 @@ void tst_QTextScriptEngine::sinhala() QSKIP("couldn't find Malithi Web", SkipAll); } } -#else - QSKIP("X11 specific test", SkipAll); -#endif } +#endif - +#ifdef Q_WS_X11 void tst_QTextScriptEngine::khmer() { -#if defined(Q_WS_X11) if (!haveTestFonts) { QSKIP("Test fonts are not available", SkipAll); } @@ -1030,14 +1013,12 @@ void tst_QTextScriptEngine::khmer() QSKIP("couldn't find Khmer OS", SkipAll); } } -#else - QSKIP("X11 specific test", SkipAll); -#endif } +#endif +#ifdef Q_WS_X11 void tst_QTextScriptEngine::linearB() { -#if defined(Q_WS_X11) if (!haveTestFonts) { QSKIP("Test fonts are not available", SkipAll); } @@ -1061,10 +1042,8 @@ void tst_QTextScriptEngine::linearB() QSKIP("couldn't find Penuturesu", SkipAll); } } -#else - QSKIP("X11 specific test", SkipAll); -#endif } +#endif #if defined(Q_WS_X11) static bool decomposedShaping( const QFont &f, const QChar &ch) @@ -1113,10 +1092,9 @@ static bool decomposedShaping( const QFont &f, const QChar &ch) } #endif - +#ifdef Q_WS_X11 void tst_QTextScriptEngine::greek() { -#if defined(Q_WS_X11) if (!haveTestFonts) { QSKIP("Test fonts are not available", SkipAll); } @@ -1175,14 +1153,12 @@ void tst_QTextScriptEngine::greek() QSKIP("couldn't find SBL_grk", SkipAll); } } -#else - QSKIP("X11 specific test", SkipAll); -#endif } +#endif +#if defined(Q_WS_X11) void tst_QTextScriptEngine::controlInSyllable_qtbug14204() { -#if defined(Q_WS_X11) QString s; s.append(QChar(0x0915)); s.append(QChar(0x094d)); @@ -1196,11 +1172,10 @@ void tst_QTextScriptEngine::controlInSyllable_qtbug14204() QVERIFY(e->layoutData->items[0].num_glyphs == 2); QVERIFY(e->layoutData->glyphLayout.advances_x[1] != 0); -#else - QSKIP("X11 specific test", SkipAll); -#endif } +#endif +#if (defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)) || defined(Q_WS_X11) void tst_QTextScriptEngine::combiningMarks_qtbug15675() { #if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA) @@ -1238,11 +1213,11 @@ void tst_QTextScriptEngine::combiningMarks_qtbug15675() QVERIFY(e->layoutData->items[0].num_glyphs == 3); QVERIFY(e->layoutData->glyphLayout.advances_x[1] == 0); -#else - QSKIP("X11/Mac specific test", SkipAll); #endif } +#endif +#ifndef Q_WS_MAC void tst_QTextScriptEngine::mirroredChars_data() { QTest::addColumn("hintingPreference"); @@ -1255,9 +1230,6 @@ void tst_QTextScriptEngine::mirroredChars_data() void tst_QTextScriptEngine::mirroredChars() { -#if defined(Q_WS_MAC) - QSKIP("Not supported on Mac", SkipAll); -#endif QFETCH(int, hintingPreference); QFont font; @@ -1299,6 +1271,7 @@ void tst_QTextScriptEngine::mirroredChars() QCOMPARE(glyphLayout.glyphs[1], leftParenthesis); } } +#endif QTEST_MAIN(tst_QTextScriptEngine) #include "tst_qtextscriptengine.moc" -- cgit v1.2.3