summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qmllanguage
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-10-14 05:05:18 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-10-14 05:05:18 (GMT)
commit176698a91d3b2256a093785967c6706328981af4 (patch)
tree8c94a018b4e12a81b1b9ee4ae2e5853010435606 /tests/auto/declarative/qmllanguage
parent513cc4be0bec4a5fb303062ecbecf87708dc0e9b (diff)
downloadQt-176698a91d3b2256a093785967c6706328981af4.zip
Qt-176698a91d3b2256a093785967c6706328981af4.tar.gz
Qt-176698a91d3b2256a093785967c6706328981af4.tar.bz2
Force QML files to be always UTF-8.
Ensure test works in all locales.
Diffstat (limited to 'tests/auto/declarative/qmllanguage')
-rw-r--r--tests/auto/declarative/qmllanguage/data/I18nType30.qml (renamed from tests/auto/declarative/qmllanguage/data/I18nÁâãäå.qml)0
-rw-r--r--tests/auto/declarative/qmllanguage/data/i18nType.qml2
-rw-r--r--tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp30
3 files changed, 26 insertions, 6 deletions
diff --git a/tests/auto/declarative/qmllanguage/data/I18nÁâãäå.qml b/tests/auto/declarative/qmllanguage/data/I18nType30.qml
index 42dbc69..42dbc69 100644
--- a/tests/auto/declarative/qmllanguage/data/I18nÁâãäå.qml
+++ b/tests/auto/declarative/qmllanguage/data/I18nType30.qml
diff --git a/tests/auto/declarative/qmllanguage/data/i18nType.qml b/tests/auto/declarative/qmllanguage/data/i18nType.qml
index 11ef895..d7954ef 100644
--- a/tests/auto/declarative/qmllanguage/data/i18nType.qml
+++ b/tests/auto/declarative/qmllanguage/data/i18nType.qml
@@ -1 +1 @@
-I18nÁâãäå { }
+I18nTypeÁâãäå { }
diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
index b99d040..b68d9bf 100644
--- a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
+++ b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
@@ -24,6 +24,8 @@ public:
}
private slots:
+ void initTestCase();
+ void cleanupTestCase();
void errors_data();
void errors();
@@ -116,6 +118,24 @@ inline QUrl TEST_FILE(const char *filename)
return TEST_FILE(QLatin1String(filename));
}
+void tst_qmllanguage::initTestCase()
+{
+ // Create locale-specific file
+ // For POSIX, this will just be data/I18nType.qml, since POSIX is 7-bit
+ // For iso8859-1 locale, this will just be data/I18nType?????.qml where ????? is 5 8-bit characters
+ // For utf-8 locale, this will be data/I18nType??????????.qml where ?????????? is 5 8-bit characters, UTF-8 encoded
+ QFile in(TEST_FILE(QLatin1String("I18nType30.qml")).toLocalFile());
+ QVERIFY(in.open(QIODevice::ReadOnly));
+ QFile out(TEST_FILE(QString::fromUtf8("I18nType\303\241\303\242\303\243\303\244\303\245.qml")).toLocalFile());
+ QVERIFY(out.open(QIODevice::WriteOnly));
+ out.write(in.readAll());
+}
+
+void tst_qmllanguage::cleanupTestCase()
+{
+ QVERIFY(QFile::remove(TEST_FILE(QString::fromUtf8("I18nType\303\241\303\242\303\243\303\244\303\245.qml")).toLocalFile()));
+}
+
void tst_qmllanguage::errors_data()
{
QTest::addColumn<QString>("file");
@@ -686,11 +706,11 @@ void tst_qmllanguage::i18n_data()
{
QTest::addColumn<QString>("file");
QTest::addColumn<QString>("stringProperty");
- QTest::newRow("i18nStrings") << "i18nStrings.qml" << QString::fromUtf8("Test áâãäå (5 accented 'a' letters)");
- QTest::newRow("i18nDeclaredPropertyNames") << "i18nDeclaredPropertyNames.qml" << QString::fromUtf8("Test áâãäå: 10");
- QTest::newRow("i18nDeclaredPropertyUse") << "i18nDeclaredPropertyUse.qml" << QString::fromUtf8("Test áâãäå: 15");
- QTest::newRow("i18nScript") << "i18nScript.qml" << QString::fromUtf8("Test áâãäå: 20");
- QTest::newRow("i18nType") << "i18nType.qml" << QString::fromUtf8("Test áâãäå: 30");
+ QTest::newRow("i18nStrings") << "i18nStrings.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245 (5 accented 'a' letters)");
+ QTest::newRow("i18nDeclaredPropertyNames") << "i18nDeclaredPropertyNames.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 10");
+ QTest::newRow("i18nDeclaredPropertyUse") << "i18nDeclaredPropertyUse.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 15");
+ QTest::newRow("i18nScript") << "i18nScript.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 20");
+ QTest::newRow("i18nType") << "i18nType.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 30");
}
void tst_qmllanguage::i18n()