summaryrefslogtreecommitdiffstats
path: root/tests/auto
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
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')
-rw-r--r--tests/auto/qtranslator/i18n/hellotr_en.qmbin0 -> 230 bytes
-rw-r--r--tests/auto/qtranslator/qtranslator.pro1
-rw-r--r--tests/auto/qtranslator/tst_qtranslator.cpp40
3 files changed, 39 insertions, 2 deletions
diff --git a/tests/auto/qtranslator/i18n/hellotr_en.qm b/tests/auto/qtranslator/i18n/hellotr_en.qm
new file mode 100644
index 0000000..cc42afe
--- /dev/null
+++ b/tests/auto/qtranslator/i18n/hellotr_en.qm
Binary files differ
diff --git a/tests/auto/qtranslator/qtranslator.pro b/tests/auto/qtranslator/qtranslator.pro
index 5b742f7..8ab1fd3 100644
--- a/tests/auto/qtranslator/qtranslator.pro
+++ b/tests/auto/qtranslator/qtranslator.pro
@@ -4,6 +4,7 @@ RESOURCES += qtranslator.qrc
wince*|symbian: {
addFiles.sources = hellotr_la.qm msgfmt_from_po.qm
+ addFiles.sources += i18n
addFiles.path = .
DEPLOYMENT += addFiles
}
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());
}