summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qfile/tst_qfile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/io/qfile/tst_qfile.cpp')
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp40
1 files changed, 11 insertions, 29 deletions
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index d2a83757d2..9416796c6c 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -189,19 +189,17 @@ private slots:
void copyRemovesTemporaryFile() const;
void copyShouldntOverwrite();
void copyFallback();
-#ifndef Q_OS_WINRT
void link();
void linkToDir();
void absolutePathLinkToRelativePath();
void readBrokenLink();
-#endif
void readTextFile_data();
void readTextFile();
void readTextFile2();
void writeTextFile_data();
void writeTextFile();
/* void largeFileSupport(); */
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN)
void largeUncFileSupport();
#endif
void flush();
@@ -550,7 +548,7 @@ void tst_QFile::exists()
file.remove();
QVERIFY(!file.exists());
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN)
const QString uncPath = "//" + QtNetworkSettings::winServerName() + "/testshare/readme.txt";
QFile unc(uncPath);
QVERIFY2(unc.exists(), msgFileDoesNotExist(uncPath).constData());
@@ -606,7 +604,7 @@ void tst_QFile::open_data()
<< int(QIODevice::ReadOnly)
<< false
<< QFile::OpenError;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN)
//opening devices requires administrative privileges (and elevation).
HANDLE hTest = CreateFile(_T("\\\\.\\PhysicalDrive0"), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hTest != INVALID_HANDLE_VALUE) {
@@ -637,7 +635,7 @@ void tst_QFile::open()
QSKIP("Running this test as root doesn't make sense");
#endif
-#if defined(Q_OS_WIN32) || defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN32)
QEXPECT_FAIL("noreadfile", "Windows does not currently support non-readable files.", Abort);
#endif
if (filename.isEmpty())
@@ -689,7 +687,7 @@ void tst_QFile::size_data()
QTest::addColumn<qint64>("size");
QTest::newRow( "exist01" ) << m_testFile << (qint64)245;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN)
// Only test UNC on Windows./
QTest::newRow("unc") << "//" + QString(QtNetworkSettings::winServerName() + "/testshare/test.pri") << (qint64)34;
#endif
@@ -1173,7 +1171,7 @@ void tst_QFile::ungetChar()
QCOMPARE(buf[2], '4');
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN)
QString driveLetters()
{
wchar_t volumeName[MAX_PATH];
@@ -1210,9 +1208,7 @@ void tst_QFile::invalidFile_data()
#if !defined(Q_OS_WIN)
QTest::newRow( "x11" ) << QString( "qwe//" );
#else
-#if !defined(Q_OS_WINRT)
QTest::newRow( "colon2" ) << invalidDriveLetter() + QString::fromLatin1(":ail:invalid");
-#endif
QTest::newRow( "colon3" ) << QString( ":failinvalid" );
QTest::newRow( "forwardslash" ) << QString( "fail/invalid" );
QTest::newRow( "asterisk" ) << QString( "fail*invalid" );
@@ -1351,7 +1347,7 @@ void tst_QFile::permissions()
QFile::remove(file);
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN)
if (qt_ntfs_permission_lookup)
QEXPECT_FAIL("readonly", "QTBUG-25630", Abort);
#endif
@@ -1497,7 +1493,7 @@ void tst_QFile::copyFallback()
#include <shlobj.h>
#endif
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN)
static QString getWorkingDirectoryForLink(const QString &linkFileName)
{
bool neededCoInit = false;
@@ -1536,7 +1532,6 @@ static QString getWorkingDirectoryForLink(const QString &linkFileName)
}
#endif
-#ifndef Q_OS_WINRT
void tst_QFile::link()
{
QFile::remove("myLink.lnk");
@@ -1611,7 +1606,6 @@ void tst_QFile::readBrokenLink()
QVERIFY(QFile::link("ole/..", "myLink2.lnk"));
QCOMPARE(QFileInfo("myLink2.lnk").symLinkTarget(), QDir::currentPath());
}
-#endif // Q_OS_WINRT
void tst_QFile::readTextFile_data()
{
@@ -1696,7 +1690,7 @@ void tst_QFile::writeTextFile()
QCOMPARE(file.readAll(), out);
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN)
// Helper for executing QFile::open() with warning in QTRY_VERIFY(), which evaluates the condition
// multiple times
static bool qFileOpen(QFile &file, QIODevice::OpenMode ioFlags)
@@ -2427,7 +2421,7 @@ void tst_QFile::writeLargeDataBlock_data()
QTest::newRow("localfile-Fd") << "./largeblockfile.txt" << (int)OpenFd;
QTest::newRow("localfile-Stream") << "./largeblockfile.txt" << (int)OpenStream;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && !defined(QT_NO_NETWORK)
+#if defined(Q_OS_WIN) && !defined(QT_NO_NETWORK)
// Some semi-randomness to avoid collisions.
QTest::newRow("unc file")
<< QString("//" + QtNetworkSettings::winServerName() + "/TESTSHAREWRITABLE/largefile-%1-%2.txt")
@@ -2787,7 +2781,7 @@ void tst_QFile::appendAndRead()
void tst_QFile::miscWithUncPathAsCurrentDir()
{
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN)
QString current = QDir::currentPath();
const QString path = QLatin1String("//") + QtNetworkSettings::winServerName()
+ QLatin1String("/testshare");
@@ -2876,12 +2870,8 @@ void tst_QFile::nativeHandleLeaks()
}
#ifdef Q_OS_WIN
-# ifndef Q_OS_WINRT
handle1 = ::CreateFileA("qt_file.tmp", GENERIC_READ, 0, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
-# else
- handle1 = ::CreateFile2(L"qt_file.tmp", GENERIC_READ, 0, OPEN_ALWAYS, NULL);
-# endif
QVERIFY( INVALID_HANDLE_VALUE != handle1 );
QVERIFY( ::CloseHandle(handle1) );
#endif
@@ -2895,12 +2885,8 @@ void tst_QFile::nativeHandleLeaks()
}
#ifdef Q_OS_WIN
-# ifndef Q_OS_WINRT
handle2 = ::CreateFileA("qt_file.tmp", GENERIC_READ, 0, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
-# else
- handle2 = ::CreateFile2(L"qt_file.tmp", GENERIC_READ, 0, OPEN_ALWAYS, NULL);
-# endif
QVERIFY( INVALID_HANDLE_VALUE != handle2 );
QVERIFY( ::CloseHandle(handle2) );
#endif
@@ -3720,10 +3706,6 @@ void tst_QFile::moveToTrash()
QFETCH(bool, create);
QFETCH(bool, result);
-#if defined(Q_OS_WINRT)
- QSKIP("WinRT does not have a trash", SkipAll);
-#endif
-
auto ensureFile = [](const QString &source, bool create) {
if (QFileInfo::exists(source) || !create)
return;