summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2011-12-08 14:49:31 +0100
committerQt by Nokia <qt-info@nokia.com>2011-12-08 16:00:53 +0100
commitca1af75fb2ca0671bc715e4f7ec3b45939073eb4 (patch)
tree8c0098719a9ab585cc4bf1d4ee68a6a6919a0a01 /tests
parent86827908c6cca00de7578218ed867832c8d7283e (diff)
Fix QTemporaryDir unittest on Mac OS X
mkdtemp(10*X) replaces all 10 chars on Mac, while on linux it only replaces the last 6. Adjusted the too-strict tests to allow for both possibilities. Change-Id: Ie6d57bd4947254ad7a39e75ac0e8881cebeaa428 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
index 434b15b125..cb6bd9baac 100644
--- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
+++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
@@ -142,10 +142,12 @@ void tst_QTemporaryDir::fileTemplate_data()
QTest::newRow("constructor with xxx sufix") << "qt_XXXXXXxxx" << "qt_XXXXXXxxx";
QTest::newRow("constructor with xXx sufix") << "qt_XXXXXXxXx" << "qt_XXXXXXxXx";
QTest::newRow("constructor with no suffix") << "qt_XXXXXX" << "qt_";
- QTest::newRow("constructor with >6 X's, no suffix") << "qt_XXXXXXXXXX" << "qt_XXXX";
+ QTest::newRow("constructor with >6 X's, no suffix") << "qt_XXXXXXXXXX" << "qt_";
+ // When more than 6 X are present at the end, linux and windows will only replace the last 6,
+ // while Mac OS will actually replace all of them so we can only expect "qt_" (and check isValid).
QTest::newRow("constructor with XXXX suffix") << "qt_XXXXXX_XXXX" << "qt_";
- QTest::newRow("constructor with XXXX prefix") << "qt_XXXX" << "qt_XXXX";
- QTest::newRow("constructor with XXXXX prefix") << "qt_XXXXX" << "qt_XXXXX";
+ QTest::newRow("constructor with XXXX prefix") << "qt_XXXX" << "qt_";
+ QTest::newRow("constructor with XXXXX prefix") << "qt_XXXXX" << "qt_";
}
void tst_QTemporaryDir::fileTemplate()
@@ -380,7 +382,7 @@ void tst_QTemporaryDir::QTBUG_4796_data()
QTest::newRow("<unicode>XXXXXX") << unicode << QString() << true;
}
-void tst_QTemporaryDir::QTBUG_4796()
+void tst_QTemporaryDir::QTBUG_4796() // unicode support
{
QVERIFY(QDir("test-XXXXXX").exists());
@@ -443,9 +445,9 @@ void tst_QTemporaryDir::QTBUG_4796()
QString fileName5 = currentDir.relativeFilePath(dir5.path());
QString fileName6 = currentDir.relativeFilePath(dir6.path());
- QVERIFY(fileName1.startsWith(fileTemplate1));
- QVERIFY(fileName2.startsWith(fileTemplate2));
- QVERIFY(fileName5.startsWith("test-XXXXXX/" + fileTemplate1));
+ QVERIFY(fileName1.startsWith(prefix));
+ QVERIFY(fileName2.startsWith(prefix));
+ QVERIFY(fileName5.startsWith("test-XXXXXX/" + prefix));
QVERIFY(fileName6.startsWith("test-XXXXXX/" + prefix));
if (!prefix.isEmpty()) {