summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp')
-rw-r--r--tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp
index fa6a1978ca..cdece2f8c7 100644
--- a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp
+++ b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp
@@ -119,8 +119,34 @@ private slots:
void tst_QDirIterator::initTestCase()
{
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QString testdata_dir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
+ QString resourceSourcePath = QStringLiteral(":/");
+ QDirIterator it(resourceSourcePath, QDirIterator::Subdirectories);
+ while (it.hasNext()) {
+ it.next();
+
+ QFileInfo fileInfo = it.fileInfo();
+
+ if (!fileInfo.isDir()) {
+ QString destination = testdata_dir + QLatin1Char('/') + fileInfo.filePath().mid(resourceSourcePath.length());
+ QFileInfo destinationFileInfo(destination);
+ if (!destinationFileInfo.exists()) {
+ QDir().mkpath(destinationFileInfo.path());
+ if (!QFile::copy(fileInfo.filePath(), destination))
+ qWarning("Failed to copy %s", qPrintable(fileInfo.filePath()));
+ }
+ }
+
+ }
+
+ testdata_dir += QStringLiteral("/entrylist");
+#else
+
// chdir into testdata directory, then find testdata by relative paths.
QString testdata_dir = QFileInfo(QFINDTESTDATA("entrylist")).absolutePath();
+#endif
+
QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir));
QFile::remove("entrylist/entrylist1.lnk");