summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucie GĂ©rard <lucie.gerard@qt.io>2021-07-01 14:11:48 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-07-02 11:58:26 +0000
commit649e92d86a975ee12d6a3ef78f4dd4e707dcd18c (patch)
tree6063c023735711cdb5bf599bb1d8deefd9363f22
parent8f18ab55ee6b4963a7234ec5dd9a2b65879d3153 (diff)
lupdate/clang: Add test for same line comments
Change-Id: I340f75cbf02d82a70d264e52386e10327acafee9 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 6a706c7e0c7ae32d1943a5b355649f7af0f4adae) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.pro1
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.ts.result44
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_sameLineComments.cpp54
3 files changed, 99 insertions, 0 deletions
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.pro
index e79bee4ea..2aeddf642 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.pro
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.pro
@@ -1,5 +1,6 @@
SOURCES += test_QT_TR_NOOP_context.cpp
SOURCES += test_QT_TR_NOOP_context_bis.cpp
SOURCES += test_isolatedComments.cpp
+SOURCES += test_sameLineComments.cpp
TRANSLATIONS = project.ts
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.ts.result
index 10e9817ad..d4ebe1837 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.ts.result
@@ -2,6 +2,50 @@
<!DOCTYPE TS>
<TS version="2.1">
<context>
+ <name>CommentOnSameLineExtraComment</name>
+ <message>
+ <location filename="test_sameLineComments.cpp" line="46"/>
+ <source>extra comment before translation. , and = in between</source>
+ <extracomment>other extra comment</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="test_sameLineComments.cpp" line="47"/>
+ <source>extra comment before translation. = in between</source>
+ <extracomment>extra2</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="test_sameLineComments.cpp" line="50"/>
+ <source>extra comment before translation</source>
+ <extracomment>extra3</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="test_sameLineComments.cpp" line="53"/>
+ <source>extra comment before translation. ; in between</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>CommentOnSameLineMetaDataComment</name>
+ <message id="other metaData">
+ <location filename="test_sameLineComments.cpp" line="35"/>
+ <source>meta data comment before translation. , and = in between</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message id="metaData2">
+ <location filename="test_sameLineComments.cpp" line="36"/>
+ <source>meta data comment before translation. = in between</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message id="metaData3">
+ <location filename="test_sameLineComments.cpp" line="39"/>
+ <source>meta data comment before translation</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
<name>Foo</name>
<message>
<location filename="test_QT_TR_NOOP_context.cpp" line="37"/>
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_sameLineComments.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_sameLineComments.cpp
new file mode 100644
index 000000000..b5bf55f47
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_sameLineComments.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QtCore>
+
+class CommentOnSameLineMetaDataComment
+{
+ Q_OBJECT
+ //= other metaData
+ void hello(int something /*= metaData1 */, QString str = tr("meta data comment before translation. , and = in between"));
+ void hellobis(/*= metaData2 */QString str = tr("meta data comment before translation. = in between"));
+ void hellobiss()
+ {
+ hellobis(/*= metaData3*/ tr("meta data comment before translation"));
+ }
+};
+class CommentOnSameLineExtraComment
+{
+ Q_OBJECT
+ //: other extra comment
+ void hello(int something /*: extra1 */, QString str = tr("extra comment before translation. , and = in between"));
+ void hellobis(/*: extra2 */QString str = tr("extra comment before translation. = in between"));
+ void hellobiss()
+ {
+ hellobis(/*: extra3*/ tr("extra comment before translation"));
+ }
+ //: other extra comment
+ QString toto/*: extra4*/; QString titi = tr("extra comment before translation. ; in between");
+};