summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohnny Jazeix <jazeix@gmail.com>2023-02-04 22:15:06 +0100
committerJohnny Jazeix <jazeix@gmail.com>2023-02-17 19:13:44 +0100
commitd8dad5d13cd35a298b0fb7f489f552de2c5f175d (patch)
treead8afd7bbb4aebb33742988a16069c3120cb6ffd /tests
parentda526cfbfd97e662301965484241a6e9311d7fd9 (diff)
downloadqttools-d8dad5d13cd35a298b0fb7f489f552de2c5f175d.tar.gz
Handle text in quotes in extra comments in lupdate
Allows to have text in extra comment within quotes that will be kept intact when running lupdate. Fixes: QTBUG-110630 Co-authored-by: Kai Köhne <kai.koehne@qt.io> Change-Id: I267e779193f168a8af067b927735991f2c512145 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp9
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result9
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsejs/main.js3
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsejs/project.ts.result6
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml3
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result6
6 files changed, 36 insertions, 0 deletions
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
index a1d4ed4fe..43b493203 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
@@ -709,3 +709,12 @@ class QTBUG99415 : QObject {
};
const QString QTBUG99415::text2() const noexcept { return tr("text2"); }
+
+// QTBUG-110630: Support quoting in extras field to allow whitespace preservation
+class QTBUG110630 : QObject {
+ Q_OBJECT
+ const QString txt() {
+ //~ quoted " string with spaces "
+ tr("translation with extras-quoted field");
+ }
+};
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 f21258d87..bf3c20877 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
@@ -422,6 +422,15 @@ backslashed \ stuff.</source>
</message>
</context>
<context>
+ <name>QTBUG110630</name>
+ <message>
+ <location filename="main.cpp" line="718"/>
+ <source>translation with extras-quoted field</source>
+ <translation type="unfinished"></translation>
+ <extra-quoted> string with spaces </extra-quoted>
+ </message>
+</context>
+<context>
<name>QTBUG99415</name>
<message>
<location filename="main.cpp" line="707"/>
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejs/main.js b/tests/auto/linguist/lupdate/testdata/good/parsejs/main.js
index 9f61cea8f..964ec72a1 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsejs/main.js
+++ b/tests/auto/linguist/lupdate/testdata/good/parsejs/main.js
@@ -89,3 +89,6 @@ var more_greeting_strings = [ QT_TRID_NOOP("qtn_needle"), QT_TRID_NOOP("qtn_hays
//: qsTrId() with comment, meta-data and plurals.
//~ well-tested True
qsTrId("qtn_bar_baz", 10);
+
+//~ quoted " string with spaces "
+qsTr("translation with extras-quoted field");
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejs/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsejs/project.ts.result
index 8df655fec..b505d3608 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsejs/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/parsejs/project.ts.result
@@ -191,5 +191,11 @@
<numerusform></numerusform>
</translation>
</message>
+ <message>
+ <location filename="main.js" line="94"/>
+ <source>translation with extras-quoted field</source>
+ <translation type="unfinished"></translation>
+ <extra-quoted> string with spaces </extra-quoted>
+ </message>
</context>
</TS>
diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml b/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml
index c966fa112..e25750193 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml
+++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml
@@ -96,5 +96,8 @@ QtObject {
//% "Source text"
qsTrId("qtn_baz_biz");
+
+ //~ quoted " string with spaces "
+ qsTr("translation with extras-quoted field");
}
}
diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result
index ce57bd44d..ecdfc8b34 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result
@@ -196,5 +196,11 @@
<numerusform></numerusform>
</translation>
</message>
+ <message>
+ <location filename="main.qml" line="101"/>
+ <source>translation with extras-quoted field</source>
+ <translation type="unfinished"></translation>
+ <extra-quoted> string with spaces </extra-quoted>
+ </message>
</context>
</TS>