diff options
author | Shawn Rutledge <shawn.rutledge@digia.com> | 2014-10-21 14:31:19 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@digia.com> | 2014-10-22 09:47:47 +0200 |
commit | 7bb7345dad86efd18ada010342b614917fbb5767 (patch) | |
tree | 83f486a17229749027716cba4d506a871c3eb43c | |
parent | 61df13088c6c1d6a1b5a6d329dcc6879b33d69ba (diff) | |
download | qtquick1-7bb7345dad86efd18ada010342b614917fbb5767.tar.gz |
tests: tst_qdeclarativelanguage: fix filesystem case sensitivity
importIncorrectCase() and errors(incorrectCase) give different error
messages depending on the case sensitivity of the file system on OS X.
Those are in turn different than error messages on other operating
systems with case-sensitive filesystems.
This patch is very similar to the one that was done in qtdeclarative:
2ebf4ba4710a01a038d05cfea741e5538bb4567f for QTBUG-37622
Change-Id: Ib13d717712cf88b476ca7edd8aababd7f5456c50
Task-number: QTBUG-41961
Reviewed-by: Liang Qi <liang.qi@digia.com>
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/incorrectCase.errors.sensitive.osx.txt | 2 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp | 30 |
2 files changed, 22 insertions, 10 deletions
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/incorrectCase.errors.sensitive.osx.txt b/tests/auto/declarative/qdeclarativelanguage/data/incorrectCase.errors.sensitive.osx.txt new file mode 100644 index 00000000..b5e6f770 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/incorrectCase.errors.sensitive.osx.txt @@ -0,0 +1,2 @@ +3:1:Type IncorrectCaseType unavailable +-1:-1:File not found diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 0539f33f..4f834e7a 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -50,6 +50,16 @@ DEFINE_BOOL_CONFIG_OPTION(qmlCheckTypes, QML_CHECK_TYPES) +static inline bool isCaseSensitiveFileSystem(const QString &path) { + Q_UNUSED(path) +#if defined(Q_OS_OSX) + 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 @@ -404,13 +414,15 @@ void tst_qdeclarativelanguage::errors_data() #endif 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" + + const QString expectedError = isCaseSensitiveFileSystem(dataDirectory()) ? +#if defined(Q_OS_OSX) + QStringLiteral("incorrectCase.errors.sensitive.osx.txt") : #else - << "incorrectCase.errors.sensitive.txt" + QStringLiteral("incorrectCase.errors.sensitive.txt") : #endif - << false; + 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; @@ -1837,11 +1849,9 @@ void tst_qdeclarativelanguage::importIncorrectCase() QList<QDeclarativeError> 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); } |