summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2019-07-10 14:17:01 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2019-07-10 17:01:49 +0200
commit6a832f5474d3b4f789e4bcdebcd425e5ec98423f (patch)
tree372a5f0f688eb90e4e51d096fc7b81d278de0489 /tests
parent089da2d1fd40a0e827e985f1893c8ea8c2823759 (diff)
lrelease: Fix crash on projects without TRANSLATIONS assignment
Add missing nullptr check. Fixes: QTBUG-76930 Change-Id: I2dc99db43b12cebc6fbe9024057ba963e0ae470f Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/linguist/lrelease/testdata/no-translations.pro1
-rw-r--r--tests/auto/linguist/lrelease/tst_lrelease.cpp12
2 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/linguist/lrelease/testdata/no-translations.pro b/tests/auto/linguist/lrelease/testdata/no-translations.pro
new file mode 100644
index 000000000..154b26628
--- /dev/null
+++ b/tests/auto/linguist/lrelease/testdata/no-translations.pro
@@ -0,0 +1 @@
+TEMPLATE = app
diff --git a/tests/auto/linguist/lrelease/tst_lrelease.cpp b/tests/auto/linguist/lrelease/tst_lrelease.cpp
index 19ed47f52..d392e51db 100644
--- a/tests/auto/linguist/lrelease/tst_lrelease.cpp
+++ b/tests/auto/linguist/lrelease/tst_lrelease.cpp
@@ -51,6 +51,7 @@ private slots:
void idbased();
void markuntranslated();
void dupes();
+ void noTranslations();
private:
void doCompare(const QStringList &actual, const QString &expectedFn);
@@ -207,5 +208,16 @@ void tst_lrelease::dupes()
doCompare(QString(proc.readAllStandardError()).trimmed().split('\n'), dataDir + "dupes.errors");
}
+void tst_lrelease::noTranslations()
+{
+ QProcess proc;
+ proc.start(lrelease, { dataDir + "no-translations.pro" });
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(proc.exitCode(), 0);
+ auto stderrOutput = proc.readAllStandardError();
+ QVERIFY(stderrOutput.contains("lrelease warning: Met no 'TRANSLATIONS' entry in project file"));
+}
+
QTEST_MAIN(tst_lrelease)
#include "tst_lrelease.moc"