diff options
author | Fabien Freling <fabien.freling@nokia.com> | 2010-05-12 13:32:40 (GMT) |
---|---|---|
committer | Fabien Freling <fabien.freling@nokia.com> | 2010-05-12 13:47:23 (GMT) |
commit | 366913da05d833ebf447a061f9d859ec3a344658 (patch) | |
tree | 1eddb5d46385245a4b9466db6c490c1f797a5a45 | |
parent | e35304444d6413d00c2090fab5d8173e6b6b7f26 (diff) | |
download | Qt-366913da05d833ebf447a061f9d859ec3a344658.zip Qt-366913da05d833ebf447a061f9d859ec3a344658.tar.gz Qt-366913da05d833ebf447a061f9d859ec3a344658.tar.bz2 |
Fix Mac-specific tests about the hidden
attribute.
Create a new test only for Mac.
-rw-r--r-- | tests/auto/qfileinfo/tst_qfileinfo.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp index c7dce28..4387553 100644 --- a/tests/auto/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp @@ -155,6 +155,9 @@ private slots: void isHidden_data(); void isHidden(); +#if defined(Q_OS_MAC) + void isHiddenFromFinder(); +#endif void isBundle_data(); void isBundle(); @@ -1131,8 +1134,6 @@ void tst_QFileInfo::isHidden_data() #if defined(Q_OS_MAC) // /bin has the hidden attribute on Mac OS X QTest::newRow("/bin/") << QString::fromLatin1("/bin/") << true; - QTest::newRow("/dev/") << QString::fromLatin1("/dev/") << true; - QTest::newRow("/net/") << QString::fromLatin1("/net/") << true; #elif !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN) QTest::newRow("/bin/") << QString::fromLatin1("/bin/") << false; #endif @@ -1182,6 +1183,27 @@ void tst_QFileInfo::isHidden() QCOMPARE(fi.isHidden(), isHidden); } +#if defined(Q_OS_MAC) +void tst_QFileInfo::isHiddenFromFinder() +{ + const char *filename = "test_foobar.txt"; + + QFile testFile(filename); + testFile.open(QIODevice::WriteOnly | QIODevice::Append); + testFile.write(QByteArray("world")); + testFile.close(); + + struct stat buf; + stat(filename, &buf); + chflags(filename, buf.st_flags | UF_HIDDEN); + + QFileInfo fi(filename); + QCOMPARE(fi.isHidden(), true); + + testFile.remove(); +} +#endif + void tst_QFileInfo::isBundle_data() { QTest::addColumn<QString>("path"); |