diff -r 56cd8111b7f7 -r 41300fa6a67c tests/auto/qresourceengine/tst_qresourceengine.cpp --- a/tests/auto/qresourceengine/tst_qresourceengine.cpp Tue Jan 26 12:42:25 2010 +0200 +++ b/tests/auto/qresourceengine/tst_qresourceengine.cpp Tue Feb 02 00:43:10 2010 +0200 @@ -62,6 +62,7 @@ void searchPath_data(); void searchPath(); void doubleSlashInRoot(); + void setLocale(); private: QString builddir; @@ -460,6 +461,27 @@ 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"