From e746e2a11a1fb0b4603df3d8740b09b362116698 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 10 Jul 2014 12:04:49 +0200 Subject: Android: Fix tests in gui/text requiring test data Several tests require test data to be deployed with the application. The easiest way to achieve this on Android is to add them to a qrc file and use the QFINDTESTDATA macro to look up the files. This fixes several test failures in the gui/text subdirectory for Android. Change-Id: If944bb1fc93434a1b2d6487da829d21bd6b84e87 Reviewed-by: BogDan Vatra --- tests/auto/gui/text/qcssparser/qcssparser.pro | 5 +++++ tests/auto/gui/text/qcssparser/testdata.qrc | 18 ++++++++++++++++++ tests/auto/gui/text/qcssparser/tst_qcssparser.cpp | 4 +++- tests/auto/gui/text/qglyphrun/qglyphrun.pro | 12 +++++++++--- tests/auto/gui/text/qglyphrun/testdata.qrc | 5 +++++ tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp | 2 +- tests/auto/gui/text/qrawfont/qrawfont.pro | 5 +++++ tests/auto/gui/text/qrawfont/testdata.qrc | 6 ++++++ tests/auto/gui/text/qzip/qzip.pro | 8 +++++--- tests/auto/gui/text/qzip/testdata.qrc | 6 ++++++ tests/auto/gui/text/qzip/tst_qzip.cpp | 4 ++-- 11 files changed, 65 insertions(+), 10 deletions(-) create mode 100644 tests/auto/gui/text/qcssparser/testdata.qrc create mode 100644 tests/auto/gui/text/qglyphrun/testdata.qrc create mode 100644 tests/auto/gui/text/qrawfont/testdata.qrc create mode 100644 tests/auto/gui/text/qzip/testdata.qrc (limited to 'tests/auto') diff --git a/tests/auto/gui/text/qcssparser/qcssparser.pro b/tests/auto/gui/text/qcssparser/qcssparser.pro index 346a38d5f6..bb0c8c4f40 100644 --- a/tests/auto/gui/text/qcssparser/qcssparser.pro +++ b/tests/auto/gui/text/qcssparser/qcssparser.pro @@ -15,3 +15,8 @@ wince* { DEPLOYMENT += addFiles timesFont } +android { + RESOURCES += \ + testdata.qrc + +} diff --git a/tests/auto/gui/text/qcssparser/testdata.qrc b/tests/auto/gui/text/qcssparser/testdata.qrc new file mode 100644 index 0000000000..56e45cfbb0 --- /dev/null +++ b/tests/auto/gui/text/qcssparser/testdata.qrc @@ -0,0 +1,18 @@ + + + testdata/scanner/comments/input + testdata/scanner/comments/output + testdata/scanner/comments2/input + testdata/scanner/comments2/output + testdata/scanner/comments3/input + testdata/scanner/comments3/output + testdata/scanner/comments4/input + testdata/scanner/comments4/output + testdata/scanner/quotedstring/input + testdata/scanner/quotedstring/output + testdata/scanner/simple/input + testdata/scanner/simple/output + testdata/scanner/unicode/input + testdata/scanner/unicode/output + + diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp index 86e282fad2..719ca5a0a7 100644 --- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp @@ -130,7 +130,9 @@ void tst_QCssParser::scanner_data() QTest::addColumn("input"); QTest::addColumn("output"); -#if !defined(Q_OS_IRIX) && !defined(Q_OS_WINCE) +#if defined(Q_OS_ANDROID) + QDir d(":/"); +#elif !defined(Q_OS_IRIX) && !defined(Q_OS_WINCE) QDir d(SRCDIR); #else QDir d(QDir::current()); diff --git a/tests/auto/gui/text/qglyphrun/qglyphrun.pro b/tests/auto/gui/text/qglyphrun/qglyphrun.pro index db28a690a7..0993a5c49c 100644 --- a/tests/auto/gui/text/qglyphrun/qglyphrun.pro +++ b/tests/auto/gui/text/qglyphrun/qglyphrun.pro @@ -8,8 +8,14 @@ linux: CONFIG += insignificant_test SOURCES += \ tst_qglyphrun.cpp +android { + RESOURCES += \ + testdata.qrc +} + wince* { - DEFINES += SRCDIR=\\\"\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" + additionalFiles.files = test.ttf + additionalFiles.path = . + DEPLOYMENT += additionalFiles } + diff --git a/tests/auto/gui/text/qglyphrun/testdata.qrc b/tests/auto/gui/text/qglyphrun/testdata.qrc new file mode 100644 index 0000000000..c4e237ad2f --- /dev/null +++ b/tests/auto/gui/text/qglyphrun/testdata.qrc @@ -0,0 +1,5 @@ + + + test.ttf + + diff --git a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp index 3d2cde5fd3..f576627745 100644 --- a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp +++ b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp @@ -94,7 +94,7 @@ void tst_QGlyphRun::initTestCase() { m_testFont_ok = false; - m_testFontId = QFontDatabase::addApplicationFont(SRCDIR "test.ttf"); + m_testFontId = QFontDatabase::addApplicationFont(QFINDTESTDATA("test.ttf")); QVERIFY(m_testFontId >= 0); m_testFont = QFont("QtsSpecialTestFont"); diff --git a/tests/auto/gui/text/qrawfont/qrawfont.pro b/tests/auto/gui/text/qrawfont/qrawfont.pro index 540ffb94d7..1891e7a9bf 100644 --- a/tests/auto/gui/text/qrawfont/qrawfont.pro +++ b/tests/auto/gui/text/qrawfont/qrawfont.pro @@ -8,3 +8,8 @@ SOURCES += \ tst_qrawfont.cpp TESTDATA += testfont_bold_italic.ttf testfont.ttf + +android { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/gui/text/qrawfont/testdata.qrc b/tests/auto/gui/text/qrawfont/testdata.qrc new file mode 100644 index 0000000000..7bea0d5a39 --- /dev/null +++ b/tests/auto/gui/text/qrawfont/testdata.qrc @@ -0,0 +1,6 @@ + + + testfont_bold_italic.ttf + testfont.ttf + + diff --git a/tests/auto/gui/text/qzip/qzip.pro b/tests/auto/gui/text/qzip/qzip.pro index 309f2167d1..ebcd6ec022 100644 --- a/tests/auto/gui/text/qzip/qzip.pro +++ b/tests/auto/gui/text/qzip/qzip.pro @@ -7,7 +7,9 @@ wince* { addFiles.files = testdata addFiles.path = . DEPLOYMENT += addFiles - DEFINES += SRCDIR=\\\".\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD\\\" +} + +android { + RESOURCES += \ + testdata.qrc } diff --git a/tests/auto/gui/text/qzip/testdata.qrc b/tests/auto/gui/text/qzip/testdata.qrc new file mode 100644 index 0000000000..c7e3a6b14e --- /dev/null +++ b/tests/auto/gui/text/qzip/testdata.qrc @@ -0,0 +1,6 @@ + + + testdata/symlink.zip + testdata/test.zip + + diff --git a/tests/auto/gui/text/qzip/tst_qzip.cpp b/tests/auto/gui/text/qzip/tst_qzip.cpp index c5ce6c2676..9a5c4aaab9 100644 --- a/tests/auto/gui/text/qzip/tst_qzip.cpp +++ b/tests/auto/gui/text/qzip/tst_qzip.cpp @@ -68,7 +68,7 @@ void tst_QZip::cleanup() void tst_QZip::basicUnpack() { - QZipReader zip(QString(SRCDIR) + "/testdata/test.zip", QIODevice::ReadOnly); + QZipReader zip(QFINDTESTDATA("/testdata/test.zip"), QIODevice::ReadOnly); QList files = zip.fileInfoList(); QCOMPARE(files.count(), 2); @@ -104,7 +104,7 @@ void tst_QZip::basicUnpack() void tst_QZip::symlinks() { - QZipReader zip(QString(SRCDIR) + "/testdata/symlink.zip", QIODevice::ReadOnly); + QZipReader zip(QFINDTESTDATA("/testdata/symlink.zip"), QIODevice::ReadOnly); QList files = zip.fileInfoList(); QCOMPARE(files.count(), 2); -- cgit v1.2.3