From: Rohan McGovern Date: Tue, 2 Aug 2011 01:35:01 +0000 (+1000) Subject: test: skip some tst_qtextscriptengine tests when fonts are missing X-Git-Tag: qt-v5.0.0-alpha1~3877 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af6c1a32982564035f3f9d1c0887c9d3fc0e5bbb;p=profile%2Fivi%2Fqtbase.git test: skip some tst_qtextscriptengine tests when fonts are missing This autotest may fail depending on the version of fonts which are installed on the system. It has no way to verify if the correct fonts are installed, and it's unclear from where the correct version of the fonts may be obtained. Therefore, disable the test by default unless the user has indicated that they have a correct setup by setting QT_HAVE_TEST_FONTS=1. Task-number: QTBUG-20682 Change-Id: I24174520f54af6a9b2c13c9c1347f46555bce3d4 Reviewed-on: http://codereview.qt.nokia.com/2469 Reviewed-by: Qt Sanity Bot Reviewed-by: Eskil Abrahamsen Blomfeldt --- diff --git a/tests/auto/qtextscriptengine/qtextscriptengine.pro b/tests/auto/qtextscriptengine/qtextscriptengine.pro index 1bd80d3..0f5076e 100644 --- a/tests/auto/qtextscriptengine/qtextscriptengine.pro +++ b/tests/auto/qtextscriptengine/qtextscriptengine.pro @@ -5,5 +5,3 @@ QT += core-private gui-private HEADERS += SOURCES += tst_qtextscriptengine.cpp INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/harfbuzz/src - -CONFIG+=insignificant_test diff --git a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp index 11a9c60..cbed675 100644 --- a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp +++ b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp @@ -76,9 +76,6 @@ //TESTED_CLASS= //TESTED_FILES= gui/text/qscriptengine.cpp -// This test depends on the fonts in the following package being installed: -// http://people.freedesktop.org/~hausmann/harfbuzz-test-fonts-0.1.tar.bz2 - class tst_QTextScriptEngine : public QObject { Q_OBJECT @@ -89,6 +86,7 @@ public: public slots: + void initTestCase(); void init(); void cleanup(); private slots: @@ -111,9 +109,13 @@ private slots: void mirroredChars_data(); void mirroredChars(); + +private: + bool haveTestFonts; }; tst_QTextScriptEngine::tst_QTextScriptEngine() + : haveTestFonts(qgetenv("QT_HAVE_TEST_FONTS") == QByteArray("1")) { } @@ -121,6 +123,21 @@ tst_QTextScriptEngine::~tst_QTextScriptEngine() { } +void tst_QTextScriptEngine::initTestCase() +{ +#if defined(Q_WS_X11) + if (!haveTestFonts) { + qWarning( + "Some of these tests depend on the internals of some test fonts which are not freely " + "distributable.\n" + "These tests will be skipped.\n" + "If you have the fonts available, set QT_HAVE_TEST_FONTS=1 in your environment and " + "run the test again." + ); + } +#endif +} + void tst_QTextScriptEngine::init() { } @@ -184,6 +201,10 @@ static bool shaping( const QFont &f, const ShapeTable *s) void tst_QTextScriptEngine::devanagari() { #if defined(Q_WS_X11) + if (!haveTestFonts) { + QSKIP("Test fonts are not available", SkipAll); + } + { if (QFontDatabase().families(QFontDatabase::Devanagari).contains("Raghindi")) { QFont f("Raghindi"); @@ -296,6 +317,10 @@ void tst_QTextScriptEngine::devanagari() void tst_QTextScriptEngine::bengali() { #if defined(Q_WS_X11) + if (!haveTestFonts) { + QSKIP("Test fonts are not available", SkipAll); + } + { if (QFontDatabase().families(QFontDatabase::Bengali).contains("Akaash")) { QFont f("Akaash"); @@ -547,6 +572,10 @@ void tst_QTextScriptEngine::bengali() void tst_QTextScriptEngine::gurmukhi() { #if defined(Q_WS_X11) + if (!haveTestFonts) { + QSKIP("Test fonts are not available", SkipAll); + } + { if (QFontDatabase().families(QFontDatabase::Gurmukhi).contains("Lohit Punjabi")) { QFont f("Lohit Punjabi"); @@ -572,6 +601,10 @@ void tst_QTextScriptEngine::gurmukhi() void tst_QTextScriptEngine::oriya() { #if defined(Q_WS_X11) + if (!haveTestFonts) { + QSKIP("Test fonts are not available", SkipAll); + } + { if (QFontDatabase().families(QFontDatabase::Oriya).contains("utkal")) { QFont f("utkal"); @@ -612,6 +645,10 @@ void tst_QTextScriptEngine::oriya() void tst_QTextScriptEngine::tamil() { #if defined(Q_WS_X11) + if (!haveTestFonts) { + QSKIP("Test fonts are not available", SkipAll); + } + { if (QFontDatabase().families(QFontDatabase::Tamil).contains("AkrutiTml1")) { QFont f("AkrutiTml1"); @@ -689,6 +726,10 @@ void tst_QTextScriptEngine::tamil() void tst_QTextScriptEngine::telugu() { #if defined(Q_WS_X11) + if (!haveTestFonts) { + QSKIP("Test fonts are not available", SkipAll); + } + { if (QFontDatabase().families(QFontDatabase::Telugu).contains("Pothana2000")) { QFont f("Pothana2000"); @@ -816,6 +857,10 @@ void tst_QTextScriptEngine::kannada() void tst_QTextScriptEngine::malayalam() { #if defined(Q_WS_X11) + if (!haveTestFonts) { + QSKIP("Test fonts are not available", SkipAll); + } + { if (QFontDatabase().families(QFontDatabase::Malayalam).contains("AkrutiMal2")) { QFont f("AkrutiMal2"); @@ -904,6 +949,10 @@ void tst_QTextScriptEngine::malayalam() void tst_QTextScriptEngine::sinhala() { #if defined(Q_WS_X11) + if (!haveTestFonts) { + QSKIP("Test fonts are not available", SkipAll); + } + { if (QFontDatabase().families(QFontDatabase::Sinhala).contains("Malithi Web")) { QFont f("Malithi Web"); @@ -942,6 +991,10 @@ void tst_QTextScriptEngine::sinhala() void tst_QTextScriptEngine::khmer() { #if defined(Q_WS_X11) + if (!haveTestFonts) { + QSKIP("Test fonts are not available", SkipAll); + } + { if (QFontDatabase().families(QFontDatabase::Khmer).contains("Khmer OS")) { QFont f("Khmer OS"); @@ -985,6 +1038,10 @@ void tst_QTextScriptEngine::khmer() void tst_QTextScriptEngine::linearB() { #if defined(Q_WS_X11) + if (!haveTestFonts) { + QSKIP("Test fonts are not available", SkipAll); + } + { if (QFontDatabase().families(QFontDatabase::Any).contains("Penuturesu")) { QFont f("Penuturesu"); @@ -1060,6 +1117,10 @@ static bool decomposedShaping( const QFont &f, const QChar &ch) void tst_QTextScriptEngine::greek() { #if defined(Q_WS_X11) + if (!haveTestFonts) { + QSKIP("Test fonts are not available", SkipAll); + } + { if (QFontDatabase().families(QFontDatabase::Any).contains("DejaVu Sans")) { QFont f("DejaVu Sans");