summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp')
-rw-r--r--tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
index 22d5da8e68..5b67fd2af5 100644
--- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
@@ -272,9 +272,32 @@ private:
void tst_QFileInfo::initTestCase()
{
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QString dataPath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
+ QString resourceSourcePath = QStringLiteral(":/android_testdata");
+ QDirIterator it(resourceSourcePath, QDirIterator::Subdirectories);
+ while (it.hasNext()) {
+ it.next();
+
+ QFileInfo fileInfo = it.fileInfo();
+ if (!fileInfo.isDir()) {
+ QString destination = dataPath + 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()));
+ }
+ }
+ }
+ m_sourceFile = dataPath + QStringLiteral("/tst_qfileinfo.cpp");
+ m_resourcesDir = dataPath + QStringLiteral("/resources");
+#else
m_sourceFile = QFINDTESTDATA("tst_qfileinfo.cpp");
- QVERIFY(!m_sourceFile.isEmpty());
m_resourcesDir = QFINDTESTDATA("resources");
+#endif
+
+ QVERIFY(!m_sourceFile.isEmpty());
QVERIFY(!m_resourcesDir.isEmpty());
QVERIFY(m_dir.isValid());
QVERIFY(QDir::setCurrent(m_dir.path()));
@@ -1137,7 +1160,11 @@ void tst_QFileInfo::fileTimes()
QEXPECT_FAIL("simple", "WinCE only stores date of access data, not the time", Continue);
#elif defined(Q_OS_QNX)
QEXPECT_FAIL("", "QNX uses the noatime filesystem option", Continue);
+#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ if (fileInfo.lastRead() <= beforeRead)
+ QEXPECT_FAIL("", "Android may use relatime or noatime on mounts", Continue);
#endif
+
QVERIFY(fileInfo.lastRead() > beforeRead);
QVERIFY(fileInfo.lastModified() > beforeWrite);
QVERIFY(fileInfo.lastModified() < beforeRead);