summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>2014-07-10 12:04:49 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>2014-07-21 09:49:09 +0200
commite746e2a11a1fb0b4603df3d8740b09b362116698 (patch)
treef443a778bfa933dec1c76667e2cc21e0783695b0
parent8b8eebd8a41bd91aeb5b55b702a4dbc7a8db5752 (diff)
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 <bogdan@kde.org>
-rw-r--r--tests/auto/gui/text/qcssparser/qcssparser.pro5
-rw-r--r--tests/auto/gui/text/qcssparser/testdata.qrc18
-rw-r--r--tests/auto/gui/text/qcssparser/tst_qcssparser.cpp4
-rw-r--r--tests/auto/gui/text/qglyphrun/qglyphrun.pro12
-rw-r--r--tests/auto/gui/text/qglyphrun/testdata.qrc5
-rw-r--r--tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp2
-rw-r--r--tests/auto/gui/text/qrawfont/qrawfont.pro5
-rw-r--r--tests/auto/gui/text/qrawfont/testdata.qrc6
-rw-r--r--tests/auto/gui/text/qzip/qzip.pro8
-rw-r--r--tests/auto/gui/text/qzip/testdata.qrc6
-rw-r--r--tests/auto/gui/text/qzip/tst_qzip.cpp4
11 files changed, 65 insertions, 10 deletions
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 @@
+<RCC>
+ <qresource prefix="/">
+ <file>testdata/scanner/comments/input</file>
+ <file>testdata/scanner/comments/output</file>
+ <file>testdata/scanner/comments2/input</file>
+ <file>testdata/scanner/comments2/output</file>
+ <file>testdata/scanner/comments3/input</file>
+ <file>testdata/scanner/comments3/output</file>
+ <file>testdata/scanner/comments4/input</file>
+ <file>testdata/scanner/comments4/output</file>
+ <file>testdata/scanner/quotedstring/input</file>
+ <file>testdata/scanner/quotedstring/output</file>
+ <file>testdata/scanner/simple/input</file>
+ <file>testdata/scanner/simple/output</file>
+ <file>testdata/scanner/unicode/input</file>
+ <file>testdata/scanner/unicode/output</file>
+ </qresource>
+</RCC>
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<QString>("input");
QTest::addColumn<QString>("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 @@
+<RCC>
+ <qresource prefix="/">
+ <file>test.ttf</file>
+ </qresource>
+</RCC>
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 @@
+<RCC>
+ <qresource prefix="/">
+ <file>testfont_bold_italic.ttf</file>
+ <file>testfont.ttf</file>
+ </qresource>
+</RCC>
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 @@
+<RCC>
+ <qresource prefix="/">
+ <file>testdata/symlink.zip</file>
+ <file>testdata/test.zip</file>
+ </qresource>
+</RCC>
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<QZipReader::FileInfo> 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<QZipReader::FileInfo> files = zip.fileInfoList();
QCOMPARE(files.count(), 2);