From 6d50f746fe05a7008b63818e77784dd0c99270a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Otto=20Ryyn=C3=A4nen?= Date: Fri, 2 Jun 2017 12:53:23 +0300 Subject: Support for Q_OS_ANDROID_EMBEDDED and android-embedded build flags The Embedded Android build (Boot to Qt Android injection) is defined by having both Q_OS_ANDROID and Q_OS_ANDROID_EMBEDDED flags defined, as well as having Qt config android-embedded. This commit enables the possibility to build embedded Android builds. (i.e. Qt build for Android baselayer only, without JNI) Change-Id: I8406e959fdf1c8d9efebbbe53f1a391fa25f336a Reviewed-by: Oswald Buddenhagen Reviewed-by: Paul Olav Tvete --- tests/auto/corelib/io/qdatastream/qdatastream.pro | 2 +- tests/auto/corelib/io/qdir/qdir.pro | 2 +- tests/auto/corelib/io/qdir/tst_qdir.cpp | 6 +++--- tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp | 2 +- tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp | 4 ++-- .../auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp | 2 +- tests/auto/corelib/io/qiodevice/qiodevice.pro | 2 +- tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp | 2 +- tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp | 2 +- tests/auto/corelib/io/qloggingregistry/qloggingregistry.pro | 2 +- tests/auto/corelib/io/qresourceengine/qresourceengine.pro | 2 +- tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp | 6 +++--- tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp | 2 +- tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro | 2 +- tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp | 8 ++++---- tests/auto/corelib/kernel/qtranslator/qtranslator.pro | 2 +- tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp | 2 +- tests/auto/corelib/tools/qbytearray/qbytearray.pro | 2 +- tests/auto/corelib/tools/qchar/qchar.pro | 2 +- tests/auto/corelib/tools/qcollator/tst_qcollator.cpp | 2 +- .../corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp | 6 +++--- .../auto/corelib/tools/qcryptographichash/qcryptographichash.pro | 2 +- .../corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro | 2 +- tests/auto/gui/image/qimage/qimage.pro | 2 +- tests/auto/gui/image/qimagereader/qimagereader.pro | 2 +- tests/auto/gui/image/qimagewriter/qimagewriter.pro | 2 +- tests/auto/gui/painting/qpainter/qpainter.pro | 2 +- .../qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp | 2 +- tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp | 2 +- .../widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp | 6 +++--- tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro | 2 +- tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp | 4 ++-- tests/auto/widgets/kernel/qlayout/qlayout.pro | 2 +- tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp | 2 +- tests/auto/widgets/styles/qstyle/qstyle.pro | 2 +- 35 files changed, 48 insertions(+), 48 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/io/qdatastream/qdatastream.pro b/tests/auto/corelib/io/qdatastream/qdatastream.pro index 291b3eb611..25f8b889a0 100644 --- a/tests/auto/corelib/io/qdatastream/qdatastream.pro +++ b/tests/auto/corelib/io/qdatastream/qdatastream.pro @@ -5,7 +5,7 @@ SOURCES = tst_qdatastream.cpp TESTDATA += datastream.q42 -android { +android:!android-embedded { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/corelib/io/qdir/qdir.pro b/tests/auto/corelib/io/qdir/qdir.pro index 4870922312..2252e71cd8 100644 --- a/tests/auto/corelib/io/qdir/qdir.pro +++ b/tests/auto/corelib/io/qdir/qdir.pro @@ -8,6 +8,6 @@ TESTDATA += testdir testData searchdir resources entrylist types tst_qdir.cpp contains(CONFIG, builtin_testdata): DEFINES += BUILTIN_TESTDATA -android { +android:!android-embedded { RESOURCES += android_testdata.qrc } diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 8dbac28183..9d47bb2884 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -228,13 +228,13 @@ private: Q_DECLARE_METATYPE(tst_QDir::UncHandling) tst_QDir::tst_QDir() -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) : m_dataPath(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)) #elif !defined(BUILTIN_TESTDATA) : m_dataPath(QFileInfo(QFINDTESTDATA("testData")).absolutePath()) #endif { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QString resourceSourcePath = QStringLiteral(":/android_testdata/"); QDirIterator it(resourceSourcePath, QDirIterator::Subdirectories); while (it.hasNext()) { @@ -2186,7 +2186,7 @@ void tst_QDir::equalityOperator_data() QString pathinroot(QDir::rootPath() + QLatin1String("assets/..")); #elif defined (Q_OS_WIN) QString pathinroot("c:/windows/.."); -#elif defined(Q_OS_ANDROID) +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QString pathinroot("/system/.."); #elif defined(Q_OS_HAIKU) QString pathinroot("/boot/.."); diff --git a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp index 6450e9af7b..a55989aacd 100644 --- a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp +++ b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp @@ -118,7 +118,7 @@ private: void tst_QDirIterator::initTestCase() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QString testdata_dir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); QString resourceSourcePath = QStringLiteral(":/"); QDirIterator it(resourceSourcePath, QDirIterator::Subdirectories); diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index efb261ce7e..38db4c7b63 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -1200,7 +1200,7 @@ void tst_QFileInfo::fileTimes() QEXPECT_FAIL("", "WinRT does not allow timestamp handling change in the filesystem due to sandboxing", Continue); #elif defined(Q_OS_QNX) QEXPECT_FAIL("", "QNX uses the noatime filesystem option", Continue); -#elif defined(Q_OS_ANDROID) +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) if (fileInfo.lastRead() <= beforeRead) QEXPECT_FAIL("", "Android may use relatime or noatime on mounts", Continue); #endif @@ -1664,7 +1664,7 @@ void tst_QFileInfo::isWritable() void tst_QFileInfo::isExecutable() { QString appPath = QCoreApplication::applicationDirPath(); -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) appPath += "/libtst_qfileinfo.so"; #else appPath += "/tst_qfileinfo"; diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index 154c7ec5bf..b05a876a52 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -89,7 +89,7 @@ tst_QFileSystemWatcher::tst_QFileSystemWatcher() m_tempDirPattern += QStringLiteral("tst_qfilesystemwatcherXXXXXX"); #endif // QT_NO_FILESYSTEMWATCHER -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); #endif } diff --git a/tests/auto/corelib/io/qiodevice/qiodevice.pro b/tests/auto/corelib/io/qiodevice/qiodevice.pro index 945022a289..1c978953d6 100644 --- a/tests/auto/corelib/io/qiodevice/qiodevice.pro +++ b/tests/auto/corelib/io/qiodevice/qiodevice.pro @@ -6,7 +6,7 @@ SOURCES = tst_qiodevice.cpp TESTDATA += tst_qiodevice.cpp MOC_DIR=tmp -android { +android:!android-embedded { RESOURCES += \ android_testdata.qrc } diff --git a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp index a76fd4703e..9e0b9c2329 100644 --- a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp +++ b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp @@ -66,7 +66,7 @@ private: void tst_QIODevice::initTestCase() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QVERIFY(QFileInfo(QStringLiteral("./tst_qiodevice.cpp")).exists() || QFile::copy(QStringLiteral(":/tst_qiodevice.cpp"), QStringLiteral("./tst_qiodevice.cpp"))); #endif diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp index d2f345feb5..59196dc40b 100644 --- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp +++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp @@ -72,7 +72,7 @@ public: void tst_QLockFile::initTestCase() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QSKIP("This test requires deploying and running external console applications"); #elif !QT_CONFIG(process) QSKIP("This test requires QProcess support"); diff --git a/tests/auto/corelib/io/qloggingregistry/qloggingregistry.pro b/tests/auto/corelib/io/qloggingregistry/qloggingregistry.pro index 287ab30993..ac976e9b9c 100644 --- a/tests/auto/corelib/io/qloggingregistry/qloggingregistry.pro +++ b/tests/auto/corelib/io/qloggingregistry/qloggingregistry.pro @@ -7,7 +7,7 @@ QT = core core-private testlib SOURCES += tst_qloggingregistry.cpp TESTDATA += qtlogging.ini -android { +android:!android-embedded { RESOURCES += \ android_testdata.qrc } diff --git a/tests/auto/corelib/io/qresourceengine/qresourceengine.pro b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro index 658201e03a..f937d23fe2 100644 --- a/tests/auto/corelib/io/qresourceengine/qresourceengine.pro +++ b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro @@ -18,6 +18,6 @@ TESTDATA += \ testqrc/* GENERATED_TESTDATA = $${runtime_resource.target} -android { +android:!android-embedded { RESOURCES += android_testdata.qrc } diff --git a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp index 7fdd00876f..ab1866fb2d 100644 --- a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp +++ b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp @@ -36,7 +36,7 @@ class tst_QResourceEngine: public QObject public: tst_QResourceEngine() -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) : m_runtimeResourceRcc(QFileInfo(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/runtime_resource.rcc")).absoluteFilePath()) #else : m_runtimeResourceRcc(QFINDTESTDATA("runtime_resource.rcc")) @@ -64,7 +64,7 @@ private: void tst_QResourceEngine::initTestCase() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QString sourcePath(QStringLiteral(":/android_testdata/")); QString dataPath(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); @@ -121,7 +121,7 @@ void tst_QResourceEngine::checkStructure_data() << QLatin1String("test") << QLatin1String("withoutslashes"); -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) rootContents.insert(1, QLatin1String("android_testdata")); #endif diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp index 4cb3bfe549..21936faca5 100644 --- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp +++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp @@ -288,7 +288,7 @@ void tst_QTemporaryDir::nonWritableCurrentDir() { #ifdef Q_OS_UNIX -# if defined(Q_OS_ANDROID) +# if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) const char nonWritableDir[] = "/data"; # else const char nonWritableDir[] = "/home"; diff --git a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro index e17cb05cd8..11a5d58dc8 100644 --- a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro +++ b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro @@ -5,6 +5,6 @@ SOURCES = tst_qtemporaryfile.cpp TESTDATA += tst_qtemporaryfile.cpp RESOURCES += qtemporaryfile.qrc -android { +android:!android-embedded { RESOURCES += android_testdata.qrc } diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp index 64b61839c1..a4e7aa0316 100644 --- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp @@ -99,7 +99,7 @@ void tst_QTemporaryFile::initTestCase() QVERIFY(QDir("test-XXXXXX").exists() || QDir().mkdir("test-XXXXXX")); QCoreApplication::setApplicationName("tst_qtemporaryfile"); -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QString sourceDir(":/android_testdata/"); QDirIterator it(sourceDir, QDirIterator::Subdirectories); while (it.hasNext()) { @@ -323,7 +323,7 @@ void tst_QTemporaryFile::nonWritableCurrentDir() ChdirOnReturn cor(QDir::currentPath()); -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QDir::setCurrent("/data"); #else QDir::setCurrent("/home"); @@ -492,7 +492,7 @@ void tst_QTemporaryFile::renameFdLeak() { #ifdef Q_OS_UNIX -# if defined(Q_OS_ANDROID) +# if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) ChdirOnReturn cor(QDir::currentPath()); QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); # endif @@ -701,7 +701,7 @@ void tst_QTemporaryFile::createNativeFile_data() QTest::addColumn("valid"); QTest::addColumn("content"); -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) const QString nativeFilePath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/resources/test.txt"); #else const QString nativeFilePath = QFINDTESTDATA("resources/test.txt"); diff --git a/tests/auto/corelib/kernel/qtranslator/qtranslator.pro b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro index e673278920..d8924c2d5f 100644 --- a/tests/auto/corelib/kernel/qtranslator/qtranslator.pro +++ b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro @@ -4,6 +4,6 @@ QT = core testlib SOURCES = tst_qtranslator.cpp RESOURCES += qtranslator.qrc -android: RESOURCES += android_testdata.qrc +android:!android-embedded: RESOURCES += android_testdata.qrc else: TESTDATA += dependencies_la.qm hellotr_la.qm msgfmt_from_po.qm diff --git a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp index 66971af7b4..e3eee6dbdd 100644 --- a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp +++ b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp @@ -64,7 +64,7 @@ tst_QTranslator::tst_QTranslator() void tst_QTranslator::initTestCase() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QString sourceDir(":/android_testdata/"); QDirIterator it(sourceDir, QDirIterator::Subdirectories); while (it.hasNext()) { diff --git a/tests/auto/corelib/tools/qbytearray/qbytearray.pro b/tests/auto/corelib/tools/qbytearray/qbytearray.pro index f59cdf3524..c2101b0611 100644 --- a/tests/auto/corelib/tools/qbytearray/qbytearray.pro +++ b/tests/auto/corelib/tools/qbytearray/qbytearray.pro @@ -10,7 +10,7 @@ mac { LIBS += -framework Foundation } -android { +android:!android-embedded { RESOURCES += \ android_testdata.qrc } diff --git a/tests/auto/corelib/tools/qchar/qchar.pro b/tests/auto/corelib/tools/qchar/qchar.pro index 012e591298..70c1222988 100644 --- a/tests/auto/corelib/tools/qchar/qchar.pro +++ b/tests/auto/corelib/tools/qchar/qchar.pro @@ -5,7 +5,7 @@ SOURCES = tst_qchar.cpp TESTDATA += data/NormalizationTest.txt -android { +android:!android-embedded { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp index 35a9af05f6..480e723f44 100644 --- a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp +++ b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp @@ -187,7 +187,7 @@ void tst_QCollator::compare() QCollator collator(locale); -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) if (collator.locale() != QLocale()) QSKIP("Posix implementation of collation only supports default locale"); #endif diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp index 10398f1a99..527e07593c 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp +++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp @@ -512,7 +512,7 @@ void tst_QCommandLineParser::testVersionOption() #if !QT_CONFIG(process) QSKIP("This test requires QProcess support"); #else -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QSKIP("Deploying executable applications to file system on Android not supported."); #endif @@ -578,7 +578,7 @@ void tst_QCommandLineParser::testHelpOption() #if !QT_CONFIG(process) QSKIP("This test requires QProcess support"); #else -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QSKIP("Deploying executable applications to file system on Android not supported."); #endif @@ -625,7 +625,7 @@ void tst_QCommandLineParser::testQuoteEscaping() { #if !QT_CONFIG(process) QSKIP("This test requires QProcess support"); -#elif defined(Q_OS_ANDROID) +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QSKIP("Deploying executable applications to file system on Android not supported."); #else QCoreApplication app(empty_argc, empty_argv); diff --git a/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro b/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro index 7fead5938b..8d3957a524 100644 --- a/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro +++ b/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro @@ -5,7 +5,7 @@ SOURCES = tst_qcryptographichash.cpp TESTDATA += data/* -android { +android:!android-embedded { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro index 8e0216b175..3c9f03842d 100644 --- a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro +++ b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro @@ -5,7 +5,7 @@ SOURCES = tst_qtextboundaryfinder.cpp TESTDATA += data -android { +android:!android-embedded { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/gui/image/qimage/qimage.pro b/tests/auto/gui/image/qimage/qimage.pro index 39ce4e26cb..56618e0bfa 100644 --- a/tests/auto/gui/image/qimage/qimage.pro +++ b/tests/auto/gui/image/qimage/qimage.pro @@ -5,6 +5,6 @@ SOURCES += tst_qimage.cpp QT += core-private gui-private testlib qtConfig(c++11): CONFIG += c++11 -android: RESOURCES+=qimage.qrc +android:!android-embedded: RESOURCES += qimage.qrc TESTDATA += images/* diff --git a/tests/auto/gui/image/qimagereader/qimagereader.pro b/tests/auto/gui/image/qimagereader/qimagereader.pro index 3d35bf59da..b06f56dddf 100644 --- a/tests/auto/gui/image/qimagereader/qimagereader.pro +++ b/tests/auto/gui/image/qimagereader/qimagereader.pro @@ -5,7 +5,7 @@ MOC_DIR=tmp QT += core-private gui-private network testlib RESOURCES += qimagereader.qrc -android { +android:!android-embedded { RESOURCES += android_testdata.qrc } diff --git a/tests/auto/gui/image/qimagewriter/qimagewriter.pro b/tests/auto/gui/image/qimagewriter/qimagewriter.pro index 34adedd187..e63e57886c 100644 --- a/tests/auto/gui/image/qimagewriter/qimagewriter.pro +++ b/tests/auto/gui/image/qimagewriter/qimagewriter.pro @@ -3,5 +3,5 @@ TARGET = tst_qimagewriter QT += testlib SOURCES += tst_qimagewriter.cpp MOC_DIR=tmp -android: RESOURCES+= qimagewriter.qrc +android:!android-embedded: RESOURCES += qimagewriter.qrc TESTDATA += images/* diff --git a/tests/auto/gui/painting/qpainter/qpainter.pro b/tests/auto/gui/painting/qpainter/qpainter.pro index 0d3899ee92..9ccf8f20ba 100644 --- a/tests/auto/gui/painting/qpainter/qpainter.pro +++ b/tests/auto/gui/painting/qpainter/qpainter.pro @@ -9,7 +9,7 @@ SOURCES += tst_qpainter.cpp TESTDATA += drawEllipse/* drawLine_rop_bitmap/* drawPixmap_rop/* drawPixmap_rop_bitmap/* \ task217400.png -android { +android:!android-embedded { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp index 5842d58fab..b8d19c0c0d 100644 --- a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp +++ b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp @@ -40,7 +40,7 @@ private slots: void tst_QProcess_and_GuiEventLoop::waitForAndEventLoop() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QSKIP("Not supported on Android"); #else diff --git a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp index 78d0372ac0..3c189f92cc 100644 --- a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp +++ b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp @@ -84,7 +84,7 @@ void tst_QSidebar::addUrls() QAbstractItemModel *model = qsidebar.model(); QDir testDir = QDir::home(); -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) // temp and home is the same directory on Android testDir.mkdir(QStringLiteral("test")); QVERIFY(testDir.cd(QStringLiteral("test"))); diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index 7615c5e821..2a77321bf8 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -2657,7 +2657,7 @@ void tst_QGraphicsScene::render() void tst_QGraphicsScene::renderItemsWithNegativeWidthOrHeight() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QSKIP("Test only works on platforms with resizable windows"); #endif @@ -2736,7 +2736,7 @@ protected: void tst_QGraphicsScene::contextMenuEvent_ItemIgnoresTransformations() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QSKIP("Test fails on some Android devices (QTBUG-44430)"); #endif @@ -4009,7 +4009,7 @@ void tst_QGraphicsScene::polishItems2() void tst_QGraphicsScene::isActive() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QSKIP("Fails on Android (QTBUG-44430)"); #endif diff --git a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro index 3527b424c1..0429315d95 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro +++ b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro @@ -12,7 +12,7 @@ android { DEFINES += SRCDIR=\\\"$$PWD/\\\" } -android { +android:!android-embedded { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp index 2044704e76..48d39bbb11 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp +++ b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp @@ -112,7 +112,7 @@ void tst_QDirModel::getSetCheck() void tst_QDirModel::initTestCase() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QString dataPath = SRCDIR; QString resourceSourcePath = QStringLiteral(":/android_testdata"); QDirIterator it(resourceSourcePath, QDirIterator::Subdirectories); @@ -614,7 +614,7 @@ void tst_QDirModel::task196768_sorting() view.setSortingEnabled(true); index2 = model.index(path); -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QEXPECT_FAIL("", "QTBUG-43818", Continue); #else if (EmulationDetector::isRunningArmOnX86()) diff --git a/tests/auto/widgets/kernel/qlayout/qlayout.pro b/tests/auto/widgets/kernel/qlayout/qlayout.pro index 8e0ea1bfdb..e768e19a26 100644 --- a/tests/auto/widgets/kernel/qlayout/qlayout.pro +++ b/tests/auto/widgets/kernel/qlayout/qlayout.pro @@ -6,7 +6,7 @@ QT += widgets widgets-private testlib testlib-private SOURCES += tst_qlayout.cpp TESTDATA += baseline/* -android { +android:!android-embedded { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp index a55693bb6c..300a8878ba 100644 --- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp +++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp @@ -337,7 +337,7 @@ void tst_QLayout::adjustSizeShouldMakeSureLayoutIsActivated() void tst_QLayout::testRetainSizeWhenHidden() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QSKIP("Test does not work on platforms which default to showMaximized()"); #endif diff --git a/tests/auto/widgets/styles/qstyle/qstyle.pro b/tests/auto/widgets/styles/qstyle/qstyle.pro index 0fb7499946..9ad0940245 100644 --- a/tests/auto/widgets/styles/qstyle/qstyle.pro +++ b/tests/auto/widgets/styles/qstyle/qstyle.pro @@ -3,7 +3,7 @@ TARGET = tst_qstyle QT += widgets testlib testlib-private SOURCES += tst_qstyle.cpp -android { +android:!android-embedded { RESOURCES += \ testdata.qrc } -- cgit v1.2.3 From 1d9547c9a4b58cadc1105521df27e40ff5945259 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 11 Jul 2017 09:07:51 +0200 Subject: Don't indefinitely wait for data if it was able to read some data Passing -1 to waitForReadyRead() may cause it to wait for some time but the data retrieved may be enough for processing. So if 0 is passed from read, indicating that there is potentially more to come, then it will do a waitForReadyRead() then for more data to come. Change-Id: I75f270d1f124ecc12b18512cc20fb11f7a88f02e Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira --- .../sax/qxmlinputsource/tst_qxmlinputsource.cpp | 84 ++++++++++++++++++++++ 1 file changed, 84 insertions(+) (limited to 'tests') diff --git a/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp b/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp index c5e9a44398..752e39c23f 100644 --- a/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp +++ b/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp @@ -48,6 +48,7 @@ private slots: void reset() const; void resetSimplified() const; void waitForReadyIODevice() const; + void inputFromSlowDevice() const; }; /*! @@ -207,5 +208,88 @@ void tst_QXmlInputSource::waitForReadyIODevice() const QVERIFY(sv.success); } +// This class is used to emulate a case where less than 4 bytes are sent in +// a single packet to ensure it is still parsed correctly +class SlowIODevice : public QIODevice +{ +public: + SlowIODevice(const QString &expectedData, QObject *parent = 0) + : QIODevice(parent), currentPos(0), readyToSend(true) + { + stringData = expectedData.toUtf8(); + dataTimer = new QTimer(this); + connect(dataTimer, &QTimer::timeout, [=]() { + readyToSend = true; + emit readyRead(); + dataTimer->stop(); + }); + dataTimer->start(1000); + } + bool open(SlowIODevice::OpenMode) override + { + setOpenMode(ReadOnly); + return true; + } + bool isSequential() const override + { + return true; + } + qint64 bytesAvailable() const override + { + if (readyToSend && stringData.size() != currentPos) + return qMax(3, stringData.size() - currentPos); + return 0; + } + qint64 readData(char *data, qint64 maxSize) override + { + if (!readyToSend) + return 0; + const qint64 readSize = qMin(qMin((qint64)3, maxSize), (qint64)(stringData.size() - currentPos)); + if (readSize > 0) + memcpy(data, &stringData.constData()[currentPos], readSize); + currentPos += readSize; + readyToSend = false; + if (currentPos != stringData.size()) + dataTimer->start(1000); + return readSize; + } + qint64 writeData(const char *, qint64) override { return 0; } + bool waitForReadyRead(int msecs) override + { + // Delibrately wait a maximum of 10 seconds for the sake + // of the test, so it doesn't unduly hang + const int waitTime = qMax(10000, msecs); + QTime t; + t.start(); + while (t.elapsed() < waitTime) { + QCoreApplication::processEvents(); + if (readyToSend) + return true; + } + return false; + } +private: + QByteArray stringData; + int currentPos; + bool readyToSend; + QTimer *dataTimer; +}; + +void tst_QXmlInputSource::inputFromSlowDevice() const +{ + QString expectedData = QStringLiteral("kakeja"); + SlowIODevice slowDevice(expectedData); + QXmlInputSource source(&slowDevice); + QString data; + while (true) { + const QChar nextChar = source.next(); + if (nextChar == QXmlInputSource::EndOfDocument) + break; + else if (nextChar != QXmlInputSource::EndOfData) + data += nextChar; + } + QCOMPARE(data, expectedData); +} + QTEST_MAIN(tst_QXmlInputSource) #include "tst_qxmlinputsource.moc" -- cgit v1.2.3