summaryrefslogtreecommitdiffstats
path: root/tests/auto/linguist
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/linguist')
-rw-r--r--tests/auto/linguist/lconvert/.gitignore2
-rw-r--r--tests/auto/linguist/lrelease/.gitignore2
-rw-r--r--tests/auto/linguist/lrelease/testdata/idbased.ts21
-rw-r--r--tests/auto/linguist/lupdate/.gitignore4
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result4
-rw-r--r--tests/auto/linguist/lupdate/tst_lupdate.cpp25
6 files changed, 49 insertions, 9 deletions
diff --git a/tests/auto/linguist/lconvert/.gitignore b/tests/auto/linguist/lconvert/.gitignore
new file mode 100644
index 000000000..042d7ac30
--- /dev/null
+++ b/tests/auto/linguist/lconvert/.gitignore
@@ -0,0 +1,2 @@
+tst_lconvert
+data/plural-?.po
diff --git a/tests/auto/linguist/lrelease/.gitignore b/tests/auto/linguist/lrelease/.gitignore
new file mode 100644
index 000000000..cf7059c4b
--- /dev/null
+++ b/tests/auto/linguist/lrelease/.gitignore
@@ -0,0 +1,2 @@
+tst_lrelease
+testdata/*.qm
diff --git a/tests/auto/linguist/lrelease/testdata/idbased.ts b/tests/auto/linguist/lrelease/testdata/idbased.ts
new file mode 100644
index 000000000..61497deec
--- /dev/null
+++ b/tests/auto/linguist/lrelease/testdata/idbased.ts
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0">
+<context>
+ <name></name>
+ <message id="test_id">
+ <source>Completely irrelevant source text</source>
+ <translation>This is a test string.</translation>
+ </message>
+ <message id="untranslated_id">
+ <source>This has no translation.</source>
+ </message>
+ <message id="this_another_id">
+ <source>Foo bar.</source>
+ <comment>Warn me!</comment>
+ </message>
+ <message>
+ <source>Drop me!</source>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lupdate/.gitignore b/tests/auto/linguist/lupdate/.gitignore
new file mode 100644
index 000000000..4ba5b79ec
--- /dev/null
+++ b/tests/auto/linguist/lupdate/.gitignore
@@ -0,0 +1,4 @@
+tst_lupdate
+testdata/good/*/project.ts
+testdata/output_ts/toplevel/library/tools/translations/project.ts
+testdata/recursivescan/*.ts
diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result
index 151a18ed5..f2d109b57 100644
--- a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
-<TS version="1.1">
+<TS version="2.0">
<context>
<name>QApplication</name>
<message>
- <location filename="../src/main.cpp" line="13"/>
+ <location filename="../src/main.cpp" line="10"/>
<source>QT_LAYOUT_DIRECTION</source>
<comment>Translate this string to the string &apos;LTR&apos; in left-to-right languages or to &apos;RTL&apos; in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout.</comment>
<translation type="unfinished"></translation>
diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp
index fcf85825b..97400d934 100644
--- a/tests/auto/linguist/lupdate/tst_lupdate.cpp
+++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp
@@ -93,13 +93,24 @@ void tst_lupdate::doCompare(const QStringList &actual, const QString &expectedFn
} else if (i == ei) {
ei = 0;
break;
- } else if (err ? !QRegExp(expected.at(i)).exactMatch(actual.at(i)) :
- (actual.at(i) != expected.at(i))) {
- while ((ei - 1) >= i && (gi - 1) >= i &&
- (err ? QRegExp(expected.at(ei - 1)).exactMatch(actual.at(gi - 1)) :
- (actual.at(gi - 1) == expected.at(ei - 1))))
- ei--, gi--;
- break;
+ } else {
+ QString act = actual.at(i);
+ act.remove('\r');
+ if (err ? !QRegExp(expected.at(i)).exactMatch(act) :
+ (act != expected.at(i))) {
+ bool cond = true;
+ while (cond) {
+ act = actual.at(gi - 1);
+ act.remove('\r');
+ cond = (ei - 1) >= i && (gi - 1) >= i &&
+ (err ? QRegExp(expected.at(ei - 1)).exactMatch(act) :
+ (act == expected.at(ei - 1)));
+ if (cond) {
+ ei--, gi--;
+ }
+ }
+ break;
+ }
}
}
QByteArray diff;