summaryrefslogtreecommitdiff
path: root/tests/auto/linguist/lupdate/testdata/good
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
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')
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp10
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/from_subdir/src/main.cpp5
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/from_subdir/src/main.h4
-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
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp6
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/merge_whitespace/main.cpp4
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp8
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result20
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp86
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.h66
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp109
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.h66
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/multiple_locations/finddialog.cpp12
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/multiple_locations/main.cpp27
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.ts.result4
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp4
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/notargetlanguage/main.cpp4
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parse_special_chars/main.cpp4
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecontexts/main.cpp12
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecontexts_clang_parser/main.cpp266
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecontexts_clang_parser/project.pro3
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecontexts_clang_parser/project.ts.result177
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/expectedoutput.txt4
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp152
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/included.cpp6
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp124
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/notincluded.cpp6
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result35
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp28
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.h2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp2_clang_parser/expectedoutput.txt3
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp2_clang_parser/main.cpp141
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp2_clang_parser/main.h36
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp2_clang_parser/project.pro3
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp2_clang_parser/project.ts.result83
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/expectedoutput.txt2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/finddialog.cpp169
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/included.cpp31
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/main.cpp690
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/my_include.h6
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/notincluded.cpp31
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/project.pro7
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/project.ts.result661
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parseqrc/main.cpp2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/prefix/main.cpp6
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/prefix/main.h48
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/prefix_clang_parser/main.cpp56
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/prefix_clang_parser/main.h48
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/prefix_clang_parser/project.pro3
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/prefix_clang_parser/project.ts.result47
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/preprocess/main.cpp2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/preprocess_clang_parser/expectedoutput.txt1
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/preprocess_clang_parser/main.cpp62
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/preprocess_clang_parser/project.pro3
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/preprocess_clang_parser/project.ts.result29
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsing2/a2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsing2/a.cpp2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsing2/b2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsing2/b.cpp2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsing2/e2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsing2/f/g.cpp2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsing2/include.h2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsing2/spaces/z2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsing2/variable_with_spaces2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsing2/with2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsing2/x/d2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsing2/x/variable2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/main.cpp2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpri/mac/main_mac.cpp2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/relativity.cpp2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpri/unix/main_unix.cpp2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpri/win/main_win.cpp2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/main.cpp2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/main.cpp2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingsubs/excluded/main.cpp2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/main_mac.cpp2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingsubs/sub/include/test.h2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingsubs/sub/src/test.cpp2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/main_unix.cpp2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/main_win.cpp2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/reloutput/main.cpp2
88 files changed, 3215 insertions, 378 deletions
diff --git a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp
index 169c63cd1..71ff0cc5f 100644
--- a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp
@@ -26,11 +26,11 @@
**
****************************************************************************/
-#include <QApplication>
+#include <QtWidgets/QApplication>
#include <QtGui>
#include <QtCore>
-
-
+#include <QtWidgets/QLabel>
+#include <QtWidgets/QBoxLayout>
int main(int argc, char **argv)
{
QApplication a(argc, argv);
@@ -40,8 +40,8 @@ int main(int argc, char **argv)
QLabel label1(QObject::tr("abc", "ascii"), &w);
QLabel label2(QObject::tr("æøå", "utf-8"), &w);
QLabel label2a(QObject::tr("\303\246\303\270\303\245", "utf-8 oct"), &w);
- QLabel label3(QObject::trUtf8("Für Élise", "trUtf8"), &w);
- QLabel label3a(QObject::trUtf8("F\303\274r \303\211lise", "trUtf8 oct"), &w);
+ QLabel label3(QObject::tr("Für Élise", "trUtf8"), &w); // trUtf8 is obsolete
+ QLabel label3a(QObject::tr("F\303\274r \303\211lise", "trUtf8 oct"), &w); // trUtf8 is obsolete
QBoxLayout *ly = new QVBoxLayout(&w);
ly->addWidget(&label1);
diff --git a/tests/auto/linguist/lupdate/testdata/good/from_subdir/src/main.cpp b/tests/auto/linguist/lupdate/testdata/good/from_subdir/src/main.cpp
index e96716d1f..ce02a9491 100644
--- a/tests/auto/linguist/lupdate/testdata/good/from_subdir/src/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/from_subdir/src/main.cpp
@@ -28,10 +28,11 @@
// 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!!!
-
+#include <QtWidgets/QApplication>
#include "main.h"
int main(int argc, char **argv)
{
- return QApplication::tr("string in main.cpp");
+ QString s1 = QApplication::tr("string in main.cpp");
+ return 0;
}
diff --git a/tests/auto/linguist/lupdate/testdata/good/from_subdir/src/main.h b/tests/auto/linguist/lupdate/testdata/good/from_subdir/src/main.h
index 86dac7e40..9fa813346 100644
--- a/tests/auto/linguist/lupdate/testdata/good/from_subdir/src/main.h
+++ b/tests/auto/linguist/lupdate/testdata/good/from_subdir/src/main.h
@@ -28,5 +28,5 @@
// 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!!!
-
-QT_TRANSLATE_NOOP("QApplication", "string in main.h")
+#include <QtCore>
+char dummy[] = QT_TRANSLATE_NOOP("QApplication", "string in main.h");
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>
diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp
index d03a1a009..5c66a142d 100644
--- a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp
@@ -26,7 +26,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
+#include <QtCore>
// The first line in this file should always be empty, its part of the test!!
class Foo : public QObject
{
@@ -35,8 +35,8 @@ public:
Foo();
};
-Foo::Foo(MainWindow *parent)
- : QObject(parent)
+Foo::Foo()
+ : QObject()
{
tr("This is the first entry.");
tr("A second message."); tr("And a second one on the same line.");
diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/main.cpp b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/main.cpp
index dcf785bfe..4edd90061 100644
--- a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/main.cpp
@@ -25,8 +25,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
-#include <QApplication>
+#include <QtCore>
+#include <QtWidgets/QApplication>
#include <QDebug>
int main(int argc, char **argv)
diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp
index 977445d23..e49f30efc 100644
--- a/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp
@@ -28,16 +28,18 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+#include <QtCore>
+#include <QtWidgets/QDialog>
+#include <QtWidgets/QMainWindow>
class FindDialog : public QDialog
{
Q_OBJECT
public:
- FindDialog(MainWindow *parent);
+ FindDialog(QMainWindow *parent);
void reset();
};
-
-FindDialog::FindDialog(MainWindow *parent)
+FindDialog::FindDialog(QMainWindow *parent)
: QDialog(parent)
{
QString trans = tr("Enter the text you want to find.");
diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result
index 7e23b16d6..427f9c710 100644
--- a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result
@@ -4,19 +4,19 @@
<context>
<name></name>
<message id="xx_hello">
- <location filename="finddialog.cpp" line="57"/>
+ <location filename="finddialog.cpp" line="59"/>
<source>Hello</source>
<translation>Hallo</translation>
<extra-meta>matter</extra-meta>
</message>
<message id="xx_world">
- <location filename="finddialog.cpp" line="60"/>
+ <location filename="finddialog.cpp" line="62"/>
<source>New world</source>
<oldsource>World</oldsource>
<translation type="unfinished">Welt</translation>
</message>
<message id="qtn_virtual">
- <location filename="finddialog.cpp" line="68"/>
+ <location filename="finddialog.cpp" line="70"/>
<source></source>
<extracomment>A message without source string</extracomment>
<translation></translation>
@@ -31,27 +31,27 @@
<translation></translation>
</message>
<message>
- <location filename="finddialog.cpp" line="43"/>
+ <location filename="finddialog.cpp" line="45"/>
<source>Enter the text you want to find.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="finddialog.cpp" line="44"/>
+ <location filename="finddialog.cpp" line="46"/>
<source>Search reached end of the document</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="finddialog.cpp" line="45"/>
+ <location filename="finddialog.cpp" line="47"/>
<source>Search reached start of the document</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="finddialog.cpp" line="46"/>
+ <location filename="finddialog.cpp" line="48"/>
<source>Text not found</source>
<translation>text not found (in chinese)</translation>
</message>
<message numerus="yes">
- <location filename="finddialog.cpp" line="51"/>
+ <location filename="finddialog.cpp" line="53"/>
<source>%n item(s)</source>
<comment>merge from singular to plural form</comment>
<translation type="unfinished">
@@ -59,7 +59,7 @@
</translation>
</message>
<message numerus="yes">
- <location filename="finddialog.cpp" line="52"/>
+ <location filename="finddialog.cpp" line="54"/>
<source>%n item(s)</source>
<comment>merge from a finished singular form to an unfinished plural form</comment>
<translation type="unfinished">
@@ -67,7 +67,7 @@
</translation>
</message>
<message id="new_id">
- <location filename="finddialog.cpp" line="64"/>
+ <location filename="finddialog.cpp" line="66"/>
<source>this is just some text</source>
<translation type="unfinished">Unfertige Uebersetzung</translation>
</message>
diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp
index 1e2de849e..8b5cd2dd2 100644
--- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp
@@ -27,17 +27,17 @@
****************************************************************************/
#include "finddialog.h"
-#include "mainwindow.h"
-#include "tabbedbrowser.h"
-#include "helpwindow.h"
-#include <QTextBrowser>
+
+
+
+#include <QtWidgets/QTextBrowser>
#include <QTextCursor>
-#include <QStatusBar>
-#include <QLineEdit>
+#include <QtWidgets/QStatusBar>
+#include <QtWidgets/QLineEdit>
#include <QDateTime>
-#include <QGridLayout>
-
+#include <QtWidgets/QGridLayout>
+//#include <QtWidgets/QDialog>
CaseSensitiveModel::CaseSensitiveModel(int rows, int columns, QObject *parent)
: QStandardItemModel(rows, columns, parent)
{}
@@ -50,56 +50,56 @@ QModelIndexList CaseSensitiveModel::match(const QModelIndex &start, int role, co
return QStandardItemModel::match(start, role, value, hits, flags);
}
-FindDialog::FindDialog(MainWindow *parent)
+FindDialog::FindDialog(QMainWindow *parent)
: QDialog(parent)
{
- contentsWidget = new QWidget(this);
- ui.setupUi(contentsWidget);
- ui.comboFind->setModel(new CaseSensitiveModel(0, 1, ui.comboFind));
+ auto contentsWidget = new QWidget(this);
+ //ui.setupUi(contentsWidget);
+ //ui.comboFind->setModel(new CaseSensitiveModel(0, 1, ui.comboFind));
QVBoxLayout *l = new QVBoxLayout(this);
l->setContentsMargins(QMargins());
l->setSpacing(0);
l->addWidget(contentsWidget);
- lastBrowser = 0;
- onceFound = false;
- findExpr.clear();
+ auto lastBrowser = 0;
+ auto onceFound = false;
+ //findExpr.clear();
- sb = new QStatusBar(this);
+ auto sb = new QStatusBar(this);
l->addWidget(sb);
sb->showMessage(tr("Enter the text you want to find."));
- connect(ui.findButton, SIGNAL(clicked()), this, SLOT(findButtonClicked()));
- connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(reject()));
+ //connect(ui.findButton, SIGNAL(clicked()), this, SLOT(findButtonClicked()));
+ //connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(reject()));
}
-FindDialog::~FindDialog()
-{
-}
+//FindDialog::~FindDialog()
+//{
+//}
-void FindDialog::findButtonClicked()
-{
- doFind(ui.radioForward->isChecked());
-}
+//void FindDialog::findButtonClicked()
+//{
+// doFind(ui.radioForward->isChecked());
+//}
void FindDialog::doFind(bool forward)
{
- QTextBrowser *browser = static_cast<QTextBrowser*>(mainWindow()->browsers()->currentBrowser());
- sb->clearMessage();
+ QTextBrowser *browser = NULL;// = static_cast<QTextBrowser*>(mainWindow()->browsers()->currentBrowser());
+ //sb->clearMessage();
- if (ui.comboFind->currentText() != findExpr || lastBrowser != browser)
- onceFound = false;
- findExpr = ui.comboFind->currentText();
+ //if (ui.comboFind->currentText() != findExpr || lastBrowser != browser)
+ // onceFound = false;
+ //findExpr = ui.comboFind->currentText();
- QTextDocument::FindFlags flags = 0;
+ QTextDocument::FindFlags flags;// = 0;
- if (ui.checkCase->isChecked())
- flags |= QTextDocument::FindCaseSensitively;
+ //if (ui.checkCase->isChecked())
+ // flags |= QTextDocument::FindCaseSensitively;
- if (ui.checkWords->isChecked())
- flags |= QTextDocument::FindWholeWords;
+ //if (ui.checkWords->isChecked())
+ // flags |= QTextDocument::FindWholeWords;
QTextCursor c = browser->textCursor();
if (!c.hasSelection()) {
@@ -114,28 +114,28 @@ void FindDialog::doFind(bool forward)
QTextDocument::FindFlags options;
if (forward == false)
flags |= QTextDocument::FindBackward;
-
- QTextCursor found = browser->document()->find(findExpr, c, flags);
+ bool onceFound = true;
+ QTextCursor found;// = browser->document()->find(findExpr, c, flags);
if (found.isNull()) {
if (onceFound) {
if (forward)
- statusMessage(tr("Search reached end of the document"));
+ auto a = tr("Search reached end of the document");//statusMessage(tr("Search reached end of the document"));
else
- statusMessage(tr("Search reached start of the document"));
+ auto aa = tr("Search reached start of the document");//statusMessage(tr("Search reached start of the document"));
} else {
- statusMessage(tr( "Text not found" ));
+ auto aaa = tr( "Text not found" ); //statusMessage(tr( "Text not found" ));
}
} else {
browser->setTextCursor(found);
}
onceFound |= !found.isNull();
- lastBrowser = browser;
+ auto lastBrowser = browser;
}
-bool FindDialog::hasFindExpression() const
+void FindDialog::hasFindExpression() const
{
// statusMessage(tr( "Should be obsolete" ));
//% "This is some random text"
- qtTrId("keep_id")
+ qtTrId("keep_id");
}
diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.h b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.h
new file mode 100644
index 000000000..5a1adf7eb
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Linguist 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 <QtWidgets/QTextBrowser>
+#include <QTextCursor>
+#include <QtWidgets/QStatusBar>
+#include <QtWidgets/QLineEdit>
+#include <QDateTime>
+#include <QtWidgets/QGridLayout>
+#include <QtWidgets/QDialog>
+#include <QtGui>
+#include <QtWidgets/QMainWindow>
+
+class FindDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ FindDialog(QWidget *parent = 0);
+ FindDialog(QMainWindow *parent = 0);
+ void doFind(bool forward);
+ void hasFindExpression() const;
+
+signals:
+
+public slots:
+ void find();
+
+private slots:
+ void emitFindNext();
+ void verify();
+
+private:
+ bool m_redText = false;
+};
+
+
+class CaseSensitiveModel: public QStandardItemModel
+{
+ CaseSensitiveModel(int rows, int columns, QObject *parent);
+ QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits, Qt::MatchFlags flags) const;
+};
diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp
index dd5888043..7727c9615 100644
--- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp
@@ -27,16 +27,16 @@
****************************************************************************/
#include "finddialog.h"
-#include "mainwindow.h"
-#include "tabbedbrowser.h"
-#include "helpwindow.h"
+//#include "mainwindow.h"
+//#include "tabbedbrowser.h"
+//#include "helpwindow.h"
-#include <QTextBrowser>
+#include <QtWidgets/QTextBrowser>
#include <QTextCursor>
-#include <QStatusBar>
-#include <QLineEdit>
+#include <QtWidgets/QStatusBar>
+#include <QtWidgets/QLineEdit>
#include <QDateTime>
-#include <QGridLayout>
+#include <QtWidgets/QGridLayout>
CaseSensitiveModel::CaseSensitiveModel(int rows, int columns, QObject *parent)
: QStandardItemModel(rows, columns, parent)
@@ -50,23 +50,23 @@ QModelIndexList CaseSensitiveModel::match(const QModelIndex &start, int role, co
return QStandardItemModel::match(start, role, value, hits, flags);
}
-FindDialog::FindDialog(MainWindow *parent)
+FindDialog::FindDialog(QMainWindow *parent)
: QDialog(parent)
{
- contentsWidget = new QWidget(this);
- ui.setupUi(contentsWidget);
- ui.comboFind->setModel(new CaseSensitiveModel(0, 1, ui.comboFind));
+ auto contentsWidget = new QWidget(this);
+ //ui.setupUi(contentsWidget);
+ //ui.comboFind->setModel(new CaseSensitiveModel(0, 1, ui.comboFind));
QVBoxLayout *l = new QVBoxLayout(this);
l->setContentsMargins(QMargins());
l->setSpacing(0);
l->addWidget(contentsWidget);
- lastBrowser = 0;
- onceFound = false;
- findExpr.clear();
+ auto lastBrowser = 0;
+ auto onceFound = false;
+ //findExpr.clear();
- sb = new QStatusBar(this);
+ auto sb = new QStatusBar(this);
l->addWidget(sb);
@@ -74,35 +74,35 @@ FindDialog::FindDialog(MainWindow *parent)
// then lupdate should add this one as a new one, and mark the old one as obsolete.
sb->showMessage(tr("Enter the text you want to find."));
- connect(ui.findButton, SIGNAL(clicked()), this, SLOT(findButtonClicked()));
- connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(reject()));
+ //connect(ui.findButton, SIGNAL(clicked()), this, SLOT(findButtonClicked()));
+ //connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(reject()));
}
-FindDialog::~FindDialog()
-{
-}
+//FindDialog::~FindDialog()
+//{
+//}
-void FindDialog::findButtonClicked()
-{
- doFind(ui.radioForward->isChecked());
-}
+//void FindDialog::findButtonClicked()
+//{
+ //doFind(ui.radioForward->isChecked());
+//}
void FindDialog::doFind(bool forward)
{
- QTextBrowser *browser = static_cast<QTextBrowser*>(mainWindow()->browsers()->currentBrowser());
- sb->clearMessage();
+ QTextBrowser *browser;// = static_cast<QTextBrowser*>(mainWindow()->browsers()->currentBrowser());
+ //sb->clearMessage();
- if (ui.comboFind->currentText() != findExpr || lastBrowser != browser)
- onceFound = false;
- findExpr = ui.comboFind->currentText();
+ //if (ui.comboFind->currentText() != findExpr || lastBrowser != browser)
+ // onceFound = false;
+ //findExpr = ui.comboFind->currentText();
- QTextDocument::FindFlags flags = 0;
+ //QTextDocument::FindFlags flags = 0;
- if (ui.checkCase->isChecked())
- flags |= QTextDocument::FindCaseSensitively;
+ //if (ui.checkCase->isChecked())
+ // flags |= QTextDocument::FindCaseSensitively;
- if (ui.checkWords->isChecked())
- flags |= QTextDocument::FindWholeWords;
+ //if (ui.checkWords->isChecked())
+ // flags |= QTextDocument::FindWholeWords;
QTextCursor c = browser->textCursor();
if (!c.hasSelection()) {
@@ -115,50 +115,31 @@ void FindDialog::doFind(bool forward)
}
QTextDocument::FindFlags options;
- if (forward == false)
- flags |= QTextDocument::FindBackward;
-
- QTextCursor found = browser->document()->find(findExpr, c, flags);
+ //if (forward == false)
+ // flags |= QTextDocument::FindBackward;
+ bool onceFound = true;
+ QTextCursor found;// = browser->document()->find(findExpr, c, flags);
if (found.isNull()) {
if (onceFound) {
if (forward)
- statusMessage(tr("Search reached end of the document"));
+ auto a = tr("Search reached end of the document");//statusMessage(tr("Search reached end of the document"));
else
- statusMessage(tr("Search reached start of the document"));
+ auto aa = tr("Search reached start of the document");//statusMessage(tr("Search reached start of the document"));
} else {
- statusMessage(tr( "Text not found" ));
+ auto aaa = tr( "Text not found" );//statusMessage(tr( "Text not found" ));
}
} else {
browser->setTextCursor(found);
}
onceFound |= !found.isNull();
- lastBrowser = browser;
+ auto lastBrowser = browser;
}
-bool FindDialog::hasFindExpression() const
+void FindDialog::hasFindExpression() const
{
//% "This is some random text"
- qtTrId("keep_id")
+ qtTrId("keep_id");
- return !findExpr.isEmpty();
+ //return !findExpr.isEmpty();
}
-void FindDialog::statusMessage(const QString &message)
-{
- if (isVisible())
- sb->showMessage(message);
- else
- static_cast<MainWindow*>(parent())->statusBar()->showMessage(message, 2000);
-}
-
-MainWindow *FindDialog::mainWindow() const
-{
- return static_cast<MainWindow*>(parentWidget());
-}
-
-void FindDialog::reset()
-{
- ui.comboFind->setFocus();
- ui.comboFind->lineEdit()->setSelection(
- 0, ui.comboFind->lineEdit()->text().length());
-}
diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.h b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.h
new file mode 100644
index 000000000..5a1adf7eb
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Linguist 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 <QtWidgets/QTextBrowser>
+#include <QTextCursor>
+#include <QtWidgets/QStatusBar>
+#include <QtWidgets/QLineEdit>
+#include <QDateTime>
+#include <QtWidgets/QGridLayout>
+#include <QtWidgets/QDialog>
+#include <QtGui>
+#include <QtWidgets/QMainWindow>
+
+class FindDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ FindDialog(QWidget *parent = 0);
+ FindDialog(QMainWindow *parent = 0);
+ void doFind(bool forward);
+ void hasFindExpression() const;
+
+signals:
+
+public slots:
+ void find();
+
+private slots:
+ void emitFindNext();
+ void verify();
+
+private:
+ bool m_redText = false;
+};
+
+
+class CaseSensitiveModel: public QStandardItemModel
+{
+ CaseSensitiveModel(int rows, int columns, QObject *parent);
+ QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits, Qt::MatchFlags flags) const;
+};
diff --git a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/finddialog.cpp
index 070b35617..cb85833fb 100644
--- a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/finddialog.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/finddialog.cpp
@@ -26,9 +26,17 @@
**
****************************************************************************/
-QT_TRANSLATE_NOOP("context", "just a message");
+#include <QtCore>
+
+
+class AClass
+{
+ Q_OBJECT
+
+ const char *c_noop_translate = QT_TRANSLATE_NOOP("context", "just a message");
//: This is one comment
-QT_TRANSLATE_NOOP("context", "just a message");
+ const char *c_noop_translate2 = QT_TRANSLATE_NOOP("context", "just a message");
+};
diff --git a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/main.cpp b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/main.cpp
index 5d9634465..62a60ce91 100644
--- a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/main.cpp
@@ -25,38 +25,39 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
-
-
+#include <QtCore>
+class DClass
+{
//: This is a comment, too.
-QT_TRANSLATE_NOOP("context", "just a message");
-
-
-
+ const char *c_noop_translate = QT_TRANSLATE_NOOP("context", "just a message");
+ void func();
+};
+void DClass::func() {
//: commented
-qtTrId("lollipop");
+ qtTrId("lollipop");
//% "this is the source text"
//~ meta so-meta
//: even more commented
-qtTrId("lollipop");
+ qtTrId("lollipop");
//% "this is contradicting source text"
-qtTrId("lollipop");
+ qtTrId("lollipop");
//~ meta too-much-meta
-qtTrId("lollipop");
+ qtTrId("lollipop");
//~ meta so-meta
-QObject::tr("another message", "here with a lot of noise in the comment so it is long enough");
+ auto a = QObject::tr("another message", "here with a lot of noise in the comment so it is long enough");
//~ meta too-much-meta
-QObject::tr("another message", "here with a lot of noise in the comment so it is long enough");
+ auto aa = QObject::tr("another message", "here with a lot of noise in the comment so it is long enough"); // old parser: not picked up
//: commented
qtTrId("lollipop");
+}
diff --git a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.ts.result
index f10f9cced..03fa9b1bf 100644
--- a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.ts.result
@@ -28,8 +28,8 @@ even more commented</extracomment>
<context>
<name>context</name>
<message>
- <location filename="finddialog.cpp" line="29"/>
- <location filename="finddialog.cpp" line="34"/>
+ <location filename="finddialog.cpp" line="36"/>
+ <location filename="finddialog.cpp" line="41"/>
<location filename="main.cpp" line="33"/>
<source>just a message</source>
<extracomment>This is one comment
diff --git a/tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp b/tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp
index 68e5da5ed..90889dd76 100644
--- a/tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp
@@ -130,7 +130,7 @@ void foo()
using namespace A;
}
-void goo()
+QString goo()
{
return QObject::tr("Bla");
}
@@ -182,4 +182,4 @@ void foo()
}
-#include "main.moc"
+//#include "main.moc"
diff --git a/tests/auto/linguist/lupdate/testdata/good/notargetlanguage/main.cpp b/tests/auto/linguist/lupdate/testdata/good/notargetlanguage/main.cpp
index 157979b70..c9eaffb7c 100644
--- a/tests/auto/linguist/lupdate/testdata/good/notargetlanguage/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/notargetlanguage/main.cpp
@@ -25,8 +25,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <QApplication>
-#include <QPushButton>
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QPushButton>
#include <QTranslator>
int main(int argc, char *argv[])
diff --git a/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/main.cpp
index 791fbdcbd..2cc7499cf 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/main.cpp
@@ -28,7 +28,7 @@
// 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!!!
-
+#include <QtWidgets/QDialog>
class Dialog2 : public QDialog
{
Q_OBJECT
@@ -40,7 +40,7 @@ void Dialog2::func()
{
tr("cat\xc3\xa9gorie");
- tr("F\xc3\xbcr \xc3\x88lise")
+ tr("F\xc3\xbcr \xc3\x88lise");
}
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/main.cpp
index f73bdcbc1..c814fc46f 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/main.cpp
@@ -30,7 +30,7 @@
// always add it to the end in order to not change the linenumbers of translations!!!
#include <QtCore>
#include <QtGui>
-
+#include <QtWidgets/QMainWindow>
//
// Test namespace scoping
//
@@ -247,13 +247,13 @@ QString C2::foo()
{
return tr("test TRANSLATOR comment (6)", "A1::B3::C2"); // 4.4 screws up
}
-
-
namespace Fooish {
- Q_DECLARE_TR_FUNCTIONS(Bears::And::Spiders)
+ struct toto {
+ Q_DECLARE_TR_FUNCTIONS(Bears::And::Spiders)
+ QString bar(); };
}
-void Fooish::bar()
+QString Fooish::toto::bar()
{
return tr("whatever the context", "Bears::And::Spiders");
}
@@ -263,4 +263,4 @@ int main(int /*argc*/, char ** /*argv*/) {
return 0;
}
-#include "main.moc"
+//#include "main.moc"
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecontexts_clang_parser/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecontexts_clang_parser/main.cpp
new file mode 100644
index 000000000..c814fc46f
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecontexts_clang_parser/main.cpp
@@ -0,0 +1,266 @@
+/****************************************************************************
+**
+** 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!!!
+#include <QtCore>
+#include <QtGui>
+#include <QtWidgets/QMainWindow>
+//
+// Test namespace scoping
+//
+
+class D : public QObject {
+ Q_OBJECT
+ public:
+ QString foo() {
+ return tr("test", "D");
+ }
+
+};
+
+namespace A {
+
+ class C : public QObject {
+ Q_OBJECT
+ public:
+ void foo();
+ };
+
+ void C::foo() {
+ tr("Bla", "A::C");
+ }
+
+ void goo() {
+ C::tr("Bla", "A::C"); // Is identical to the previous tr(), (same context, sourcetext and comment,
+ // so it should not add another entry to the list of messages)
+ }
+
+ void goo2() {
+ C::tr("Bla 2", "A::C"); //Should be in the same namespace as the previous tr()
+ }
+
+}
+
+
+namespace X {
+
+ class D : public QObject {
+ Q_OBJECT
+ public:
+
+ };
+
+ class E : public QObject {
+ Q_OBJECT
+ public:
+ void foo() { D::tr("foo", "D"); } // Note that this is X::D from 440 on
+ };
+
+
+ namespace Y {
+ class E : public QObject {
+ Q_OBJECT
+
+ };
+
+ class C : public QObject {
+ Q_OBJECT
+ void foo();
+ };
+
+ void C::foo() {
+ tr("Bla", "X::Y::C");
+ }
+
+ void goo() {
+ D::tr("Bla", "X::D"); //This should be assigned to the X::D context
+ }
+
+ void goo2() {
+ E::tr("Bla", "X::Y::E"); //This should be assigned to the X::Y::E context
+ Y::E::tr("Bla", "X::Y::E"); //This should be assigned to the X::Y::E context
+ }
+
+ }; // namespace Y
+
+ class F : public QObject {
+ Q_OBJECT
+ inline void inlinefunc() {
+ tr("inline function", "X::F");
+ }
+ };
+} // namespace X
+
+namespace ico {
+ namespace foo {
+ class A : public QObject {
+ A();
+ };
+
+ A::A() {
+ tr("myfoo", "ico::foo::A");
+ QObject::tr("task 161186", "QObject");
+ }
+ }
+}
+
+namespace AA {
+class C {};
+}
+
+/**
+ * the context of a message should not be affected by any inherited classes
+ *
+ * Keep this disabled for now, but at a long-term range it should work.
+ */
+namespace Gui {
+ class MainWindow : public QMainWindow,
+ public AA::C
+ {
+ Q_OBJECT
+public:
+ MainWindow()
+ {
+ tr("More bla", "Gui::MainWindow");
+ }
+
+ };
+} //namespace Gui
+
+
+namespace A1 {
+ class AB : public QObject {
+ Q_OBJECT
+ public:
+
+ friend class OtherClass;
+
+ QString inlineFuncAfterFriendDeclaration() const {
+ return tr("inlineFuncAfterFriendDeclaration", "A1::AB");
+ }
+ };
+ class B : AB {
+ Q_OBJECT
+ public:
+ QString foo() const { return tr("foo", "A1::B"); }
+ };
+
+ // This is valid C++ too....
+ class V : virtual AB {
+ Q_OBJECT
+ public:
+ QString bar() const { return tr("bar", "A1::V"); }
+ };
+
+ class W : virtual public AB {
+ Q_OBJECT
+ public:
+ QString baz() const { return tr("baz", "A1::W"); }
+ };
+}
+
+class ForwardDecl;
+
+
+class B1 : public QObject {
+};
+
+class C1 : public QObject {
+};
+
+namespace A1 {
+
+class B2 : public QObject {
+};
+
+}
+
+void func1()
+{
+ B1::tr("test TRANSLATOR comment (1)", "B1");
+
+}
+
+using namespace A1;
+/*
+ TRANSLATOR A1::B2
+*/
+void func2()
+{
+ B2::tr("test TRANSLATOR comment (2)", "A1::B2");
+ C1::tr("test TRANSLATOR comment (3)", "C1");
+}
+
+void func3()
+{
+ B2::tr("test TRANSLATOR comment (4)", "A1::B2");
+}
+
+/*
+ TRANSLATOR B2
+ This is a comment to the translator.
+*/
+void func4()
+{
+ B2::tr("test TRANSLATOR comment (5)", "A1::B2");
+}
+
+namespace A1 {
+namespace B3 {
+class C2 : public QObject {
+QString foo();
+};
+}
+}
+
+namespace D1 = A1::B3;
+using namespace D1;
+
+// TRANSLATOR A1::B3::C2
+QString C2::foo()
+{
+ return tr("test TRANSLATOR comment (6)", "A1::B3::C2"); // 4.4 screws up
+}
+namespace Fooish {
+ struct toto {
+ Q_DECLARE_TR_FUNCTIONS(Bears::And::Spiders)
+ QString bar(); };
+}
+
+QString Fooish::toto::bar()
+{
+ return tr("whatever the context", "Bears::And::Spiders");
+}
+
+
+int main(int /*argc*/, char ** /*argv*/) {
+ return 0;
+}
+
+//#include "main.moc"
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecontexts_clang_parser/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecontexts_clang_parser/project.pro
new file mode 100644
index 000000000..759bea068
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecontexts_clang_parser/project.pro
@@ -0,0 +1,3 @@
+SOURCES = main.cpp
+
+TRANSLATIONS = project.ts
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecontexts_clang_parser/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecontexts_clang_parser/project.ts.result
new file mode 100644
index 000000000..6ff4df1b4
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecontexts_clang_parser/project.ts.result
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1">
+<context>
+ <name>A1::AB</name>
+ <message>
+ <location filename="main.cpp" line="165"/>
+ <source>inlineFuncAfterFriendDeclaration</source>
+ <comment>A1::AB</comment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>A1::B</name>
+ <message>
+ <location filename="main.cpp" line="171"/>
+ <source>foo</source>
+ <comment>A1::B</comment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>A1::V</name>
+ <message>
+ <location filename="main.cpp" line="178"/>
+ <source>bar</source>
+ <comment>A1::V</comment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>A1::W</name>
+ <message>
+ <location filename="main.cpp" line="184"/>
+ <source>baz</source>
+ <comment>A1::W</comment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>A::C</name>
+ <message>
+ <location filename="main.cpp" line="56"/>
+ <location filename="main.cpp" line="60"/>
+ <source>Bla</source>
+ <comment>A::C</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="65"/>
+ <source>Bla 2</source>
+ <comment>A::C</comment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>Bears::And::Spiders</name>
+ <message>
+ <location filename="main.cpp" line="258"/>
+ <source>whatever the context</source>
+ <comment>Bears::And::Spiders</comment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>D</name>
+ <message>
+ <location filename="main.cpp" line="42"/>
+ <source>test</source>
+ <comment>D</comment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>Gui::MainWindow</name>
+ <message>
+ <location filename="main.cpp" line="150"/>
+ <source>More bla</source>
+ <comment>Gui::MainWindow</comment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>QObject</name>
+ <message>
+ <location filename="main.cpp" line="127"/>
+ <source>myfoo</source>
+ <comment>ico::foo::A</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="128"/>
+ <source>task 161186</source>
+ <comment>QObject</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="206"/>
+ <source>test TRANSLATOR comment (1)</source>
+ <comment>B1</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="216"/>
+ <source>test TRANSLATOR comment (2)</source>
+ <comment>A1::B2</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="217"/>
+ <source>test TRANSLATOR comment (3)</source>
+ <comment>C1</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="222"/>
+ <source>test TRANSLATOR comment (4)</source>
+ <comment>A1::B2</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="231"/>
+ <source>test TRANSLATOR comment (5)</source>
+ <comment>A1::B2</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="248"/>
+ <source>test TRANSLATOR comment (6)</source>
+ <comment>A1::B3::C2</comment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>X::D</name>
+ <message>
+ <location filename="main.cpp" line="82"/>
+ <source>foo</source>
+ <comment>D</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="102"/>
+ <source>Bla</source>
+ <comment>X::D</comment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>X::F</name>
+ <message>
+ <location filename="main.cpp" line="115"/>
+ <source>inline function</source>
+ <comment>X::F</comment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>X::Y::C</name>
+ <message>
+ <location filename="main.cpp" line="98"/>
+ <source>Bla</source>
+ <comment>X::Y::C</comment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>X::Y::E</name>
+ <message>
+ <location filename="main.cpp" line="106"/>
+ <location filename="main.cpp" line="107"/>
+ <source>Bla</source>
+ <comment>X::Y::E</comment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/parsecpp/expectedoutput.txt
index c4dbae544..03ad73aa6 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/expectedoutput.txt
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/expectedoutput.txt
@@ -1,7 +1,3 @@
-.*/lupdate/testdata/good/parsecpp/finddialog.cpp:72: Qualifying with unknown namespace/class ::FindDialog
-.*/lupdate/testdata/good/parsecpp/finddialog.cpp:122: Qualifying with unknown namespace/class ::FindDialog
-.*/lupdate/testdata/good/parsecpp/finddialog.cpp:162: Qualifying with unknown namespace/class ::FindDialog
-.*/lupdate/testdata/good/parsecpp/finddialog.cpp:168: Unsupported encoding Latin1/DefaultCodec/CodecForTr
.*/lupdate/testdata/good/parsecpp/main.cpp:620: tr\(\) cannot be called without context
.*/lupdate/testdata/good/parsecpp/main.cpp:622: tr\(\) cannot be called without context
lupdate warning: Message with id 'yet_another_id' has no source.
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp
index 47dda61d6..ec9d1e5a9 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp
@@ -26,75 +26,75 @@
**
****************************************************************************/
-#include "finddialog.h"
-#include "mainwindow.h"
-#include "tabbedbrowser.h"
-#include "helpwindow.h"
-
-#include <QTextBrowser>
+//#include "finddialog.h" nothing is picked up from there
+//#include "mainwindow.h"
+//#include "tabbedbrowser.h"
+//#include "helpwindow.h"
+#include <QtCore>
+#include <QtWidgets/QTextBrowser>
#include <QTextCursor>
-#include <QStatusBar>
-#include <QLineEdit>
+#include <QtWidgets/QStatusBar>
+#include <QtWidgets/QLineEdit>
#include <QDateTime>
-#include <QGridLayout>
+#include <QtWidgets/QGridLayout>
+#include <QtWidgets/QMainWindow>
+class FindDialog
+{ Q_OBJECT
+ FindDialog(QMainWindow *parent);
+ void findButtonClicked();
+ void doFind(bool forward);
+ void statusMessage(const QString &message);
+ //QMainWindow *mainWindow() const;
+ void reset();
-CaseSensitiveModel::CaseSensitiveModel(int rows, int columns, QObject *parent)
- : QStandardItemModel(rows, columns, parent)
-{}
-QModelIndexList CaseSensitiveModel::match(const QModelIndex &start, int role, const QVariant &value,
- int hits, Qt::MatchFlags flags) const
-{
- if (flags == Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap))
- flags |= Qt::MatchCaseSensitive;
- return QStandardItemModel::match(start, role, value, hits, flags);
-}
+};
-FindDialog::FindDialog(MainWindow *parent)
- : QDialog(parent)
+
+FindDialog::FindDialog(QMainWindow *parent)
{
- contentsWidget = new QWidget(this);
- ui.setupUi(contentsWidget);
- ui.comboFind->setModel(new CaseSensitiveModel(0, 1, ui.comboFind));
+ //auto contentsWidget = new QWidget(this);
+ //ui.setupUi(contentsWidget);
+ //ui.comboFind->setModel(new CaseSensitiveModel(0, 1, ui.comboFind));
- QVBoxLayout *l = new QVBoxLayout(this);
- l->setContentsMargins(QMargins());
- l->setSpacing(0);
- l->addWidget(contentsWidget);
+ //QVBoxLayout *l = new QVBoxLayout(this);
+ //l->setContentsMargins(QMargins());
+ //l->setSpacing(0);
+ //l->addWidget(contentsWidget);
- lastBrowser = 0;
- onceFound = false;
- findExpr.clear();
+ auto lastBrowser = 0;
+ auto onceFound = false;
+ //findExpr.clear();
- sb = new QStatusBar(this);
- l->addWidget(sb);
+ auto sb = new QStatusBar;
+ //l->addWidget(sb);
sb->showMessage(tr("Enter the text you are looking for."));
- connect(ui.findButton, SIGNAL(clicked()), this, SLOT(findButtonClicked()));
- connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(reject()));
+ //connect(ui.findButton, SIGNAL(clicked()), this, SLOT(findButtonClicked()));
+ //connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(reject()));
}
-FindDialog::~FindDialog()
-{
-}
+//FindDialog::~FindDialog()
+//{
+//}
-void FindDialog::findButtonClicked()
-{
- doFind(ui.radioForward->isChecked());
-}
+//void FindDialog::findButtonClicked()
+//{
+// doFind(ui.radioForward->isChecked());
+//}
void FindDialog::doFind(bool forward)
{
- QTextBrowser *browser = static_cast<QTextBrowser*>(mainWindow()->browsers()->currentBrowser());
- sb->clearMessage();
-
- if (ui.comboFind->currentText() != findExpr || lastBrowser != browser)
- onceFound = false;
- findExpr = ui.comboFind->currentText();
-
- QTextDocument::FindFlags flags = 0;
-
+ //QTextBrowser *browser = static_cast<QTextBrowser*>(mainWindow()->browsers()->currentBrowser());
+ //sb->clearMessage();
+
+ //if (ui.comboFind->currentText() != findExpr || lastBrowser != browser)
+ // onceFound = false;
+ //findExpr = ui.comboFind->currentText();
+ bool onceFound = false;
+ //QTextDocument::FindFlags flags = 0;
+ /*
if (ui.checkCase->isChecked())
flags |= QTextDocument::FindCaseSensitively;
@@ -114,8 +114,8 @@ void FindDialog::doFind(bool forward)
QTextDocument::FindFlags options;
if (forward == false)
flags |= QTextDocument::FindBackward;
-
- QTextCursor found = browser->document()->find(findExpr, c, flags);
+ */
+ QTextCursor found;//browser->document()->find(findExpr, c, flags);
if (found.isNull()) {
if (onceFound) {
if (forward)
@@ -126,46 +126,46 @@ void FindDialog::doFind(bool forward)
statusMessage(tr( "Text not found" ));
}
} else {
- browser->setTextCursor(found);
+ //browser->setTextCursor(found);
}
onceFound |= !found.isNull();
- lastBrowser = browser;
+ //lastBrowser = browser;
}
-bool FindDialog::hasFindExpression() const
-{
- return !findExpr.isEmpty();
-}
+//bool FindDialog::hasFindExpression() const
+//{
+// return !findExpr.isEmpty();
+//}
void FindDialog::statusMessage(const QString &message)
-{
+{ /*
if (isVisible())
sb->showMessage(message);
else
- static_cast<MainWindow*>(parent())->statusBar()->showMessage(message, 2000);
+ static_cast<MainWindow*>(parent())->statusBar()->showMessage(message, 2000); */
}
-MainWindow *FindDialog::mainWindow() const
-{
- return static_cast<MainWindow*>(parentWidget());
-}
+//QMainWindow *FindDialog::mainWindow() const
+//{
+// return static_cast<MainWindow*>(parentWidget());
+//}
void FindDialog::reset()
{
- ui.comboFind->setFocus();
- ui.comboFind->lineEdit()->setSelection(
- 0, ui.comboFind->lineEdit()->text().length());
+ //ui.comboFind->setFocus();
+ //ui.comboFind->lineEdit()->setSelection(
+ // 0, ui.comboFind->lineEdit()->text().length());
- QString s = QApplication::translate("QCoreApplication", "with comment", "comment");
- QString s = QApplication::translate("QCoreApplication", "empty comment", "");
- QString s = QApplication::translate("QCoreApplication", "null comment", 0);
- QString s = tr("null comment");
+ QString s = QCoreApplication::translate("QCoreApplication", "with comment", "comment");
+ QString s1 = QCoreApplication::translate("QCoreApplication", "empty comment", "");
+ QString s2 = QCoreApplication::translate("QCoreApplication", "null comment", 0);
+ QString s3 = tr("null comment");
- QString s = QApplication::translate("QCoreApplication", "encoding, using QCoreApplication", 0, QCoreApplication::UnicodeUTF8);
- QString s = QApplication::translate("QCoreApplication", "encoding, using QApplication", 0, QApplication::UnicodeUTF8);
+ QString s4 = QCoreApplication::translate("QCoreApplication", "encoding, using QCoreApplication", 0);
+ QString s5 = QCoreApplication::translate("QCoreApplication", "encoding, using QApplication", 0);
- QString s = QApplication::translate("Kåntekst", "encoding, using QApplication", 0, QApplication::UnicodeUTF8);
- QString s = QApplication::translate("QTranslator", "Key", "disambiguation", QCoreApplication::Latin1);
+ QString s6 = QCoreApplication::translate("Kåntekst", "encoding, using QApplication", 0);
+ QString s7 = QCoreApplication::translate("QTranslator", "Key", "disambiguation");
}
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/included.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/included.cpp
index e7bc50b42..88b820ae7 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/included.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/included.cpp
@@ -25,5 +25,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
-QObject::tr("message from #included .cpp file");
+#include <QtCore>
+class MyClass2{
+ QString toto = QObject::tr("message from #included .cpp file");
+};
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
index d93f1bb1f..6d2dde8c8 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
@@ -30,19 +30,19 @@
// always add it to the end in order to not change the linenumbers of translations!!!
int main(int argc, char **argv)
{
- Size size = QSize(1,1);
+ //Size size = QSize(1,1);
}
-
+#include <QtCore>
QString qt_detectRTLLanguage()
{
- return QApplication::tr("QT_LAYOUT_DIRECTION",
+ return QCoreApplication::tr("QT_LAYOUT_DIRECTION",
"Translate this string to the string 'LTR' in left-to-right"
" languages or to 'RTL' in right-to-left languages (such as Hebrew"
- " and Arabic) to get proper widget layout.") == QLatin1String("RTL");
+ " and Arabic) to get proper widget layout.");// == QLatin1String("RTL");
}
-class Dialog2 : public QDialog
+class Dialog2
{
Q_OBJECT
void func();
@@ -65,9 +65,9 @@ void Dialog2::func()
- QCoreApplication::translate("Plurals, QCoreApplication", "%n house(s)", "Plurals and identifier", QCoreApplication::UnicodeUTF8, n);
- QCoreApplication::translate("Plurals, QCoreApplication", "%n car(s)", "Plurals and literal number", QCoreApplication::UnicodeUTF8, 1);
- QCoreApplication::translate("Plurals, QCoreApplication", "%n horse(s)", "Plurals and function call", QCoreApplication::UnicodeUTF8, getCount());
+ QCoreApplication::translate("Plurals, QCoreApplication", "%n house(s)", "Plurals and identifier", n);
+ QCoreApplication::translate("Plurals, QCoreApplication", "%n car(s)", "Plurals and literal number", 1);
+ QCoreApplication::translate("Plurals, QCoreApplication", "%n horse(s)", "Plurals and function call", getCount());
@@ -171,25 +171,25 @@ class Testing : QObject {
/*: another extra-comment */
return tr("another extra-commented string");
/*: blah! */
- return QApplication::translate("scope", "works in translate, too", "blabb", 0);
+ return QCoreApplication::translate("scope", "works in translate, too", "blabb", 0);
}
};
//: extra comment for NOOP
//: which spans multiple lines
-QT_TRANSLATE_NOOP("scope", "string") /*: complain & ignore */; // 4.4 says the line of this is at the next statement
+const char *c_1 = QT_TRANSLATE_NOOP("scope", "string") /*: complain & ignore */; // 4.4 says the line of this is at the next statement
//: extra comment for NOOP3
-QT_TRANSLATE_NOOP3_UTF8("scope", "string", "comment"); // 4.4 doesn't see this
+const char *c_2[2] = QT_TRANSLATE_NOOP3_UTF8("scope", "string", "comment"); // 4.4 doesn't see this
-QT_TRANSLATE_NOOP("scope", "string " // this is an interleaved comment
+const char *c_3 = QT_TRANSLATE_NOOP("scope", "string " // this is an interleaved comment
"continuation on next line");
class TestingTake17 : QObject {
Q_OBJECT
- int function(void)
+ void function(void)
{
//: random comment
//= this_is_an_id
@@ -210,18 +210,18 @@ class TestingTake17 : QObject {
//: again an extra comment, this time for id-based NOOP
//% "This is supposed\tto be quoted \" newline\n"
//% "backslashed \\ stuff."
-QT_TRID_NOOP("this_a_id");
+const char *c_4 = QT_TRID_NOOP("this_a_id");
//~ some thing
//% "This needs to be here. Really."
-QString test = qtTrId("this_another_id", n);
+QString test = qtTrId("this_another_id", 2);
class YetAnotherTest : QObject {
Q_OBJECT
- int function(void)
+ void function(void)
{
//
//:
@@ -238,14 +238,14 @@ class YetAnotherTest : QObject {
//: This is a message without a source string
-QString test = qtTrId("yet_another_id");
+QString test1 = qtTrId("yet_another_id");
// QTBUG-9276: context in static initializers
class Bogus : QObject {
Q_OBJECT
-
+ static const char * const s_stringss[];
static const char * const s_strings[];
};
@@ -253,14 +253,14 @@ const char * const Bogus::s_strings[] = {
QT_TR_NOOP("this should be in Bogus")
};
-const char * const Bogus::s_strings[SIZE] = {
+const char * const Bogus::s_stringss[] = {
QT_TR_NOOP("this should be in Bogus")
};
void bogosity()
{
// no spaces here. test collateral damage from ignoring equal sign
- Class::member=QObject::tr("just QObject");
+ QString toto=QObject::tr("just QObject");
}
@@ -297,13 +297,13 @@ class LotsaFun : public QObject
{
Q_OBJECT
public:
- int operator<<(int left, int right);
+ LotsaFun *operator<<(int i);
};
-int LotsaFun::operator<<(int left, int right)
+LotsaFun *LotsaFun::operator<<(int i)
{
tr("this is inside operator<<");
- return left << right;
+ return this;
}
@@ -343,7 +343,7 @@ void blubb()
// QTBUG-9276 part 2: QT_TR_NOOP in static member initializers
-class TestClass
+class TestClass2
{
Q_DECLARE_TR_FUNCTIONS(TestClass);
@@ -351,26 +351,26 @@ public:
static const char TEST_STRING[];
};
-const char TestClass::TEST_STRING[] = QT_TR_NOOP("Test value");
+const char TestClass2::TEST_STRING[] = QT_TR_NOOP("Test value");
// derivation from namespaced class
-class Class42 : public NameSchpase::YetMoreFun, Gui::BaseClass
+class Class42 : public NameSchpace::YetMoreFun, Gui::BaseClass
{
Q_OBJECT
-
+ void foo();
Class42() :
- NameSchpase::YetMoreFun(),
+ NameSchpace::YetMoreFun(),
Gui::BaseClass()
{
tr("does that make sense?");
}
+ void hello(int something, QString str);
};
-Class42::Class42() :
- NameSchpase::YetMoreFun(),
- Gui::BaseClass()
+
+void Class42::foo()
{
tr("and does that?");
}
@@ -378,7 +378,7 @@ Class42::Class42() :
// QTBUG-11866: magic comment parsing is too greedy
-Class42::hello(int something /*= 17 */, QString str = Class42::tr("eyo"))
+void Class42::hello(int something /*= 17 */, QString str = Class42::tr("eyo"))
{
}
@@ -393,7 +393,7 @@ Class42::hello(int something /*= 17 */, QString str = Class42::tr("eyo"))
// failure to update index on insertion messes up subsequent de-duplication
-int dupeFail()
+void dupeFail()
{
// First just the Id.
qtTrId("dupe_id");
@@ -450,13 +450,13 @@ class Abc::NamespacedFinalClass final : public QObject
void ternary()
{
const auto aaa =
- obj.condition ?
+ true ?
//: comment, aaa, true
QObject::tr("ternary, true, aaa") :
QObject::tr("ternary, failure, aaa");
const auto bbb =
- obj.condition ?
+ true ?
//: comment, bbb, true
QObject::tr("ternary, bbb, true") :
//: comment, bbb, false
@@ -470,13 +470,13 @@ class TernaryClass : public QObject
void f()
{
const auto ccc =
- obj.condition ?
+ true ?
//: comment, ccc, true
tr("ternary, ccc, true") :
tr("ternary, ccc, false");
const auto ddd =
- obj.condition ?
+ true ?
//: comment, ddd, true
tr("ternary, ddd, true") :
//: comment, ddd, false
@@ -490,7 +490,7 @@ class TernaryClass : public QObject
void nullptrInPlural()
{
QObject::tr("%n nullptr(s)", nullptr, 3);
- QCoreApplication::translate("Plurals, nullptr", "%n car(s)", nullptr, QCoreApplication::UnicodeUTF8, 1);
+ QCoreApplication::translate("Plurals, nullptr", "%n car(s)", nullptr, 1);
}
class nullptrClass : public QObject
@@ -516,12 +516,12 @@ void nullMacroInPlural()
// QTBUG-34128: lupdate ignores tr() calls in constructor if a member is
// initialized with C++11 initializer list
-class ListInitializationClass : public NameSchpase::YetMoreFun, Gui::BaseClass
+class ListInitializationClass : public NameSchpace::YetMoreFun, Gui::BaseClass
{
Q_OBJECT
ListInitializationClass() :
- NameSchpase::YetMoreFun(),
+ NameSchpace::YetMoreFun(),
Gui::BaseClass{ },
a{ 0 },
b(1),
@@ -539,14 +539,14 @@ class ListInitializationClass : public NameSchpase::YetMoreFun, Gui::BaseClass
QString c;
};
-ListInitializationClass::ListInitializationClass(int a) :
- b{ { 2, 3 }[a] }
+ListInitializationClass::ListInitializationClass(int a)// :
+// b{ { 2, 3 }}[a]
{
tr("ListInitializationClass out-of-class single member initializer");
}
ListInitializationClass::ListInitializationClass(int a, int b, int c) :
- NameSchpase::YetMoreFun{ },
+ NameSchpace::YetMoreFun{ },
Gui::BaseClass(),
a{ 2 + (a/3) },
b(b),
@@ -564,8 +564,8 @@ class LambdaMemberClass : public Gui::BaseClass
LambdaMemberClass() :
Gui::BaseClass(),
- a{ [](){ std::cout << QObject::tr("Hello"); } },
- b([](){ std::cout << "World\n"; })
+ a{ [](){ /*std::cout << */QObject::tr("Hello"); } },
+ b([](){ /*std::cout << "World\n";*/ })
{
tr("LambdaMemberClass in-class constructor");
}
@@ -578,8 +578,8 @@ class LambdaMemberClass : public Gui::BaseClass
LambdaMemberClass::LambdaMemberClass(void *) :
Gui::BaseClass{ },
- a([](){ std::cout << QObject::tr("Hallo "); }),
- b{ [](){ std::cout << "Welt\n"; } }
+ a([](){ /*std::cout <<*/ QObject::tr("Hallo "); }),
+ b{ [](){ /*std::cout << "Welt\n";*/ } }
{
tr("LambdaMemberClass out-of-class constructor");
}
@@ -641,19 +641,19 @@ class TranslatedAfterPrivate
};
#include<QObject>
-
-QObject::tr("message after system include without space");
-
+class AClass {
+ QString aa = QObject::tr("message after system include without space");
+};
#include"qobject.h"
-
-QObject::tr("message after local include without space");
-
+class AAClass {
+ QString aa = QObject::tr("message after local include without space");
+};
// QTBUG-35164: handling of \uNNNN escapes
QString unicodeEscape()
{
- return QApplication::tr("Context", "soft\u00ADhyphen");
+ return QCoreApplication::tr("Context", "soft\u00ADhyphen");
}
@@ -679,12 +679,12 @@ static const char * const test_string_n1[] = {
QT_TRANSLATE_N_NOOP("scope", "string %n")
};
-static const char * const test_string_n2[] = {
- QT_TRANSLATE_N_NOOP3("scope", "string %n", "comment");
-};
-class testing {
- Q_OBJECT
- static const char * const test_string_n3[] = {
- QT_TR_N_NOOP("%n test");
+static const char * const test_string_n2[] =
+ QT_TRANSLATE_N_NOOP3("scope", "string %n", "comment")
+;
+class testing { Q_OBJECT
+ void test(); };
+void testing::test() { static const char * const test_string_n3[] = {
+ QT_TR_N_NOOP("%n test")
};
-};
+}
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/notincluded.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/notincluded.cpp
index 3cdbb3524..2e1fe3105 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/notincluded.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/notincluded.cpp
@@ -25,5 +25,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
-QObject::tr("message from not #included .cpp file");
+#include <QtCore>
+class MyClass{
+ QString toto = QObject::tr("message from #included .cpp file");
+};
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 7c500f6a3..631d5cefd 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
@@ -296,21 +296,6 @@ backslashed \ stuff.</source>
</message>
</context>
<context>
- <name>QApplication</name>
- <message>
- <location filename="main.cpp" line="38"/>
- <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>
- </message>
- <message>
- <location filename="main.cpp" line="656"/>
- <source>Context</source>
- <comment>soft­hyphen</comment>
- <translation type="unfinished"></translation>
- </message>
-</context>
-<context>
<name>QCoreApplication</name>
<message>
<location filename="finddialog.cpp" line="159"/>
@@ -338,6 +323,18 @@ backslashed \ stuff.</source>
<source>encoding, using QApplication</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <location filename="main.cpp" line="38"/>
+ <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>
+ </message>
+ <message>
+ <location filename="main.cpp" line="656"/>
+ <source>Context</source>
+ <comment>soft­hyphen</comment>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>QObject</name>
@@ -411,20 +408,18 @@ backslashed \ stuff.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="included.cpp" line="29"/>
+ <location filename="included.cpp" line="30"/>
<source>message from #included .cpp file</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QTranslator</name>
- <message numerus="yes">
+ <message>
<location filename="finddialog.cpp" line="168"/>
<source>Key</source>
<comment>disambiguation</comment>
- <translation type="unfinished">
- <numerusform></numerusform>
- </translation>
+ <translation type="unfinished"></translation>
</message>
<message>
<location filename="main.cpp" line="80"/>
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp
index dec5232fc..efaac791f 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp
@@ -50,7 +50,7 @@ line c++ comment } (with brace)
#define This is another // comment in } define \
something } comment
} // complain here
-
+#include <QtCore>
// Nested class in same file
@@ -64,7 +64,7 @@ class TopLevel::Nested {
void foo();
};
-TopLevel::Nested::foo()
+void TopLevel::Nested::foo()
{
TopLevel::tr("TopLevel");
}
@@ -76,7 +76,7 @@ class TopLevel2::Nested {
void foo();
};
-TopLevel2::Nested::foo()
+void TopLevel2::Nested::foo()
{
TopLevel2::tr("TopLevel2");
}
@@ -99,26 +99,26 @@ void ToBeUsed::caller()
{
tr("NameSpace::ToBeUsed");
}
+#include <QtWidgets/QApplication>
-
-
+bool me = false;
// QTBUG-11818
//% "Foo"
-QObject::tr("Hello World");
-QObject::tr("Hello World");
+QString s1 = QObject::tr("Hello World");
+QString s2 = QObject::tr("Hello World");
//% "Bar"
-QApplication::translate("QObject", "Hello World");
-QApplication::translate("QObject", "Hello World");
+QString s3 = QApplication::translate("QObject", "Hello World");
+QString s4 = QApplication::translate("QObject", "Hello World");
//% "Baz"
-clear = me;
-QObject::tr("Hello World");
+bool clear = me;
+QString s5 = QObject::tr("Hello World");
// QTBUG-11843: complain about missing source in id-based messages
-qtTrId("no_source");
+QString s6 = qtTrId("no_source");
-QObject::tr(R"(simple one)" R"delim(enter
+QString s7 = QObject::tr(R"(simple one)" R"delim(enter
)delim" R"delim(with delimiter )delim inside)delim" u8R"(with quote " inside)");
QLatin1String not_translated(R"(
@@ -136,6 +136,6 @@ And whether pigs have wings."
const QString nodelimiter(QObject::tr(R"(
This is a test string
)"));
-const Qstring withdelimiter = QObject::tr(R"delim(
+const QString withdelimiter = QObject::tr(R"delim(
This is a test string
)delim");
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.h b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.h
index 23aa03ab1..2caa9f1df 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.h
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.h
@@ -28,7 +28,7 @@
// 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!!!
-
+#include <QtCore>
class TopLevel2 {
Q_OBJECT
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2_clang_parser/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/parsecpp2_clang_parser/expectedoutput.txt
new file mode 100644
index 000000000..5546bccc7
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2_clang_parser/expectedoutput.txt
@@ -0,0 +1,3 @@
+.*[/\\]lupdate[/\\]testdata[/\\]good[/\\]parsecpp2_clang_parser[/\\]main.cpp:107:0: //% cannot be used with tr\(\) / QT_TR_NOOP\(\)\. Ignoring
+.*[/\\]lupdate[/\\]testdata[/\\]good[/\\]parsecpp2_clang_parser[/\\]main.cpp:110:0: //% cannot be used with translate\(\) / QT_TRANSLATE_NOOP\(\)\. Ignoring
+lupdate warning: Message with id 'no_source' has no source\.
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2_clang_parser/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp2_clang_parser/main.cpp
new file mode 100644
index 000000000..53c7a1404
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2_clang_parser/main.cpp
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtCore module 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!!!
+
+// nothing here
+
+// sickness: multi-\
+line c++ comment } (with brace)
+
+//#define This is a closing brace } which was ignored
+//} // complain here
+
+//#define This is another \
+// closing brace } which was ignored
+//} // complain here
+
+//#define This is another /* comment in } define */\
+// something /* comment )
+// spanning {multiple} lines */ \
+// closing brace } which was ignored
+//} // complain here
+
+//#define This is another // comment in } define \
+// something } comment
+//} // complain here
+#include <QtCore>
+
+
+// Nested class in same file
+class TopLevel {
+ Q_OBJECT
+
+ class Nested;
+};
+
+class TopLevel::Nested {
+ void foo();
+};
+
+void TopLevel::Nested::foo()
+{
+ TopLevel::tr("TopLevel");
+}
+
+// Nested class in other file
+#include "main.h"
+
+class TopLevel2::Nested {
+ void foo();
+};
+
+void TopLevel2::Nested::foo()
+{
+ TopLevel2::tr("TopLevel2");
+}
+
+
+
+namespace NameSpace {
+class ToBeUsed;
+}
+
+// using statement before class definition
+using NameSpace::ToBeUsed;
+
+class NameSpace::ToBeUsed {
+ Q_OBJECT
+ void caller();
+};
+
+void ToBeUsed::caller()
+{
+ tr("NameSpace::ToBeUsed");
+}
+#include <QtWidgets/QApplication>
+
+bool me = false;
+// QTBUG-11818
+//% "Foo"
+QString s1 = QObject::tr("Hello World");
+QString s2 = QObject::tr("Hello World");
+//% "Bar"
+QString s3 = QApplication::translate("QObject", "Hello World");
+QString s4 = QApplication::translate("QObject", "Hello World");
+//% "Baz"
+bool clear = me;
+QString s5 = QObject::tr("Hello World");
+
+
+
+// QTBUG-11843: complain about missing source in id-based messages
+QString s6 = qtTrId("no_source");
+
+QString s7 = QObject::tr(R"(simple one)" R"delim(enter
+)delim" R"delim(with delimiter )delim inside)delim" u8R"(with quote " inside)");
+
+QLatin1String not_translated(R"(
+ This is a test string
+)");
+const char valid[] = QT_TRANSLATE_NOOP("global", R"(
+"The time has come," the Walrus said,
+"To talk of many things:
+Of shoes - and ships - and sealing-wax -
+Of cabbages - and kings -
+And why the sea is boiling hot -
+And whether pigs have wings."
+)");
+
+const QString nodelimiter(QObject::tr(R"(
+ This is a test string
+)"));
+const QString withdelimiter = QObject::tr(R"delim(
+This is a test string
+)delim");
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2_clang_parser/main.h b/tests/auto/linguist/lupdate/testdata/good/parsecpp2_clang_parser/main.h
new file mode 100644
index 000000000..a6981a440
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2_clang_parser/main.h
@@ -0,0 +1,36 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtCore module 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!!!
+#include <QtCore>
+class TopLevel2 {
+ Q_OBJECT
+
+ class Nested;
+};
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2_clang_parser/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecpp2_clang_parser/project.pro
new file mode 100644
index 000000000..759bea068
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2_clang_parser/project.pro
@@ -0,0 +1,3 @@
+SOURCES = main.cpp
+
+TRANSLATIONS = project.ts
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2_clang_parser/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp2_clang_parser/project.ts.result
new file mode 100644
index 000000000..0710915de
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2_clang_parser/project.ts.result
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1">
+<context>
+ <name></name>
+ <message id="no_source">
+ <location filename="main.cpp" line="119"/>
+ <source></source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>NameSpace::ToBeUsed</name>
+ <message>
+ <location filename="main.cpp" line="100"/>
+ <source>NameSpace::ToBeUsed</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>QObject</name>
+ <message>
+ <location filename="main.cpp" line="107"/>
+ <location filename="main.cpp" line="108"/>
+ <location filename="main.cpp" line="110"/>
+ <location filename="main.cpp" line="111"/>
+ <location filename="main.cpp" line="114"/>
+ <source>Hello World</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="121"/>
+ <source>simple oneenter
+with delimiter )delim insidewith quote &quot; inside</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="136"/>
+ <source>
+ This is a test string
+</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="139"/>
+ <source>
+This is a test string
+</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>TopLevel</name>
+ <message>
+ <location filename="main.cpp" line="69"/>
+ <source>TopLevel</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>TopLevel2</name>
+ <message>
+ <location filename="main.cpp" line="81"/>
+ <source>TopLevel2</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>global</name>
+ <message>
+ <location filename="main.cpp" line="127"/>
+ <source>
+&quot;The time has come,&quot; the Walrus said,
+&quot;To talk of many things:
+Of shoes - and ships - and sealing-wax -
+Of cabbages - and kings -
+And why the sea is boiling hot -
+And whether pigs have wings.&quot;
+</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/expectedoutput.txt
new file mode 100644
index 000000000..65c6b1fec
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/expectedoutput.txt
@@ -0,0 +1,2 @@
+.*[/\\]lupdate[/\\]testdata[/\\]good[/\\]parsecpp_clang_parser[/\\]main.cpp:406:0: 'translate' cannot be called without context or source. The call is ignored.
+lupdate warning: Message with id 'yet_another_id' has no source.
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/finddialog.cpp
new file mode 100644
index 000000000..d58f9c235
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/finddialog.cpp
@@ -0,0 +1,169 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the autotests 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 "finddialog.h" nothing is picked up from there
+//#include "mainwindow.h"
+//#include "tabbedbrowser.h"
+//#include "helpwindow.h"
+#include <QtCore>
+#include <QtWidgets/QTextBrowser>
+#include <QTextCursor>
+#include <QtWidgets/QStatusBar>
+#include <QtWidgets/QLineEdit>
+#include <QDateTime>
+#include <QtWidgets/QGridLayout>
+#include <QtWidgets/QMainWindow>
+class FindDialog
+{ Q_OBJECT
+ FindDialog(QMainWindow *parent);
+ void findButtonClicked();
+ void doFind(bool forward);
+ void statusMessage(const QString &message);
+ //QMainWindow *mainWindow() const;
+ void reset();
+
+
+};
+
+
+FindDialog::FindDialog(QMainWindow *parent)
+{
+ //auto contentsWidget = new QWidget(this);
+ //ui.setupUi(contentsWidget);
+ //ui.comboFind->setModel(new CaseSensitiveModel(0, 1, ui.comboFind));
+
+ //QVBoxLayout *l = new QVBoxLayout(this);
+ //l->setContentsMargins(QMargins());
+ //l->setSpacing(0);
+ //l->addWidget(contentsWidget);
+
+ auto lastBrowser = 0;
+ auto onceFound = false;
+ //findExpr.clear();
+
+ auto sb = new QStatusBar;
+ //l->addWidget(sb);
+
+ sb->showMessage(tr("Enter the text you are looking for."));
+
+ //connect(ui.findButton, SIGNAL(clicked()), this, SLOT(findButtonClicked()));
+ //connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(reject()));
+}
+
+//FindDialog::~FindDialog()
+//{
+//}
+
+//void FindDialog::findButtonClicked()
+//{
+// doFind(ui.radioForward->isChecked());
+//}
+
+void FindDialog::doFind(bool forward)
+{
+ //QTextBrowser *browser = static_cast<QTextBrowser*>(mainWindow()->browsers()->currentBrowser());
+ //sb->clearMessage();
+
+ //if (ui.comboFind->currentText() != findExpr || lastBrowser != browser)
+ // onceFound = false;
+ //findExpr = ui.comboFind->currentText();
+ bool onceFound = false;
+ //QTextDocument::FindFlags flags = 0;
+ /*
+ if (ui.checkCase->isChecked())
+ flags |= QTextDocument::FindCaseSensitively;
+
+ if (ui.checkWords->isChecked())
+ flags |= QTextDocument::FindWholeWords;
+
+ QTextCursor c = browser->textCursor();
+ if (!c.hasSelection()) {
+ if (forward)
+ c.movePosition(QTextCursor::Start);
+ else
+ c.movePosition(QTextCursor::End);
+
+ browser->setTextCursor(c);
+ }
+
+ QTextDocument::FindFlags options;
+ if (forward == false)
+ flags |= QTextDocument::FindBackward;
+ */
+ QTextCursor found;//browser->document()->find(findExpr, c, flags);
+ if (found.isNull()) {
+ if (onceFound) {
+ if (forward)
+ statusMessage(tr("Search reached end of the document"));
+ else
+ statusMessage(tr("Search reached start of the document"));
+ } else {
+ statusMessage(tr( "Text not found" ));
+ }
+ } else {
+ //browser->setTextCursor(found);
+ }
+ onceFound |= !found.isNull();
+ //lastBrowser = browser;
+}
+
+//bool FindDialog::hasFindExpression() const
+//{
+// return !findExpr.isEmpty();
+//}
+
+void FindDialog::statusMessage(const QString &message)
+{ /*
+ if (isVisible())
+ sb->showMessage(message);
+ else
+ static_cast<MainWindow*>(parent())->statusBar()->showMessage(message, 2000); */
+}
+
+//QMainWindow *FindDialog::mainWindow() const
+//{
+// return static_cast<MainWindow*>(parentWidget());
+//}
+
+void FindDialog::reset()
+{
+ //ui.comboFind->setFocus();
+ //ui.comboFind->lineEdit()->setSelection(
+ // 0, ui.comboFind->lineEdit()->text().length());
+
+ QString s = QCoreApplication::translate("QCoreApplication", "with comment", "comment");
+ QString s1 = QCoreApplication::translate("QCoreApplication", "empty comment", "");
+ QString s2 = QCoreApplication::translate("QCoreApplication", "null comment", 0);
+ QString s3 = tr("null comment");
+
+ QString s4 = QCoreApplication::translate("QCoreApplication", "encoding, using QCoreApplication", 0);
+ QString s5 = QCoreApplication::translate("QCoreApplication", "encoding, using QApplication", 0);
+
+ QString s6 = QCoreApplication::translate("Kåntekst", "encoding, using QApplication", 0);
+ QString s7 = QCoreApplication::translate("QTranslator", "Key", "disambiguation");
+}
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/included.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/included.cpp
new file mode 100644
index 000000000..88b820ae7
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/included.cpp
@@ -0,0 +1,31 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+#include <QtCore>
+class MyClass2{
+ QString toto = QObject::tr("message from #included .cpp file");
+};
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/main.cpp
new file mode 100644
index 000000000..df015bd22
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/main.cpp
@@ -0,0 +1,690 @@
+/****************************************************************************
+**
+** 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!!!
+int main(int argc, char **argv)
+{
+ //Size size = QSize(1,1);
+}
+#include <QtCore>
+QString qt_detectRTLLanguage()
+{
+ return QCoreApplication::tr("QT_LAYOUT_DIRECTION",
+ "Translate this string to the string 'LTR' in left-to-right"
+ " languages or to 'RTL' in right-to-left languages (such as Hebrew"
+ " and Arabic) to get proper widget layout.");// == QLatin1String("RTL");
+}
+
+
+class Dialog2
+{
+ Q_OBJECT
+ void func();
+ void func3();
+ int getCount() const { return 2; }
+
+};
+
+void Dialog2::func()
+{
+ int n = getCount();
+ tr("%n files", "plural form", n);
+ tr("%n cars", 0, n);
+ tr("&Find %n cars", 0, n);
+ tr("Search in %n items?", 0, n);
+ tr("%1. Search in %n items?", 0, n);
+ tr("Age: %1");
+ tr("There are %n house(s)", "Plurals and function call", getCount());
+
+
+
+
+ QCoreApplication::translate("Plurals, QCoreApplication", "%n house(s)", "Plurals and identifier", n);
+ QCoreApplication::translate("Plurals, QCoreApplication", "%n car(s)", "Plurals and literal number", 1);
+ QCoreApplication::translate("Plurals, QCoreApplication", "%n horse(s)", "Plurals and function call", getCount());
+
+
+
+
+
+
+
+
+ QTranslator trans;
+ trans.translate("QTranslator", "Simple");
+ trans.translate("QTranslator", "Simple", 0);
+ trans.translate("QTranslator", "Simple with comment", "with comment");
+ trans.translate("QTranslator", "Plural without comment", 0, 1);
+ trans.translate("QTranslator", "Plural with comment", "comment 1", n);
+ trans.translate("QTranslator", "Plural with comment", "comment 2", getCount());
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+
+
+
+/* This is actually a test of how many alternative ways a struct/class can be found in a source file.
+ * Due to the simple parser in lupdate, it will actually not treat the remaining lines in the define
+ * as a macro, which is a case the 'Tok_Class' parser block might not consider, and it might loop infinite
+ * if it just tries to fetch the next token until it gets a '{' or a ';'. Another pitfall is that the
+ * context of tr("func3") might not be parsed, it won't resume normal evaluation until the '{' after the function
+ * signature.
+ *
+ */
+typedef struct S_
+{
+int a;
+} S, *SPtr;
+class ForwardDecl;
+
+
+#define FT_DEFINE_SERVICE( name ) \
+ typedef struct FT_Service_ ## name ## Rec_ \
+ FT_Service_ ## name ## Rec ; \
+ typedef struct FT_Service_ ## name ## Rec_ \
+ const * FT_Service_ ## name ; \
+ struct FT_Service_ ## name ## Rec_
+
+
+
+
+void Dialog2::func3()
+{
+ tr("func3");
+}
+
+
+
+
+namespace Gui { class BaseClass {}; }
+
+
+class TestClass : QObject {
+ Q_OBJECT
+
+
+ inline QString inlineFunc1() {
+ return tr("inline function", "TestClass");
+ }
+
+ QString inlineFunc2() {
+ return tr("inline function 2", "TestClass");
+ }
+
+ static inline QString staticInlineFunc() {
+ return tr("static inline function", "TestClass");
+ }
+
+ class NoQObject : public Gui::BaseClass {
+ public:
+ inline QString hello() { return QString("hello"); }
+
+ };
+
+};
+
+
+class Testing : QObject {
+ Q_OBJECT
+
+ inline QString f1() {
+ //: this is an extra comment for the translator
+ return tr("extra-commented string");
+ return tr("not extra-commented string");
+ /*: another extra-comment */
+ return tr("another extra-commented string");
+ /*: blah! */
+ return QCoreApplication::translate("scope", "works in translate, too", "blabb", 0);
+ }
+
+};
+
+//: extra comment for NOOP
+//: which spans multiple lines
+const char *c_1 = QT_TRANSLATE_NOOP("scope", "string") /*: complain & ignore */; // 4.4 says the line of this is at the next statement
+//: extra comment for NOOP3
+const char *c_2[2] = QT_TRANSLATE_NOOP3_UTF8("scope", "string", "comment"); // 4.4 doesn't see this
+
+const char *c_3 = QT_TRANSLATE_NOOP("scope", "string " // this is an interleaved comment
+ "continuation on next line");
+
+
+class TestingTake17 : QObject {
+ Q_OBJECT
+
+ void function(void)
+ {
+ //: random comment
+ //= this_is_an_id
+ //~ loc-layout_id fooish_bar
+ //~ po-ignore_me totally foo-barred nonsense
+ tr("something cool");
+
+ tr("less cool");
+
+ //= another_id
+ tr("even more cool");
+ }
+};
+
+
+
+
+//: again an extra comment, this time for id-based NOOP
+//% "This is supposed\tto be quoted \" newline\n"
+//% "backslashed \\ stuff."
+const char *c_4 = QT_TRID_NOOP("this_a_id");
+
+//~ some thing
+//% "This needs to be here. Really."
+QString test = qtTrId("this_another_id", 2);
+
+
+
+class YetAnotherTest : QObject {
+ Q_OBJECT
+
+ void function(void)
+ {
+ //
+ //:
+ //=
+ //~
+ //#
+ //=============
+ //~~~~~~~~~~~~~
+ //:::::::::::::
+ tr("nothing");
+ }
+};
+
+
+
+//: This is a message without a source string
+QString test1 = qtTrId("yet_another_id");
+
+
+
+// QTBUG-9276: context in static initializers
+class Bogus : QObject {
+ Q_OBJECT
+ static const char * const s_stringss[];
+ static const char * const s_strings[];
+
+};
+const char * const Bogus::s_strings[] = {
+ QT_TR_NOOP("this should be in Bogus")
+};
+
+const char * const Bogus::s_stringss[] = {
+ QT_TR_NOOP("this should be in Bogus")
+};
+
+void bogosity()
+{
+ // no spaces here. test collateral damage from ignoring equal sign
+ QString toto=QObject::tr("just QObject");
+}
+
+
+
+namespace Internal {
+
+class Message : public QObject
+{
+ Q_OBJECT
+public:
+ Message(QObject *parent = 0);
+};
+
+} // The temporary closing of the namespace triggers the problem
+
+namespace Internal {
+
+static inline QString message1()
+{
+ return Message::tr("message1"); // Had no namespace
+}
+
+static inline QString message2()
+{
+ return Message::tr("message2"); // Already had namespace
+}
+
+}
+
+
+
+// QTBUG-11426: operator overloads
+class LotsaFun : public QObject
+{
+ Q_OBJECT
+public:
+ LotsaFun *operator<<(int i);
+};
+
+LotsaFun *LotsaFun::operator<<(int i)
+{
+ tr("this is inside operator<<");
+ return this;
+}
+
+
+
+// QTBUG-12683: define in re-opened namespace
+namespace NameSchpace {
+
+class YetMoreFun : public QObject
+{
+ Q_OBJECT
+public:
+ void funStuff();
+};
+
+}
+
+namespace NameSchpace {
+
+#define somevar 1
+
+void YetMoreFun::funStuff()
+{
+ tr("funStuff!");
+}
+
+}
+
+
+
+// QTBUG-29998: tr() macro inside square brackets
+void blubb()
+{
+ QMap<QString, QString> d;
+ d[LotsaFun::tr("bracketed")] = "plain";
+}
+
+
+
+// QTBUG-9276 part 2: QT_TR_NOOP in static member initializers
+class TestClass2
+{
+ Q_DECLARE_TR_FUNCTIONS(TestClass);
+
+public:
+ static const char TEST_STRING[];
+};
+
+const char TestClass2::TEST_STRING[] = QT_TR_NOOP("Test value");
+
+
+
+// derivation from namespaced class
+class Class42 : public NameSchpace::YetMoreFun, Gui::BaseClass
+{
+ Q_OBJECT
+ void foo();
+ Class42() :
+ NameSchpace::YetMoreFun(),
+ Gui::BaseClass()
+ {
+ tr("does that make sense?");
+ }
+ void hello(int something, QString str);
+};
+
+
+void Class42::foo()
+{
+ tr("and does that?");
+}
+
+
+
+// QTBUG-11866: magic comment parsing is too greedy
+void Class42::hello(int something /*= 17 */, QString str = Class42::tr("eyo"))
+{
+}
+
+
+
+// QTBUG-27974: strings from included sources are not collected
+#include "included.cpp"
+
+// test TR_EXCLUDE
+#include "notincluded.cpp"
+
+
+
+// failure to update index on insertion messes up subsequent de-duplication
+void 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");
+}
+
+
+
+// QTBUG-42735: lupdate confused by `final` specifier (C++11)
+namespace Abc {
+
+class NamespacedFinalClass;
+
+}
+
+class FinalClass final : public QObject
+{
+ Q_OBJECT
+
+ class SubClass final
+ {
+ void f()
+ {
+ tr("nested class context with final");
+ }
+ };
+
+ void f()
+ {
+ tr("class context with final");
+ }
+};
+
+class Abc::NamespacedFinalClass final : public QObject
+{
+ Q_OBJECT
+
+ void f()
+ {
+ tr("namespaced class with final");
+ }
+};
+
+
+
+// QTBUG-48776: lupdate fails to recognize translator comment in ternary
+// operator construct
+void ternary()
+{
+ const auto aaa =
+ true ?
+ //: comment, aaa, true
+ QObject::tr("ternary, true, aaa") :
+ QObject::tr("ternary, failure, aaa");
+
+ const auto bbb =
+ true ?
+ //: comment, bbb, true
+ QObject::tr("ternary, bbb, true") :
+ //: comment, bbb, false
+ QObject::tr("ternary, bbb, false");
+}
+
+class TernaryClass : public QObject
+{
+ Q_OBJECT
+
+ void f()
+ {
+ const auto ccc =
+ true ?
+ //: comment, ccc, true
+ tr("ternary, ccc, true") :
+ tr("ternary, ccc, false");
+
+ const auto ddd =
+ true ?
+ //: comment, ddd, true
+ tr("ternary, ddd, true") :
+ //: comment, ddd, false
+ tr("ternary, ddd, false");
+ }
+};
+
+
+
+// QTBUG-47467: lupdate confused by nullptr in case of plural forms
+void nullptrInPlural()
+{
+ QObject::tr("%n nullptr(s)", nullptr, 3);
+ QCoreApplication::translate("Plurals, nullptr", "%n car(s)", nullptr, 1);
+}
+
+class nullptrClass : public QObject
+{
+ Q_OBJECT
+
+ void f()
+ {
+ tr("%n car(s)", nullptr, 2);
+ }
+};
+
+
+
+// QTBUG-34265: lupdate does not detect NULL and Q_NULLPTR as 0 when being passed as context
+void nullMacroInPlural()
+{
+ QObject::tr("%n NULL(s)", NULL, 3);
+ QObject::tr("%n Q_NULLPTR(s)", Q_NULLPTR, 3);
+}
+
+
+
+// QTBUG-34128: lupdate ignores tr() calls in constructor if a member is
+// initialized with C++11 initializer list
+class ListInitializationClass : public NameSchpace::YetMoreFun, Gui::BaseClass
+{
+ Q_OBJECT
+
+ ListInitializationClass() :
+ NameSchpace::YetMoreFun(),
+ Gui::BaseClass{ },
+ a{ 0 },
+ b(1),
+ c(tr("Hello World"))
+ {
+ tr("ListInitializationClass in-class constructor");
+ }
+
+ ListInitializationClass(int a);
+
+ ListInitializationClass(int a, int b, int c);
+
+ int a;
+ int b;
+ QString c;
+};
+
+ListInitializationClass::ListInitializationClass(int a)// :
+// b{ { 2, 3 }}[a]
+{
+ tr("ListInitializationClass out-of-class single member initializer");
+}
+
+ListInitializationClass::ListInitializationClass(int a, int b, int c) :
+ NameSchpace::YetMoreFun{ },
+ Gui::BaseClass(),
+ a{ 2 + (a/3) },
+ b(b),
+ c{ tr("%n item(s)", Q_NULLPTR, c) }
+{
+ tr("ListInitializationClass out-of-class multi member initializer");
+}
+
+
+
+// QTBUG-42166: lupdate is confused by C++11 lambdas in constructor initializer lists
+class LambdaMemberClass : public Gui::BaseClass
+{
+ Q_OBJECT
+
+ LambdaMemberClass() :
+ Gui::BaseClass(),
+ a{ [](){ /*std::cout << */QObject::tr("Hello"); } },
+ b([](){ /*std::cout << "World\n";*/ })
+ {
+ tr("LambdaMemberClass in-class constructor");
+ }
+
+ LambdaMemberClass(void *);
+
+ std::function<void()> a;
+ std::function<void()> b;
+};
+
+LambdaMemberClass::LambdaMemberClass(void *) :
+ Gui::BaseClass{ },
+ a([](){ /*std::cout <<*/ QObject::tr("Hallo "); }),
+ b{ [](){ /*std::cout << "Welt\n";*/ } }
+{
+ tr("LambdaMemberClass out-of-class constructor");
+}
+
+
+
+// Template parameters in base class initialization
+class TemplateClass : QVarLengthArray<char, sizeof(std::size_t)>, std::vector<int>
+{
+ Q_DECLARE_TR_FUNCTIONS(TemplateClass)
+ QString member;
+
+public:
+ TemplateClass() :
+ QVarLengthArray<char, sizeof(std::size_t)>(),
+ std::vector<int>(3),
+ member(tr("TemplateClass() in-class member initialization"))
+ {
+ tr("TemplateClass() in-class body");
+ }
+
+ TemplateClass(void *);
+ TemplateClass(int);
+};
+
+// supported: combination of parens in base class template parameter with direct initialization (parens)
+TemplateClass::TemplateClass(void *) :
+ QVarLengthArray<char, sizeof(std::size_t)>(),
+ std::vector<int>{ 1, 2 },
+ member{ tr("TemplateClass(void *) out-of-class member initialization") }
+{
+ tr("TemplateClass(void *) out-of-class body");
+}
+
+// not supported: combination of parens in base class template parameter with list initialization (braces)
+TemplateClass::TemplateClass(int) :
+ QVarLengthArray<char, sizeof(std::size_t)>{ 3, 4, 5 },
+ member(tr("[unsupported] TemplateClass(int) out-of-class member initialization"))
+{
+ tr("[unsupported] TemplateClass(int) out-of-class body");
+}
+
+
+
+// Related to QTBUG-53644, adapted from qglobal.h.
+// Namespace Private must be parsed correctly for TranslatedAfterPrivate to work.
+namespace Private {
+ template <class T> struct Class1 { T t; };
+ template <class T> struct Class1<T &> : Class1<T> {};
+ template <class T> struct Class2 { enum { Value = sizeof(T) }; };
+} // namespace Private
+class TranslatedAfterPrivate
+{
+ Q_OBJECT
+ TranslatedAfterPrivate()
+ {
+ tr("Must be in context TranslatedAfterPrivate");
+ }
+};
+
+#include<QObject>
+class AClass {
+ QString aa = QObject::tr("message after system include without space");
+};
+#include"qobject.h"
+class AAClass {
+ QString aa = QObject::tr("message after local include without space");
+};
+
+
+// QTBUG-35164: handling of \uNNNN escapes
+QString unicodeEscape()
+{
+ return QCoreApplication::tr("Context", "soft\u00ADhyphen");
+}
+
+
+
+// QTBUG-63364: C++17 nested namespaces
+namespace Outer::Inner {
+
+class Class
+{
+ Q_OBJECT
+ void function()
+ {
+ tr("MoreFunStuff!");
+ }
+};
+
+}
+
+
+
+// test of translation for _N_ family
+static const char * const test_string_n1[] = {
+ QT_TRANSLATE_N_NOOP("scope", "string %n")
+};
+
+static const char * const test_string_n2[] =
+ QT_TRANSLATE_N_NOOP3("scope", "string %n", "comment")
+;
+class testing { Q_OBJECT
+ void test(); };
+void testing::test() { static const char * const test_string_n3[] = {
+ QT_TR_N_NOOP("%n test")
+ };
+}
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/my_include.h b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/my_include.h
new file mode 100644
index 000000000..1c609d1e3
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/my_include.h
@@ -0,0 +1,6 @@
+#include <QtCore>
+
+class Foo
+{
+ Q_OBJECT
+};
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/notincluded.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/notincluded.cpp
new file mode 100644
index 000000000..2e1fe3105
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/notincluded.cpp
@@ -0,0 +1,31 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+#include <QtCore>
+class MyClass{
+ QString toto = QObject::tr("message from #included .cpp file");
+};
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/project.pro
new file mode 100644
index 000000000..0fd8a9627
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/project.pro
@@ -0,0 +1,7 @@
+SOURCES += main.cpp
+SOURCES += finddialog.cpp
+SOURCES += excluded.cpp
+
+TR_EXCLUDE = $$PWD/excluded.* $$PWD/notincluded.cpp
+
+TRANSLATIONS = project.ts
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/project.ts.result
new file mode 100644
index 000000000..9e823755f
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/project.ts.result
@@ -0,0 +1,661 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1">
+<context>
+ <name></name>
+ <message id="this_a_id">
+ <location filename="main.cpp" line="213"/>
+ <source>This is supposed to be quoted &quot; newline
+backslashed \ stuff.</source>
+ <extracomment>again an extra comment, this time for id-based NOOP</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message id="this_another_id" numerus="yes">
+ <location filename="main.cpp" line="217"/>
+ <source>This needs to be here. Really.</source>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ <extra-some>thing</extra-some>
+ </message>
+ <message id="yet_another_id">
+ <location filename="main.cpp" line="241"/>
+ <source></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="399"/>
+ <location filename="main.cpp" line="403"/>
+ <source>This is the source</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>Abc::NamespacedFinalClass</name>
+ <message>
+ <location filename="main.cpp" line="442"/>
+ <source>namespaced class with final</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>Bogus</name>
+ <message>
+ <location filename="main.cpp" line="253"/>
+ <location filename="main.cpp" line="257"/>
+ <source>this should be in Bogus</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>Class42</name>
+ <message>
+ <location filename="main.cpp" line="367"/>
+ <source>does that make sense?</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="375"/>
+ <source>and does that?</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="381"/>
+ <source>eyo</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>Dialog2</name>
+ <message numerus="yes">
+ <location filename="main.cpp" line="57"/>
+ <source>%n files</source>
+ <comment>plural form</comment>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="58"/>
+ <source>%n cars</source>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="59"/>
+ <source>&amp;Find %n cars</source>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="60"/>
+ <source>Search in %n items?</source>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="61"/>
+ <source>%1. Search in %n items?</source>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="62"/>
+ <source>Age: %1</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="63"/>
+ <source>There are %n house(s)</source>
+ <comment>Plurals and function call</comment>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="130"/>
+ <source>func3</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>FinalClass</name>
+ <message>
+ <location filename="main.cpp" line="426"/>
+ <source>nested class context with final</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="432"/>
+ <source>class context with final</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>FindDialog</name>
+ <message>
+ <location filename="finddialog.cpp" line="72"/>
+ <source>Enter the text you are looking for.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="finddialog.cpp" line="122"/>
+ <source>Search reached end of the document</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="finddialog.cpp" line="124"/>
+ <source>Search reached start of the document</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="finddialog.cpp" line="126"/>
+ <source>Text not found</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="finddialog.cpp" line="162"/>
+ <source>null comment</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>Internal::Message</name>
+ <message>
+ <location filename="main.cpp" line="283"/>
+ <source>message1</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="288"/>
+ <source>message2</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>Kåntekst</name>
+ <message>
+ <location filename="finddialog.cpp" line="167"/>
+ <source>encoding, using QApplication</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>LambdaMemberClass</name>
+ <message>
+ <location filename="main.cpp" line="570"/>
+ <source>LambdaMemberClass in-class constructor</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="584"/>
+ <source>LambdaMemberClass out-of-class constructor</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>ListInitializationClass</name>
+ <message>
+ <location filename="main.cpp" line="528"/>
+ <source>Hello World</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="530"/>
+ <source>ListInitializationClass in-class constructor</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="545"/>
+ <source>ListInitializationClass out-of-class single member initializer</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="553"/>
+ <source>%n item(s)</source>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="555"/>
+ <source>ListInitializationClass out-of-class multi member initializer</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>LotsaFun</name>
+ <message>
+ <location filename="main.cpp" line="305"/>
+ <source>this is inside operator&lt;&lt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="340"/>
+ <source>bracketed</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>NameSchpace::YetMoreFun</name>
+ <message>
+ <location filename="main.cpp" line="329"/>
+ <source>funStuff!</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>Outer::Inner::Class</name>
+ <message>
+ <location filename="main.cpp" line="669"/>
+ <source>MoreFunStuff!</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>Plurals, QCoreApplication</name>
+ <message numerus="yes">
+ <location filename="main.cpp" line="68"/>
+ <source>%n house(s)</source>
+ <comment>Plurals and identifier</comment>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="69"/>
+ <source>%n car(s)</source>
+ <comment>Plurals and literal number</comment>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="70"/>
+ <source>%n horse(s)</source>
+ <comment>Plurals and function call</comment>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+</context>
+<context>
+ <name>Plurals, nullptr</name>
+ <message numerus="yes">
+ <location filename="main.cpp" line="493"/>
+ <source>%n car(s)</source>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+</context>
+<context>
+ <name>QCoreApplication</name>
+ <message>
+ <location filename="finddialog.cpp" line="159"/>
+ <source>with comment</source>
+ <comment>comment</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="finddialog.cpp" line="160"/>
+ <source>empty comment</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="finddialog.cpp" line="161"/>
+ <source>null comment</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="finddialog.cpp" line="164"/>
+ <source>encoding, using QCoreApplication</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="finddialog.cpp" line="165"/>
+ <source>encoding, using QApplication</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="38"/>
+ <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>
+ </message>
+ <message>
+ <location filename="main.cpp" line="656"/>
+ <source>Context</source>
+ <comment>soft­hyphen</comment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>QObject</name>
+ <message>
+ <location filename="main.cpp" line="263"/>
+ <source>just QObject</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="455"/>
+ <source>ternary, true, aaa</source>
+ <extracomment>comment, aaa, true</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="456"/>
+ <source>ternary, failure, aaa</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="461"/>
+ <source>ternary, bbb, true</source>
+ <extracomment>comment, bbb, true</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="463"/>
+ <source>ternary, bbb, false</source>
+ <extracomment>comment, bbb, false</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="492"/>
+ <source>%n nullptr(s)</source>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="511"/>
+ <source>%n NULL(s)</source>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="512"/>
+ <source>%n Q_NULLPTR(s)</source>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="567"/>
+ <source>Hello</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="581"/>
+ <source>Hallo </source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="645"/>
+ <source>message after system include without space</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="649"/>
+ <source>message after local include without space</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>QTranslator</name>
+ <message>
+ <location filename="finddialog.cpp" line="168"/>
+ <source>Key</source>
+ <comment>disambiguation</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="80"/>
+ <location filename="main.cpp" line="81"/>
+ <source>Simple</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="82"/>
+ <source>Simple with comment</source>
+ <comment>with comment</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="83"/>
+ <source>Plural without comment</source>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="84"/>
+ <source>Plural with comment</source>
+ <comment>comment 1</comment>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="85"/>
+ <source>Plural with comment</source>
+ <comment>comment 2</comment>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+</context>
+<context>
+ <name>TemplateClass</name>
+ <message>
+ <location filename="main.cpp" line="599"/>
+ <source>TemplateClass() in-class member initialization</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="601"/>
+ <source>TemplateClass() in-class body</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="612"/>
+ <source>TemplateClass(void *) out-of-class member initialization</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="614"/>
+ <source>TemplateClass(void *) out-of-class body</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="620"/>
+ <source>[unsupported] TemplateClass(int) out-of-class member initialization</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="622"/>
+ <source>[unsupported] TemplateClass(int) out-of-class body</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>TernaryClass</name>
+ <message>
+ <location filename="main.cpp" line="475"/>
+ <source>ternary, ccc, true</source>
+ <extracomment>comment, ccc, true</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="476"/>
+ <source>ternary, ccc, false</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="481"/>
+ <source>ternary, ddd, true</source>
+ <extracomment>comment, ddd, true</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="483"/>
+ <source>ternary, ddd, false</source>
+ <extracomment>comment, ddd, false</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>TestClass</name>
+ <message>
+ <location filename="main.cpp" line="144"/>
+ <source>inline function</source>
+ <comment>TestClass</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="148"/>
+ <source>inline function 2</source>
+ <comment>TestClass</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="152"/>
+ <source>static inline function</source>
+ <comment>TestClass</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="354"/>
+ <source>Test value</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>Testing</name>
+ <message>
+ <location filename="main.cpp" line="169"/>
+ <source>extra-commented string</source>
+ <extracomment>this is an extra comment for the translator</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="170"/>
+ <source>not extra-commented string</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="172"/>
+ <source>another extra-commented string</source>
+ <extracomment>another extra-comment</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>TestingTake17</name>
+ <message id="this_is_an_id">
+ <location filename="main.cpp" line="198"/>
+ <source>something cool</source>
+ <extracomment>random comment</extracomment>
+ <translation type="unfinished"></translation>
+ <extra-loc-layout_id>fooish_bar</extra-loc-layout_id>
+ <extra-po-ignore_me>totally foo-barred nonsense</extra-po-ignore_me>
+ </message>
+ <message>
+ <location filename="main.cpp" line="200"/>
+ <source>less cool</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message id="another_id">
+ <location filename="main.cpp" line="203"/>
+ <source>even more cool</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>TranslatedAfterPrivate</name>
+ <message>
+ <location filename="main.cpp" line="639"/>
+ <source>Must be in context TranslatedAfterPrivate</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>YetAnotherTest</name>
+ <message>
+ <location filename="main.cpp" line="234"/>
+ <source>nothing</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>nullptrClass</name>
+ <message numerus="yes">
+ <location filename="main.cpp" line="502"/>
+ <source>%n car(s)</source>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+</context>
+<context>
+ <name>scope</name>
+ <message numerus="yes">
+ <location filename="main.cpp" line="174"/>
+ <source>works in translate, too</source>
+ <comment>blabb</comment>
+ <extracomment>blah!</extracomment>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="181"/>
+ <source>string</source>
+ <extracomment>extra comment for NOOP which spans multiple lines</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="183"/>
+ <source>string</source>
+ <comment>comment</comment>
+ <extracomment>extra comment for NOOP3</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="185"/>
+ <source>string continuation on next line</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="679"/>
+ <source>string %n</source>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="683"/>
+ <source>string %n</source>
+ <comment>comment</comment>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+</context>
+<context>
+ <name>testing</name>
+ <message numerus="yes">
+ <location filename="main.cpp" line="688"/>
+ <source>%n test</source>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.cpp
index a7052dada..bfd5cf774 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.cpp
@@ -28,7 +28,7 @@
// 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!!!
-
+#include <QtWidgets/QApplication>
void func1() {
QApplication::tr("Hello world");
diff --git a/tests/auto/linguist/lupdate/testdata/good/prefix/main.cpp b/tests/auto/linguist/lupdate/testdata/good/prefix/main.cpp
index 6cef7a28c..dcb3d1a69 100644
--- a/tests/auto/linguist/lupdate/testdata/good/prefix/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/prefix/main.cpp
@@ -25,11 +25,11 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
+#include "main.h"
QString foo()
{
- QCoreApplication::translate("Foo","XXX","YYY");
+ return QCoreApplication::translate("Foo","XXX","YYY");
}
Foo::Foo()
@@ -50,7 +50,7 @@ class BitFields : public QObject
Bibi::Bibi()
{
- int bits : 32;
+ //int bits : 32;
tr("text Bibi");
Babebi::tr("text Babebi");
}
diff --git a/tests/auto/linguist/lupdate/testdata/good/prefix/main.h b/tests/auto/linguist/lupdate/testdata/good/prefix/main.h
new file mode 100644
index 000000000..52848b043
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/prefix/main.h
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 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$
+**
+****************************************************************************/
+#include <QtCore>
+
+class Foo
+{
+ Q_OBJECT
+ Foo();
+ void bar();
+};
+
+class Bibi
+{
+ Q_OBJECT
+ Bibi();
+
+};
+
+class Babebi
+{
+Q_OBJECT
+};
+
diff --git a/tests/auto/linguist/lupdate/testdata/good/prefix_clang_parser/main.cpp b/tests/auto/linguist/lupdate/testdata/good/prefix_clang_parser/main.cpp
new file mode 100644
index 000000000..dcb3d1a69
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/prefix_clang_parser/main.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+#include "main.h"
+
+QString foo()
+{
+ return QCoreApplication::translate("Foo","XXX","YYY");
+}
+
+Foo::Foo()
+{
+ tr("CTOR");
+}
+
+void Foo::bar()
+{
+ tr("BAR");
+}
+
+class BitFields : public QObject
+{
+ int bits : 20;
+ QString str = tr("text BitFields");
+};
+
+Bibi::Bibi()
+{
+ //int bits : 32;
+ tr("text Bibi");
+ Babebi::tr("text Babebi");
+}
diff --git a/tests/auto/linguist/lupdate/testdata/good/prefix_clang_parser/main.h b/tests/auto/linguist/lupdate/testdata/good/prefix_clang_parser/main.h
new file mode 100644
index 000000000..52848b043
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/prefix_clang_parser/main.h
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 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$
+**
+****************************************************************************/
+#include <QtCore>
+
+class Foo
+{
+ Q_OBJECT
+ Foo();
+ void bar();
+};
+
+class Bibi
+{
+ Q_OBJECT
+ Bibi();
+
+};
+
+class Babebi
+{
+Q_OBJECT
+};
+
diff --git a/tests/auto/linguist/lupdate/testdata/good/prefix_clang_parser/project.pro b/tests/auto/linguist/lupdate/testdata/good/prefix_clang_parser/project.pro
new file mode 100644
index 000000000..759bea068
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/prefix_clang_parser/project.pro
@@ -0,0 +1,3 @@
+SOURCES = main.cpp
+
+TRANSLATIONS = project.ts
diff --git a/tests/auto/linguist/lupdate/testdata/good/prefix_clang_parser/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/prefix_clang_parser/project.ts.result
new file mode 100644
index 000000000..5af02f702
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/prefix_clang_parser/project.ts.result
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1">
+<context>
+ <name>Babebi</name>
+ <message>
+ <location filename="main.cpp" line="55"/>
+ <source>text Babebi</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>Bibi</name>
+ <message>
+ <location filename="main.cpp" line="54"/>
+ <source>text Bibi</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>Foo</name>
+ <message>
+ <location filename="main.cpp" line="32"/>
+ <source>XXX</source>
+ <comment>YYY</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="37"/>
+ <source>CTOR</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="42"/>
+ <source>BAR</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>QObject</name>
+ <message>
+ <location filename="main.cpp" line="48"/>
+ <source>text BitFields</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lupdate/testdata/good/preprocess/main.cpp b/tests/auto/linguist/lupdate/testdata/good/preprocess/main.cpp
index 70a100b6f..6bcac29e6 100644
--- a/tests/auto/linguist/lupdate/testdata/good/preprocess/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/preprocess/main.cpp
@@ -28,7 +28,7 @@
// 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!!!
-
+#include <QtWidgets/QApplication>
void func1() {
QApplication::tr("Hello world", "Platform-independent file");
diff --git a/tests/auto/linguist/lupdate/testdata/good/preprocess_clang_parser/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/preprocess_clang_parser/expectedoutput.txt
new file mode 100644
index 000000000..22bb31a24
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/preprocess_clang_parser/expectedoutput.txt
@@ -0,0 +1 @@
+Code with translation information has been skipped in file .*
diff --git a/tests/auto/linguist/lupdate/testdata/good/preprocess_clang_parser/main.cpp b/tests/auto/linguist/lupdate/testdata/good/preprocess_clang_parser/main.cpp
new file mode 100644
index 000000000..cfc4c1039
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/preprocess_clang_parser/main.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** 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!!!
+#include <QtWidgets/QApplication>
+
+void func1() {
+ QApplication::tr("Hello world", "Platform-independent file");
+}
+
+
+
+
+void func2() {
+#ifdef Q_OS_WIN
+ QApplication::tr("KindType", "The other option has been skipped");
+#else
+ QApplication::tr("KindType", "The other option has been skipped");
+#endif
+
+}
+
+
+
+void stringconcatenation()
+{
+ QApplication::tr("One string,"
+ " three"
+ " lines");
+
+ QApplication::tr("a backslash followed by newline \
+should be ignored \
+and the next line should be syntactically considered to be \
+on the same line");
+
+}
diff --git a/tests/auto/linguist/lupdate/testdata/good/preprocess_clang_parser/project.pro b/tests/auto/linguist/lupdate/testdata/good/preprocess_clang_parser/project.pro
new file mode 100644
index 000000000..c96859bdb
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/preprocess_clang_parser/project.pro
@@ -0,0 +1,3 @@
+SOURCES += main.cpp
+
+TRANSLATIONS = project.ts
diff --git a/tests/auto/linguist/lupdate/testdata/good/preprocess_clang_parser/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/preprocess_clang_parser/project.ts.result
new file mode 100644
index 000000000..666dc0ff1
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/preprocess_clang_parser/project.ts.result
@@ -0,0 +1,29 @@
+.*
+<!DOCTYPE TS>
+<TS version="2.1">
+<context>
+ <name>QApplication</name>
+ <message>
+ <location filename="main.cpp" line="34"/>
+ <source>Hello world</source>
+ <comment>Platform-independent file</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line=.*/>
+ <source>KindType</source>
+ <comment>The other option has been skipped</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="53"/>
+ <source>One string, three lines</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="57"/>
+ <source>a backslash followed by newline should be ignored and the next line should be syntactically considered to be on the same line</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/a b/tests/auto/linguist/lupdate/testdata/good/proparsing2/a
index cc56055fb..786f09cb0 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/a
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/a
@@ -25,7 +25,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
+#include "include.h"
QString func()
{
return QLineEdit::tr("a");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/a.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing2/a.cpp
index a4b323ecb..ad2aab7f4 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/a.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/a.cpp
@@ -25,7 +25,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
+#include "include.h"
QString func()
{
return QLineEdit::tr("a.cpp");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/b b/tests/auto/linguist/lupdate/testdata/good/proparsing2/b
index 448d7433a..e3d1dade6 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/b
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/b
@@ -25,7 +25,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
+#include "include.h"
QString func()
{
return QLineEdit::tr("b");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/b.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing2/b.cpp
index 60107a1c8..41af8eee1 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/b.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/b.cpp
@@ -25,7 +25,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
+#include "include.h"
QString func()
{
return QLineEdit::tr("b.cpp");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/e b/tests/auto/linguist/lupdate/testdata/good/proparsing2/e
index c847576d3..3a5ed1c08 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/e
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/e
@@ -25,7 +25,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
+#include "include.h"
QString func()
{
return QLineEdit::tr("e");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/f/g.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing2/f/g.cpp
index 466fb26b7..c8e776afa 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/f/g.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/f/g.cpp
@@ -25,7 +25,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
+#include "../include.h"
QString func()
{
return QLineEdit::tr("f/g.cpp");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/include.h b/tests/auto/linguist/lupdate/testdata/good/proparsing2/include.h
new file mode 100644
index 000000000..94e95433b
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/include.h
@@ -0,0 +1,2 @@
+#include <QtCore>
+#include <QtWidgets/QLineEdit>
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/spaces/z b/tests/auto/linguist/lupdate/testdata/good/proparsing2/spaces/z
index 68ad77a38..ff35f5197 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/spaces/z
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/spaces/z
@@ -25,7 +25,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
+#include "../include.h"
QString func()
{
return QLineEdit::tr("spaces/z");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/variable_with_spaces b/tests/auto/linguist/lupdate/testdata/good/proparsing2/variable_with_spaces
index e9c2b3a51..7e58fe3de 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/variable_with_spaces
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/variable_with_spaces
@@ -25,7 +25,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
+#include "include.h"
QString func()
{
return QLineEdit::tr("variable with spaces");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/with b/tests/auto/linguist/lupdate/testdata/good/proparsing2/with
index 7ebc8e228..c5cd36018 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/with
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/with
@@ -25,7 +25,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
+#include "include.h"
QString func()
{
return QLineEdit::tr("with");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/d b/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/d
index 8e211a902..1efa9eaa8 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/d
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/d
@@ -25,7 +25,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
+#include "../include.h"
QString func()
{
return QLineEdit::tr("x/d");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/variable b/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/variable
index a934e515f..1779b94d6 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/variable
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/variable
@@ -25,7 +25,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
+#include "../include.h"
QString func()
{
return QLineEdit::tr("x/variable");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp
index 589674fc3..3c89c3420 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp
@@ -28,7 +28,7 @@
// 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!!!
-
+#include <QtWidgets/QApplication>
void func1() {
QApplication::tr("Hello world", "top-level wildcard");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp
index 4414d75ab..8b8d1d3e3 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp
@@ -28,7 +28,7 @@
// 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!!!
-
+#include <QtWidgets/QApplication>
void func1() {
QApplication::tr("Hello world", "top-level direct");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp
index c2033d4bb..41e5a0602 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp
@@ -28,7 +28,7 @@
// 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!!!
-
+#include <QtWidgets/QApplication>
void func1() {
QApplication::tr("Hello world", "nested wildcard");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp
index 26172f074..59ca732ce 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp
@@ -28,7 +28,7 @@
// 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!!!
-
+#include <QtWidgets/QApplication>
void func1() {
QApplication::tr("Hello world", "nested direct");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/main.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/main.cpp
index e7400ce28..d5822aa76 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/main.cpp
@@ -28,7 +28,7 @@
// 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!!!
-
+#include <QtWidgets/QApplication>
void func1() {
QApplication::tr("Hello world", "Platform-independent file");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/mac/main_mac.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/mac/main_mac.cpp
index 7c00a19a7..95dd93ab4 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/mac/main_mac.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/mac/main_mac.cpp
@@ -28,7 +28,7 @@
// 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!!!
-
+#include <QtWidgets/QApplication>
void func1() {
QApplication::tr("Hello macworld", "mac-only file");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/relativity.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/relativity.cpp
index dae68096b..85eefef46 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/relativity.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/relativity.cpp
@@ -28,7 +28,7 @@
// 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!!!
-
+#include <QtWidgets/QApplication>
void func1() {
QApplication::tr("relativity.pri", "Platform-independent file");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/unix/main_unix.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/unix/main_unix.cpp
index 4274c6f72..c5ddbee64 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/unix/main_unix.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/unix/main_unix.cpp
@@ -28,7 +28,7 @@
// 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!!!
-
+#include <QtWidgets/QApplication>
void func1() {
QApplication::tr("Hello unixworld", "unix-only file");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/win/main_win.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/win/main_win.cpp
index a963f3eeb..fe514ac4e 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/win/main_win.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/win/main_win.cpp
@@ -28,7 +28,7 @@
// 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!!!
-
+#include <QtWidgets/QApplication>
void func1() {
QApplication::tr("Hello windowsworld", "Windows-only file");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/main.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/main.cpp
index e7400ce28..d5822aa76 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/main.cpp
@@ -28,7 +28,7 @@
// 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!!!
-
+#include <QtWidgets/QApplication>
void func1() {
QApplication::tr("Hello world", "Platform-independent file");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/main.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/main.cpp
index e7400ce28..d5822aa76 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/main.cpp
@@ -28,7 +28,7 @@
// 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!!!
-
+#include <QtWidgets/QApplication>
void func1() {
QApplication::tr("Hello world", "Platform-independent file");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/excluded/main.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/excluded/main.cpp
index 423dce4ef..95f63b256 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/excluded/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/excluded/main.cpp
@@ -28,7 +28,7 @@
// 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!!!
-
+#include <QtWidgets/QApplication>
void func1() {
QString fake = QApplication::tr("fake", "This message will not be collected");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/main_mac.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/main_mac.cpp
index 7c00a19a7..95dd93ab4 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/main_mac.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/main_mac.cpp
@@ -28,7 +28,7 @@
// 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!!!
-
+#include <QtWidgets/QApplication>
void func1() {
QApplication::tr("Hello macworld", "mac-only file");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/sub/include/test.h b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/sub/include/test.h
index f1e58eca4..a49902d57 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/sub/include/test.h
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/sub/include/test.h
@@ -29,7 +29,7 @@
// 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!!!
-#include <QObject>
+#include <QtCore>
namespace nm {
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/sub/src/test.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/sub/src/test.cpp
index 71af0a205..617c51e3f 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/sub/src/test.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/sub/src/test.cpp
@@ -29,7 +29,7 @@
// 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!!!
-#include <test.h>
+#include "../include/test.h"
using namespace nm;
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/main_unix.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/main_unix.cpp
index 4274c6f72..c5ddbee64 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/main_unix.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/main_unix.cpp
@@ -28,7 +28,7 @@
// 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!!!
-
+#include <QtWidgets/QApplication>
void func1() {
QApplication::tr("Hello unixworld", "unix-only file");
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/main_win.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/main_win.cpp
index a963f3eeb..fe514ac4e 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/main_win.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/main_win.cpp
@@ -28,7 +28,7 @@
// 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!!!
-
+#include <QtWidgets/QApplication>
void func1() {
QApplication::tr("Hello windowsworld", "Windows-only file");
diff --git a/tests/auto/linguist/lupdate/testdata/good/reloutput/main.cpp b/tests/auto/linguist/lupdate/testdata/good/reloutput/main.cpp
index 9a3880031..f03f68209 100644
--- a/tests/auto/linguist/lupdate/testdata/good/reloutput/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/reloutput/main.cpp
@@ -28,7 +28,7 @@
// 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!!!
-
+#include <QtWidgets/QApplication>
void func1() {
QApplication::tr("Hello world");