diff options
Diffstat (limited to 'tests/auto/qtranslator')
-rw-r--r-- | tests/auto/qtranslator/i18n/hellotr_en.qm | bin | 0 -> 230 bytes | |||
-rw-r--r-- | tests/auto/qtranslator/tst_qtranslator.cpp | 40 |
2 files changed, 38 insertions, 2 deletions
diff --git a/tests/auto/qtranslator/i18n/hellotr_en.qm b/tests/auto/qtranslator/i18n/hellotr_en.qm Binary files differnew file mode 100644 index 0000000..cc42afe --- /dev/null +++ b/tests/auto/qtranslator/i18n/hellotr_en.qm diff --git a/tests/auto/qtranslator/tst_qtranslator.cpp b/tests/auto/qtranslator/tst_qtranslator.cpp index 8e2ed15..6f65e6a 100644 --- a/tests/auto/qtranslator/tst_qtranslator.cpp +++ b/tests/auto/qtranslator/tst_qtranslator.cpp @@ -66,6 +66,10 @@ protected: private slots: void load(); void load2(); + void loadSubdir(); + void loadSubdir2(); + void loadSubdir3(); + void loadSubdir4(); void threadLoad(); void testLanguageChange(); void plural(); @@ -124,6 +128,38 @@ void tst_QTranslator::load2() QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!")); } +void tst_QTranslator::loadSubdir() +{ + QTranslator tor( 0 ); + tor.load("hellotr_en_GB", "i18n"); + QVERIFY(!tor.isEmpty()); + QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!")); +} + +void tst_QTranslator::loadSubdir2() +{ + QTranslator tor( 0 ); + tor.load("i18n/hellotr_en_GB"); + QVERIFY(!tor.isEmpty()); + QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!")); +} + +void tst_QTranslator::loadSubdir3() +{ + QTranslator tor( 0 ); + tor.load(QString(QLatin1String("i18n%1hellotr_en_GB")).arg(QDir::separator())); + QVERIFY(!tor.isEmpty()); + QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!")); +} + +void tst_QTranslator::loadSubdir4() +{ + QTranslator tor( 0 ); + tor.load("./hellotr_en_GB", "i18n"); + QVERIFY(!tor.isEmpty()); + QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!")); +} + class TranslatorThread : public QThread { void run() { @@ -249,10 +285,10 @@ void tst_QTranslator::loadFromResource() void tst_QTranslator::loadDirectory() { - QVERIFY(QFileInfo("../qtranslator").isDir()); + QVERIFY(QFileInfo("i18n").isDir()); QTranslator tor; - tor.load("qtranslator", ".."); + tor.load("qtranslator", "i18n"); QVERIFY(tor.isEmpty()); } |