diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-12-17 14:11:42 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-12-17 17:26:05 (GMT) |
commit | d64c29e18cedace91bea31d83b62e5c0b6c6049e (patch) | |
tree | 9d577988e6df0b180c286fb384cc4baf1b574e03 /tests/auto | |
parent | face84c73a2196432020dda18755af7955d2de39 (diff) | |
download | Qt-d64c29e18cedace91bea31d83b62e5c0b6c6049e.zip Qt-d64c29e18cedace91bea31d83b62e5c0b6c6049e.tar.gz Qt-d64c29e18cedace91bea31d83b62e5c0b6c6049e.tar.bz2 |
Fixed QResource to respect the explicitely set locale
When using QResource directly, the loader should respect the locale that the
user asked to use for the resource.
Reviewed-by: João Abecasis
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qresourceengine/tst_qresourceengine.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qresourceengine/tst_qresourceengine.cpp b/tests/auto/qresourceengine/tst_qresourceengine.cpp index cc6eda3..ed7de23 100644 --- a/tests/auto/qresourceengine/tst_qresourceengine.cpp +++ b/tests/auto/qresourceengine/tst_qresourceengine.cpp @@ -62,6 +62,7 @@ private slots: void searchPath_data(); void searchPath(); void doubleSlashInRoot(); + void setLocale(); private: QString builddir; @@ -460,6 +461,27 @@ void tst_QResourceEngine::doubleSlashInRoot() QVERIFY(QFile::exists("://secondary_root/runtime_resource/search_file.txt")); } +void tst_QResourceEngine::setLocale() +{ + QLocale::setDefault(QLocale::c()); + + // default constructed QResource gets the default locale + QResource resource; + resource.setFileName("aliasdir/aliasdir.txt"); + QVERIFY(!resource.isCompressed()); + + // change the default locale and make sure it doesn't affect the resource + QLocale::setDefault(QLocale("de_CH")); + QVERIFY(!resource.isCompressed()); + + // then explicitly set the locale on qresource + resource.setLocale(QLocale("de_CH")); + QVERIFY(resource.isCompressed()); + + // the reset the default locale back + QLocale::setDefault(QLocale::system()); +} + QTEST_MAIN(tst_QResourceEngine) #include "tst_qresourceengine.moc" |