summaryrefslogtreecommitdiffstats
path: root/tests/auto/linguist/lrelease/tst_lrelease.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/linguist/lrelease/tst_lrelease.cpp')
-rw-r--r--tests/auto/linguist/lrelease/tst_lrelease.cpp29
1 files changed, 24 insertions, 5 deletions
diff --git a/tests/auto/linguist/lrelease/tst_lrelease.cpp b/tests/auto/linguist/lrelease/tst_lrelease.cpp
index 512987d..4928a4f 100644
--- a/tests/auto/linguist/lrelease/tst_lrelease.cpp
+++ b/tests/auto/linguist/lrelease/tst_lrelease.cpp
@@ -49,16 +49,23 @@
class tst_lrelease : public QObject
{
Q_OBJECT
+
+public:
+ tst_lrelease() : binDir(QLibraryInfo::location(QLibraryInfo::BinariesPath)) {}
+
private:
private slots:
void translate();
void mixedcodecs();
void compressed();
+ void idbased();
void dupes();
private:
void doCompare(const QStringList &actual, const QString &expectedFn);
+
+ QString binDir;
};
void tst_lrelease::doCompare(const QStringList &actual, const QString &expectedFn)
@@ -111,7 +118,7 @@ void tst_lrelease::doCompare(const QStringList &actual, const QString &expectedF
void tst_lrelease::translate()
{
- QVERIFY(!QProcess::execute("lrelease testdata/translate.ts"));
+ QVERIFY(!QProcess::execute(binDir + "/lrelease testdata/translate.ts"));
QTranslator translator;
QVERIFY(translator.load("testdata/translate.qm"));
@@ -161,8 +168,8 @@ void tst_lrelease::translate()
void tst_lrelease::mixedcodecs()
{
- QVERIFY(!QProcess::execute("lrelease testdata/mixedcodecs-ts11.ts"));
- QVERIFY(!QProcess::execute("lrelease testdata/mixedcodecs-ts20.ts"));
+ QVERIFY(!QProcess::execute(binDir + "/lrelease testdata/mixedcodecs-ts11.ts"));
+ QVERIFY(!QProcess::execute(binDir + "/lrelease testdata/mixedcodecs-ts20.ts"));
QVERIFY(!QProcess::execute("cmp testdata/mixedcodecs-ts11.qm testdata/mixedcodecs-ts20.qm"));
QTranslator translator;
QVERIFY(translator.load("testdata/mixedcodecs-ts11.qm"));
@@ -176,7 +183,7 @@ void tst_lrelease::mixedcodecs()
void tst_lrelease::compressed()
{
- QVERIFY(!QProcess::execute("lrelease -compress testdata/compressed.ts"));
+ QVERIFY(!QProcess::execute(binDir + "/lrelease -compress testdata/compressed.ts"));
QTranslator translator;
QVERIFY(translator.load("testdata/compressed.qm"));
@@ -191,10 +198,22 @@ void tst_lrelease::compressed()
}
+void tst_lrelease::idbased()
+{
+ QVERIFY(!QProcess::execute(binDir + "/lrelease -idbased testdata/idbased.ts"));
+
+ QTranslator translator;
+ QVERIFY(translator.load("testdata/idbased.qm"));
+ qApp->installTranslator(&translator);
+
+ QCOMPARE(qtTrId("test_id"), QString::fromAscii("This is a test string."));
+ QCOMPARE(qtTrId("untranslated_id"), QString::fromAscii("This has no translation."));
+}
+
void tst_lrelease::dupes()
{
QProcess proc;
- proc.start("lrelease testdata/dupes.ts");
+ proc.start(binDir + "/lrelease testdata/dupes.ts");
QVERIFY(proc.waitForFinished());
QVERIFY(proc.exitStatus() == QProcess::NormalExit);
doCompare(QString(proc.readAllStandardError()).trimmed().remove('\r').split('\n'), "testdata/dupes.errors");