diff -r b72c6db6890b -r 5dc02b23752f tests/auto/qfileinfo/tst_qfileinfo.cpp --- a/tests/auto/qfileinfo/tst_qfileinfo.cpp Wed Jun 23 19:07:03 2010 +0300 +++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp Tue Jul 06 15:10:48 2010 +0300 @@ -194,6 +194,9 @@ #if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) QDir().rmdir("./.hidden-directory"); #endif +#ifdef Q_OS_WIN + QDir().rmdir("./hidden-directory"); +#endif } // Testing get/set functions @@ -828,6 +831,17 @@ QTest::addColumn("file2"); QTest::addColumn("same"); +#if defined(Q_OS_MAC) + // Since 10.6 we use realpath() in qfsfileengine, and it properly handles + // file system case sensitivity. However here in the autotest we don't + // check if the file system is case sensitive, so to make it pass in the + // default OS X installation we assume we are running on a case insensitive + // file system if on 10.6 and on a case sensitive file system if on 10.5 + bool caseSensitiveOnMac = true; + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6) + caseSensitiveOnMac = false; +#endif + QTest::newRow("data0") << QString::fromLatin1(SRCDIR "tst_qfileinfo.cpp") << QString::fromLatin1(SRCDIR "tst_qfileinfo.cpp") @@ -845,6 +859,8 @@ << QString::fromLatin1(SRCDIR "tst_qfileinfo.cpp") #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) << true; +#elif defined(Q_OS_MAC) + << !caseSensitiveOnMac; #else << false; #endif @@ -856,7 +872,7 @@ QFETCH(QString, file2); QFETCH(bool, same); QFileInfo fi1(file1), fi2(file2); - QCOMPARE(same, fi1 == fi2); + QCOMPARE(fi1 == fi2, same); } void tst_QFileInfo::consistent_data() @@ -1043,14 +1059,6 @@ QTest::newRow("existent file") << SRCDIR "tst_qfileinfo.cpp" << false << ""; QTest::newRow("link") << "link.lnk" << true << QFileInfo(SRCDIR "tst_qfileinfo.cpp").absoluteFilePath(); QTest::newRow("broken link") << "brokenlink.lnk" << true << QFileInfo("dummyfile").absoluteFilePath(); - -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) - if (QSysInfo::WindowsVersion & QSysInfo::WV_VISTA) { - QTest::newRow("Documents and Settings") << "C:/Documents and Settings" << true << "C:/Users"; - QTest::newRow("All Users") << "C:/Users/All Users" << true << "C:/ProgramData"; - QTest::newRow("Default User") << "C:/Users/Default User" << true << "C:/Users/Default"; - } -#endif } void tst_QFileInfo::isSymLink() @@ -1073,16 +1081,13 @@ } #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) - QTest::newRow("C:/RECYCLER") << QString::fromLatin1("C:/RECYCLER") << true; - QTest::newRow("C:/RECYCLER/.") << QString::fromLatin1("C:/RECYCLER/.") << true; - QTest::newRow("C:/RECYCLER/..") << QString::fromLatin1("C:/RECYCLER/..") << true; + QVERIFY(QDir("./hidden-directory").exists() || QDir().mkdir("./hidden-directory")); + QVERIFY(SetFileAttributesW(QString("./hidden-directory").utf16(),FILE_ATTRIBUTE_HIDDEN)); + QTest::newRow("C:/path/to/hidden-directory") << QDir::currentPath() + QString::fromLatin1("/hidden-directory") << true; + QTest::newRow("C:/path/to/hidden-directory/.") << QDir::currentPath() + QString::fromLatin1("/hidden-directory/.") << true; #endif #if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) - - if (!QDir("./.hidden-directory").exists() - && !QDir().mkdir("./.hidden-directory")) - qWarning("Unable to create directory './.hidden-directory'. Some tests will fail."); - + QVERIFY(QDir("./.hidden-directory").exists() || QDir().mkdir("./.hidden-directory")); QTest::newRow("/path/to/.hidden-directory") << QDir::currentPath() + QString("/.hidden-directory") << true; QTest::newRow("/path/to/.hidden-directory/.") << QDir::currentPath() + QString("/.hidden-directory/.") << true; QTest::newRow("/path/to/.hidden-directory/..") << QDir::currentPath() + QString("/.hidden-directory/..") << true; @@ -1110,34 +1115,24 @@ { QFile file(hiddenFileName); - if (file.open(QIODevice::WriteOnly)) { - QTextStream t(&file); - t << "foobar"; - } else { - qWarning("Failed to create hidden file"); - } + QVERIFY(file.open(QIODevice::WriteOnly)); + QTextStream t(&file); + t << "foobar"; + QFile file2(notHiddenFileName); - if (file2.open(QIODevice::WriteOnly)) { - QTextStream t(&file); - t << "foobar"; - } else { - qWarning("Failed to create non-hidden file"); - } + QVERIFY(file2.open(QIODevice::WriteOnly)); + QTextStream t2(&file2); + t2 << "foobar"; } RFs rfs; TInt err = rfs.Connect(); - if (err == KErrNone) { - HBufC* symFile = qt_QString2HBufC(hiddenFileName); - err = rfs.SetAtt(*symFile, KEntryAttHidden, 0); - rfs.Close(); - delete symFile; - if (err != KErrNone) { - qWarning("Failed to set hidden attribute for test file"); - } - } else { - qWarning("Failed to open RFs session"); - } + QCOMPARE(err, KErrNone); + HBufC* symFile = qt_QString2HBufC(hiddenFileName); + err = rfs.SetAtt(*symFile, KEntryAttHidden, 0); + rfs.Close(); + delete symFile; + QCOMPARE(err, KErrNone); #endif } @@ -1194,7 +1189,7 @@ void tst_QFileInfo::refresh() { -#if defined(Q_OS_WINCE) +#if defined(Q_OS_WINCE) || defined(Q_OS_WIN) int sleepTime = 3000; #else int sleepTime = 2000;