tests/auto/qresourceengine/tst_qresourceengine.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
    60     void checkStructure_data();
    60     void checkStructure_data();
    61     void checkStructure();
    61     void checkStructure();
    62     void searchPath_data();
    62     void searchPath_data();
    63     void searchPath();
    63     void searchPath();
    64     void doubleSlashInRoot();
    64     void doubleSlashInRoot();
       
    65     void setLocale();
    65 
    66 
    66 private:
    67 private:
    67     QString builddir;
    68     QString builddir;
    68 };
    69 };
    69 
    70 
   458 {
   459 {
   459     QVERIFY(QFile::exists(":/secondary_root/runtime_resource/search_file.txt"));
   460     QVERIFY(QFile::exists(":/secondary_root/runtime_resource/search_file.txt"));
   460     QVERIFY(QFile::exists("://secondary_root/runtime_resource/search_file.txt"));
   461     QVERIFY(QFile::exists("://secondary_root/runtime_resource/search_file.txt"));
   461 }
   462 }
   462 
   463 
       
   464 void tst_QResourceEngine::setLocale()
       
   465 {
       
   466     QLocale::setDefault(QLocale::c());
       
   467 
       
   468     // default constructed QResource gets the default locale
       
   469     QResource resource;
       
   470     resource.setFileName("aliasdir/aliasdir.txt");
       
   471     QVERIFY(!resource.isCompressed());
       
   472 
       
   473     // change the default locale and make sure it doesn't affect the resource
       
   474     QLocale::setDefault(QLocale("de_CH"));
       
   475     QVERIFY(!resource.isCompressed());
       
   476 
       
   477     // then explicitly set the locale on qresource
       
   478     resource.setLocale(QLocale("de_CH"));
       
   479     QVERIFY(resource.isCompressed());
       
   480 
       
   481     // the reset the default locale back
       
   482     QLocale::setDefault(QLocale::system());
       
   483 }
       
   484 
   463 QTEST_MAIN(tst_QResourceEngine)
   485 QTEST_MAIN(tst_QResourceEngine)
   464 
   486 
   465 #include "tst_qresourceengine.moc"
   487 #include "tst_qresourceengine.moc"
   466 
   488