aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@digia.com>2014-03-21 12:57:17 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-24 13:34:19 +0100
commit18f21746d7e58bec0a819d84fe17f245a8439ae8 (patch)
treebd51082564cd7fec837f8851334e32bc7c150678 /tests/auto/qml/qqmllanguage
parentfc45fd6983e12c2701b445dae1f3d99988091eac (diff)
tests: fix tst_qqmllanguage::importIncorrectCase() and errors(incorrectCase)
It gives different error message based on the case sensitivity of the file system on Mac. Task-number: QTBUG-37622 Change-Id: I567eb4a0b9a413f6eb51683b568f6a6284e6458d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'tests/auto/qml/qqmllanguage')
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 78fff58841..e5c86e744d 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -65,6 +65,17 @@
DEFINE_BOOL_CONFIG_OPTION(qmlCheckTypes, QML_CHECK_TYPES)
+static inline bool isCaseSensitiveFileSystem(const QString &path) {
+ Q_UNUSED(path)
+#if defined(Q_OS_MAC)
+ return pathconf(path.toLatin1().constData(), _PC_CASE_SENSITIVE);
+#elif defined(Q_OS_WIN)
+ return false;
+#else
+ return true;
+#endif
+}
+
/*
This test case covers QML language issues. This covers everything that does not
involve evaluating ECMAScript expressions and bindings.
@@ -495,13 +506,11 @@ void tst_qqmllanguage::errors_data()
QTest::newRow("notAvailable") << "notAvailable.qml" << "notAvailable.errors.txt" << false;
QTest::newRow("singularProperty") << "singularProperty.qml" << "singularProperty.errors.txt" << false;
QTest::newRow("singularProperty.2") << "singularProperty.2.qml" << "singularProperty.2.errors.txt" << false;
- QTest::newRow("incorrectCase") << "incorrectCase.qml"
-#if defined(Q_OS_MAC) || defined(Q_OS_WIN32)
- << "incorrectCase.errors.insensitive.txt"
-#else
- << "incorrectCase.errors.sensitive.txt"
-#endif
- << false;
+
+ const QString expectedError = isCaseSensitiveFileSystem(dataDirectory()) ?
+ QStringLiteral("incorrectCase.errors.sensitive.txt") :
+ QStringLiteral("incorrectCase.errors.insensitive.txt");
+ QTest::newRow("incorrectCase") << "incorrectCase.qml" << expectedError << false;
QTest::newRow("metaobjectRevision.1") << "metaobjectRevision.1.qml" << "metaobjectRevision.1.errors.txt" << false;
QTest::newRow("metaobjectRevision.2") << "metaobjectRevision.2.qml" << "metaobjectRevision.2.errors.txt" << false;
@@ -2577,12 +2586,9 @@ void tst_qqmllanguage::importIncorrectCase()
QList<QQmlError> errors = component.errors();
QCOMPARE(errors.count(), 1);
-#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
- QString expectedError = QLatin1String("File name case mismatch");
-#else
- QString expectedError = QLatin1String("File not found");
-#endif
-
+ const QString expectedError = isCaseSensitiveFileSystem(dataDirectory()) ?
+ QStringLiteral("File not found") :
+ QStringLiteral("File name case mismatch");
QCOMPARE(errors.at(0).description(), expectedError);
engine.setImportPathList(defaultImportPathList);