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 <qt_sanity_bot@ovi.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
This commit is contained in:
Rohan McGovern 2011-08-02 11:35:01 +10:00 committed by Qt by Nokia
parent c8ee59952a
commit af6c1a3298
2 changed files with 64 additions and 5 deletions

View File

@ -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

View File

@ -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");