summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtranslator/tst_qtranslator.cpp
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-11-07 15:42:42 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2011-11-07 16:12:51 (GMT)
commit865ad5053f053c9274973bb07e9f0ca04fd043d3 (patch)
tree9b13e3a7580b9ae8dee510b7cecb7d136dd7f659 /tests/auto/qtranslator/tst_qtranslator.cpp
parent3342cd1a4003912dfb419dbe4d3babd1f9c30173 (diff)
downloadQt-865ad5053f053c9274973bb07e9f0ca04fd043d3.zip
Qt-865ad5053f053c9274973bb07e9f0ca04fd043d3.tar.gz
Qt-865ad5053f053c9274973bb07e9f0ca04fd043d3.tar.bz2
symbian - handle path being passed as part of filename in QTranslator
Although incorrect API usage, this was a regression from 4.7.3 behaviour Task-number: QTBUG-22489 Reviewed-by: mread
Diffstat (limited to 'tests/auto/qtranslator/tst_qtranslator.cpp')
-rw-r--r--tests/auto/qtranslator/tst_qtranslator.cpp40
1 files changed, 38 insertions, 2 deletions
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());
}