summaryrefslogtreecommitdiff
path: root/tests/auto/linguist
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-05-25 11:03:48 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-05-25 11:03:48 +0200
commitb558ecb8f2a701d2c416c46ca806e199411cf5e2 (patch)
treeb7427b364c3fd2fc912c86e25bbf0017cccd4214 /tests/auto/linguist
parente0017be47524c12f93ec82849371d1028de738b6 (diff)
parenta6ed9b418d1b4464f088b378e5bdb96ec420db6c (diff)
downloadqttools-b558ecb8f2a701d2c416c46ca806e199411cf5e2.tar.gz
Merge remote-tracking branch 'origin/5.4' into 5.5
Conflicts: .qmake.conf Change-Id: I47fe486745efad44537255a56087f4ec0a3b2e82
Diffstat (limited to 'tests/auto/linguist')
-rw-r--r--tests/auto/linguist/lconvert/data/idxmerge-add.ts17
-rw-r--r--tests/auto/linguist/lconvert/data/idxmerge.ts17
-rw-r--r--tests/auto/linguist/lconvert/data/idxmerge.ts.out22
-rw-r--r--tests/auto/linguist/lconvert/tst_lconvert.cpp12
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp16
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result7
6 files changed, 91 insertions, 0 deletions
diff --git a/tests/auto/linguist/lconvert/data/idxmerge-add.ts b/tests/auto/linguist/lconvert/data/idxmerge-add.ts
new file mode 100644
index 000000000..bc4910ad7
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/idxmerge-add.ts
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="es_ES">
+<context>
+ <name>a</name>
+ <message>
+ <location filename="a.cpp" line="193"/>
+ <source>Second String</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location filename="a.cpp" line="380"/>
+ <source>Duplicated String</source>
+ <translation></translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lconvert/data/idxmerge.ts b/tests/auto/linguist/lconvert/data/idxmerge.ts
new file mode 100644
index 000000000..0784355a4
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/idxmerge.ts
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="es_ES">
+<context>
+ <name>a</name>
+ <message>
+ <location filename="a.cpp" line="93"/>
+ <source>First String</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location filename="a.cpp" line="380"/>
+ <source>Duplicated String</source>
+ <translation></translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lconvert/data/idxmerge.ts.out b/tests/auto/linguist/lconvert/data/idxmerge.ts.out
new file mode 100644
index 000000000..fa4c7ddec
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/idxmerge.ts.out
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="es_ES">
+<context>
+ <name>a</name>
+ <message>
+ <location filename="a.cpp" line="93"/>
+ <source>First String</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location filename="a.cpp" line="193"/>
+ <source>Second String</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location filename="a.cpp" line="380"/>
+ <source>Duplicated String</source>
+ <translation></translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp
index 30aa1fd5f..f0c683f5f 100644
--- a/tests/auto/linguist/lconvert/tst_lconvert.cpp
+++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp
@@ -53,6 +53,7 @@ private slots:
void chains_data();
void chains();
#endif
+ void merge();
private:
void doWait(QProcess *cvt, int stage);
@@ -327,6 +328,17 @@ void tst_lconvert::roundtrips()
convertRoundtrip(fileName, stations, args);
}
+void tst_lconvert::merge()
+{
+ QProcess cvt;
+ QStringList args;
+ args << (dataDir + "idxmerge.ts") << (dataDir + "idxmerge-add.ts");
+ cvt.start(binDir + "/lconvert", args, QIODevice::ReadWrite | QIODevice::Text);
+ doWait(&cvt, 1);
+ if (!QTest::currentTestFailed())
+ doCompare(&cvt, dataDir + "idxmerge.ts.out");
+}
+
QTEST_APPLESS_MAIN(tst_lconvert)
#include "tst_lconvert.moc"
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
index 8aa2b0148..8b91a7761 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
@@ -394,3 +394,19 @@ Class42::hello(int something /*= 17 */, QString str = Class42::tr("eyo"))
// test TR_EXCLUDE
#include "notincluded.cpp"
+
+
+
+// failure to update index on insertion messes up subsequent de-duplication
+int dupeFail()
+{
+ // First just the Id.
+ qtTrId("dupe_id");
+
+ // Then with source
+ //% "This is the source"
+ qtTrId("dupe_id");
+
+ // Finally, same source, but without ID.
+ QCoreApplication::translate("", "This is the source");
+}
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
index c0a4a83b2..0c0c1b511 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
@@ -24,6 +24,13 @@ backslashed \ stuff.</source>
<extracomment>This is a message without a source string</extracomment>
<translation type="unfinished"></translation>
</message>
+ <message id="dupe_id">
+ <location filename="main.cpp" line="404"/>
+ <location filename="main.cpp" line="408"/>
+ <location filename="main.cpp" line="411"/>
+ <source>This is the source</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>Bogus</name>