summaryrefslogtreecommitdiff
path: root/tests/auto/linguist/lupdate/testdata/good/lacksqobject_clang_parser
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2020-09-29 11:26:38 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-06-17 15:46:40 +0000
commit7eac57efbd9046307bc544a34e2bb9a56455fdb2 (patch)
tree008d7843740a5e0fc782d0c6b96667a6821b6a4e /tests/auto/linguist/lupdate/testdata/good/lacksqobject_clang_parser
parent1ed13c6e691eea03656d64d82d481bbd1d37ae2e (diff)
downloadqttools-7eac57efbd9046307bc544a34e2bb9a56455fdb2.tar.gz
Adapt and run the lupdate tests for the clang-based lupdate too
We now run the lupdate autotests once with the "classic" lupdate and once with the clang-based lupdate, if Qt was built with clangcpp support. Most of the source code need to be made compilable as the new parser can only run on compilable code. In some cases the results for the new parser are expected to be different. In such case a dedicated directory is created. lupdate/clang prints warning messages with native separators. Adjust our test data to accept paths with slashes or backslashes. Task-number: QTBUG-87090 Change-Id: I526137f7f918461939efed57b25378109a273615 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit d012c2f69cffadb8d34733156eacf08a5a77d1be) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto/linguist/lupdate/testdata/good/lacksqobject_clang_parser')
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/lacksqobject_clang_parser/expectedoutput.txt0
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/lacksqobject_clang_parser/main.cpp75
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/lacksqobject_clang_parser/project.pro3
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/lacksqobject_clang_parser/project.ts.result31
4 files changed, 109 insertions, 0 deletions
diff --git a/tests/auto/linguist/lupdate/testdata/good/lacksqobject_clang_parser/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/lacksqobject_clang_parser/expectedoutput.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/lacksqobject_clang_parser/expectedoutput.txt
diff --git a/tests/auto/linguist/lupdate/testdata/good/lacksqobject_clang_parser/main.cpp b/tests/auto/linguist/lupdate/testdata/good/lacksqobject_clang_parser/main.cpp
new file mode 100644
index 000000000..d8e7db2a8
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/lacksqobject_clang_parser/main.cpp
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite 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$
+**
+****************************************************************************/
+
+// IMPORTANT!!!! If you want to add testdata to this file,
+// always add it to the end in order to not change the linenumbers of translations!!!
+
+#define QTCORE <QtCore>
+#include QTCORE // Hidden from lupdate, but compiles
+
+//
+// Test 'lacks Q_OBJECT' reporting on namespace scopes
+//
+
+class B : public QObject {
+ //Q_OBJECT
+ void foo();
+};
+
+void B::foo() {
+ tr("Bla", "::B");
+}
+
+
+class C : public QObject {
+ //Q_OBJECT
+ void foo() {
+ tr("Bla", "::C");
+ }
+};
+
+
+namespace nsB {
+
+ class B : public QObject {
+ //Q_OBJECT
+ void foo();
+ };
+
+ void B::foo() {
+ tr("Bla", "nsB::B");
+ }
+
+ class C : public QObject {
+ //Q_OBJECT
+ void foo() {
+ tr("Bla", "nsB::C");
+ }
+ };
+}
+
diff --git a/tests/auto/linguist/lupdate/testdata/good/lacksqobject_clang_parser/project.pro b/tests/auto/linguist/lupdate/testdata/good/lacksqobject_clang_parser/project.pro
new file mode 100644
index 000000000..759bea068
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/lacksqobject_clang_parser/project.pro
@@ -0,0 +1,3 @@
+SOURCES = main.cpp
+
+TRANSLATIONS = project.ts
diff --git a/tests/auto/linguist/lupdate/testdata/good/lacksqobject_clang_parser/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/lacksqobject_clang_parser/project.ts.result
new file mode 100644
index 000000000..66a33a320
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/lacksqobject_clang_parser/project.ts.result
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1">
+<context>
+ <name>QObject</name>
+ <message>
+ <location filename="main.cpp" line="45"/>
+ <source>Bla</source>
+ <comment>::B</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="52"/>
+ <source>Bla</source>
+ <comment>::C</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="65"/>
+ <source>Bla</source>
+ <comment>nsB::B</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="71"/>
+ <source>Bla</source>
+ <comment>nsB::C</comment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>