diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-07-28 10:58:46 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-07-28 11:45:59 (GMT) |
commit | 7eba68adc4a7862d9474179592e5c8393a7acdbb (patch) | |
tree | 73014cabc8b10f46203844aeb40de574d97032dc /tests/auto/qfileinfo | |
parent | a20f8dcbeafa34b50ef69d1c5db0f17b09731d2a (diff) | |
parent | 3bf3981c7026de9017887d08312391b54fe8afc6 (diff) | |
download | Qt-7eba68adc4a7862d9474179592e5c8393a7acdbb.zip Qt-7eba68adc4a7862d9474179592e5c8393a7acdbb.tar.gz Qt-7eba68adc4a7862d9474179592e5c8393a7acdbb.tar.bz2 |
Merge commit 'qt/master-stable'
Conflicts:
configure.exe
src/corelib/io/io.pri
src/corelib/io/qfilesystemwatcher.cpp
tests/auto/qfileinfo/tst_qfileinfo.cpp
tools/configure/configureapp.cpp
Diffstat (limited to 'tests/auto/qfileinfo')
-rw-r--r-- | tests/auto/qfileinfo/tst_qfileinfo.cpp | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp index ec58b6c..2a19a04 100644 --- a/tests/auto/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp @@ -153,9 +153,7 @@ private slots: void brokenShortcut(); #endif -#ifdef Q_OS_UNIX void isWritable(); -#endif void isExecutable(); void testDecomposedUnicodeNames_data(); void testDecomposedUnicodeNames(); @@ -251,6 +249,7 @@ void tst_QFileInfo::isFile_data() QTest::newRow("data1") << "tst_qfileinfo.cpp" << true; QTest::newRow("data2") << ":/tst_qfileinfo/resources/" << false; QTest::newRow("data3") << ":/tst_qfileinfo/resources/file1" << true; + QTest::newRow("data4") << ":/tst_qfileinfo/resources/afilethatshouldnotexist" << false; } void tst_QFileInfo::isFile() @@ -283,6 +282,7 @@ void tst_QFileInfo::isDir_data() QTest::newRow("data1") << "tst_qfileinfo.cpp" << false; QTest::newRow("data2") << ":/tst_qfileinfo/resources/" << true; QTest::newRow("data3") << ":/tst_qfileinfo/resources/file1" << false; + QTest::newRow("data4") << ":/tst_qfileinfo/resources/afilethatshouldnotexist" << false; QTest::newRow("simple dir") << "resources" << true; QTest::newRow("simple dir with slash") << "resources/" << true; @@ -320,16 +320,17 @@ void tst_QFileInfo::isRoot_data() QTest::addColumn<bool>("expected"); QTest::newRow("data0") << QDir::currentPath() << false; QTest::newRow("data1") << "/" << true; - QTest::newRow("data2") << ":/tst_qfileinfo/resources/" << false; - QTest::newRow("data3") << ":/" << true; + QTest::newRow("data2") << "*" << false; + QTest::newRow("data3") << "/*" << false; + QTest::newRow("data4") << ":/tst_qfileinfo/resources/" << false; + QTest::newRow("data5") << ":/" << true; QTest::newRow("simple dir") << "resources" << false; QTest::newRow("simple dir with slash") << "resources/" << false; #if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN) QTest::newRow("drive 1") << "c:" << false; QTest::newRow("drive 2") << "c:/" << true; -#endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + QTest::newRow("drive 3") << "p:/" << false; QTest::newRow("unc 1") << "//" + QtNetworkSettings::winServerName() << true; QTest::newRow("unc 2") << "//" + QtNetworkSettings::winServerName() + "/" << true; QTest::newRow("unc 3") << "//" + QtNetworkSettings::winServerName() + "/testshare" << false; @@ -931,18 +932,27 @@ void tst_QFileInfo::fileTimes_oldFile() NULL); // Set file times back to 1601. + SYSTEMTIME stime; + stime.wYear = 1601; + stime.wMonth = 1; + stime.wDayOfWeek = 1; + stime.wDay = 1; + stime.wHour = 1; + stime.wMinute = 0; + stime.wSecond = 0; + stime.wMilliseconds = 0; + FILETIME ctime; - ctime.dwLowDateTime = 1; - ctime.dwHighDateTime = 0; + QVERIFY(SystemTimeToFileTime(&stime, &ctime)); FILETIME atime = ctime; FILETIME mtime = atime; QVERIFY(fileHandle); QVERIFY(SetFileTime(fileHandle, &ctime, &atime, &mtime) != 0); - QFileInfo info("oldfile.txt"); - QCOMPARE(info.lastModified(), QDateTime(QDate(1601, 1, 1), QTime(1, 0))); - CloseHandle(fileHandle); + + QFileInfo info("oldfile.txt"); + QCOMPARE(info.lastModified(), QDateTime(QDate(1601, 1, 1), QTime(1, 0), Qt::UTC).toLocalTime()); #endif } @@ -977,8 +987,8 @@ void tst_QFileInfo::isHidden_data() { QTest::addColumn<QString>("path"); QTest::addColumn<bool>("isHidden"); - foreach (QFileInfo info, QDir::drives()) { - QTest::newRow(qPrintable("drive." + info.path())) << info.path() << false; + foreach (const QFileInfo& info, QDir::drives()) { + QTest::newRow(qPrintable("drive." + info.path())) << info.path() << false; } #ifdef Q_OS_MAC QTest::newRow("mac_etc") << QString::fromLatin1("/etc") << true; @@ -1079,19 +1089,23 @@ void tst_QFileInfo::brokenShortcut() } #endif -#ifdef Q_OS_UNIX void tst_QFileInfo::isWritable() { #ifdef Q_OS_SYMBIAN - QSKIP("This is a UNIX only test - no passwd in Symbian OS", SkipAll); + QSKIP("Currently skipped on Symbian OS, but surely there is a writeable file somewhere???", SkipAll); #endif + QVERIFY(QFileInfo("tst_qfileinfo.cpp").isWritable()); +#ifdef Q_OS_WIN + QVERIFY(!QFileInfo("c:\\pagefile.sys").isWritable()); +#endif +#ifdef Q_OS_UNIX if (::getuid() == 0) QVERIFY(QFileInfo("/etc/passwd").isWritable()); else QVERIFY(!QFileInfo("/etc/passwd").isWritable()); -} #endif +} void tst_QFileInfo::isExecutable() { |