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, 19 insertions, 10 deletions
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
index 14e37226e5..4362bace8c 100644
--- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
@@ -61,7 +61,7 @@
#include <private/qfileinfo_p.h>
#include "../../../../shared/filesystem.h"
-#if defined(Q_OS_VXWORKS)
+#if defined(Q_OS_VXWORKS) || defined(Q_OS_WINRT)
#define Q_NO_SYMLINKS
#endif
@@ -422,12 +422,12 @@ void tst_QFileInfo::isDir_data()
QTest::newRow("broken link") << "brokenlink.lnk" << false;
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT))
QTest::newRow("drive 1") << "c:" << true;
QTest::newRow("drive 2") << "c:/" << true;
//QTest::newRow("drive 2") << "t:s" << false;
#endif
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName();
QTest::newRow("unc 1") << uncRoot << true;
QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true;
@@ -464,7 +464,7 @@ void tst_QFileInfo::isRoot_data()
QTest::newRow("simple dir") << m_resourcesDir << false;
QTest::newRow("simple dir with slash") << (m_resourcesDir + QLatin1Char('/')) << false;
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT))
QTest::newRow("drive 1") << "c:" << false;
QTest::newRow("drive 2") << "c:/" << true;
QTest::newRow("drive 3") << "p:/" << false;
@@ -508,7 +508,12 @@ void tst_QFileInfo::exists_data()
QTest::newRow("data8") << (m_resourcesDir + "/*.ext1") << false;
QTest::newRow("data9") << (m_resourcesDir + "/file?.ext1") << false;
QTest::newRow("data10") << "." << true;
+
+ // Skip for the WinRT case, as GetFileAttributesEx removes _any_
+ // trailing whitespace and "." is a valid entry as seen in data10
+#ifndef Q_OS_WINRT
QTest::newRow("data11") << ". " << false;
+#endif
QTest::newRow("empty") << "" << false;
QTest::newRow("simple dir") << m_resourcesDir << true;
@@ -549,7 +554,7 @@ void tst_QFileInfo::absolutePath_data()
QTest::addColumn<QString>("filename");
QString drivePrefix;
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT))
drivePrefix = QDir::currentPath().left(2);
QString nonCurrentDrivePrefix =
drivePrefix.left(1).compare("X", Qt::CaseInsensitive) == 0 ? QString("Y:") : QString("X:");
@@ -559,6 +564,8 @@ void tst_QFileInfo::absolutePath_data()
QTest::newRow("<not current drive>:my.dll") << nonCurrentDrivePrefix + "my.dll"
<< nonCurrentDrivePrefix + "/"
<< "my.dll";
+#elif defined(Q_OS_WINRT)
+ drivePrefix = QDir::currentPath().left(2);
#endif
QTest::newRow("0") << "/machine/share/dir1/" << drivePrefix + "/machine/share/dir1" << "";
QTest::newRow("1") << "/machine/share/dir1" << drivePrefix + "/machine/share" << "dir1";
@@ -566,7 +573,7 @@ void tst_QFileInfo::absolutePath_data()
QTest::newRow("3") << "/usr/local/bin/" << drivePrefix + "/usr/local/bin" << "";
QTest::newRow("/test") << "/test" << drivePrefix + "/" << "test";
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
QTest::newRow("c:\\autoexec.bat") << "c:\\autoexec.bat" << "C:/"
<< "autoexec.bat";
QTest::newRow("c:autoexec.bat") << QDir::currentPath().left(2) + "autoexec.bat" << QDir::currentPath()
@@ -730,7 +737,7 @@ void tst_QFileInfo::canonicalFilePath()
}
#endif
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
typedef BOOL (WINAPI *PtrCreateSymbolicLink)(LPTSTR, LPTSTR, DWORD);
PtrCreateSymbolicLink ptrCreateSymbolicLink =
(PtrCreateSymbolicLink)QLibrary::resolve(QLatin1String("kernel32"), "CreateSymbolicLinkW");
@@ -826,7 +833,7 @@ void tst_QFileInfo::dir_data()
QTest::newRow("absFilePath") << QDir::currentPath() + "/tmp.txt" << false << QDir::currentPath();
QTest::newRow("absFilePathAbsPath") << QDir::currentPath() + "/tmp.txt" << true << QDir::currentPath();
QTest::newRow("resource1") << ":/tst_qfileinfo/resources/file1.ext1" << true << ":/tst_qfileinfo/resources";
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
QTest::newRow("driveWithSlash") << "C:/file1.ext1.ext2" << true << "C:/";
QTest::newRow("driveWithoutSlash") << QDir::currentPath().left(2) + "file1.ext1.ext2" << false << QDir::currentPath().left(2);
#endif
@@ -1017,7 +1024,7 @@ void tst_QFileInfo::size()
void tst_QFileInfo::systemFiles()
{
-#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE)
+#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
QSKIP("This is a Windows only test");
#endif
QFileInfo fi("c:\\pagefile.sys");
@@ -1188,6 +1195,8 @@ void tst_QFileInfo::fileTimes()
#endif
#if defined(Q_OS_WINCE)
QEXPECT_FAIL("simple", "WinCE only stores date of access data, not the time", Continue);
+#elif defined(Q_OS_WINRT)
+ 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) && !defined(Q_OS_ANDROID_NO_SDK)
@@ -1623,7 +1632,7 @@ void tst_QFileInfo::isWritable()
QVERIFY(QFileInfo("tempfile.txt").isWritable());
tempfile.remove();
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
#ifdef Q_OS_WINCE
QFileInfo fi("\\Windows\\wince.nls");
#else