diff options
Diffstat (limited to 'tests/auto/linguist/lupdate')
180 files changed, 7607 insertions, 3105 deletions
diff --git a/tests/auto/linguist/lupdate/.prev_CMakeLists.txt b/tests/auto/linguist/lupdate/.prev_CMakeLists.txt deleted file mode 100644 index 405663002..000000000 --- a/tests/auto/linguist/lupdate/.prev_CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# Generated from lupdate.pro. - -##################################################################### -## tst_lupdate Test: -##################################################################### - -qt_add_test(tst_lupdate - SOURCES - tst_lupdate.cpp -) diff --git a/tests/auto/linguist/lupdate/CMakeLists.txt b/tests/auto/linguist/lupdate/CMakeLists.txt index 27c96e9f8..ee57b32f9 100644 --- a/tests/auto/linguist/lupdate/CMakeLists.txt +++ b/tests/auto/linguist/lupdate/CMakeLists.txt @@ -1,17 +1,29 @@ -# Generated from lupdate.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_lupdate LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() -# special case begin if(CMAKE_VERSION VERSION_LESS "3.19" AND MSVC AND QT_FEATURE_debug_and_release) message(WARNING "tst_lupdate will not be built in this configuration.") return() endif() -# special case end ##################################################################### ## tst_lupdate Test: ##################################################################### -qt_add_test(tst_lupdate +qt_internal_add_test(tst_lupdate SOURCES tst_lupdate.cpp + LIBRARIES + Qt::Tools + Qt::CorePrivate ) + +# The recursive tests take a bit longer for the clang-based parser. +# Increase the test timeout. +set_property(TEST tst_lupdate APPEND PROPERTY ENVIRONMENT "QTEST_FUNCTION_TIMEOUT=900000") diff --git a/tests/auto/linguist/lupdate/lupdate.pro b/tests/auto/linguist/lupdate/lupdate.pro deleted file mode 100644 index 5ed1ed73c..000000000 --- a/tests/auto/linguist/lupdate/lupdate.pro +++ /dev/null @@ -1,6 +0,0 @@ -CONFIG += testcase -QT = core testlib - -TARGET = tst_lupdate - -SOURCES += tst_lupdate.cpp diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/src/main.cpp b/tests/auto/linguist/lupdate/testdata/good/backslashes/src/main.cpp index e9976c987..68d436012 100644 --- a/tests/auto/linguist/lupdate/testdata/good/backslashes/src/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/src/main.cpp @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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!!! @@ -33,11 +33,12 @@ // // -QString qt_detectRTLLanguage() +#include <QCoreApplication> + +bool 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"); } - diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/ts/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/backslashes/ts/project.ts.result index 3951a6461..90ac88d52 100644 --- a/tests/auto/linguist/lupdate/testdata/good/backslashes/ts/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/ts/project.ts.result @@ -2,9 +2,9 @@ <!DOCTYPE TS> <TS version="2.1"> <context> - <name>QApplication</name> + <name>QCoreApplication</name> <message> - <location filename="../src/main.cpp" line="38"/> + <location filename="../src/main.cpp" line="40"/> <source>QT_LAYOUT_DIRECTION</source> <comment>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.</comment> <translation type="unfinished"></translation> diff --git a/tests/auto/linguist/lupdate/testdata/good/cmdline_order/a.h b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/a.h index 5b8259624..d0bec4dcd 100644 --- a/tests/auto/linguist/lupdate/testdata/good/cmdline_order/a.h +++ b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/a.h @@ -1,29 +1,29 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + #define XX QT_TRANSLATE_NOOP("aaa", "some text") diff --git a/tests/auto/linguist/lupdate/testdata/good/cmdline_order/b.h b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/b.h index c93eb9f88..ce5f6082e 100644 --- a/tests/auto/linguist/lupdate/testdata/good/cmdline_order/b.h +++ b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/b.h @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + #include "a.h" diff --git a/tests/auto/linguist/lupdate/testdata/good/cmdline_recurse/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/cmdline_recurse/project.ts.result index 98a695c3b..99311232f 100644 --- a/tests/auto/linguist/lupdate/testdata/good/cmdline_recurse/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/cmdline_recurse/project.ts.result @@ -4,12 +4,12 @@ <context> <name>FindDialog</name> <message> - <location filename="project.ui" line="44"/> + <location filename="project.ui" line="19"/> <source>Qt Assistant - Finn text</source> <translation type="unfinished"></translation> </message> <message> - <location filename="project.ui" line="47"/> + <location filename="project.ui" line="22"/> <source>Finn tekst</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp index 169c63cd1..cf0f6665a 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp @@ -1,36 +1,36 @@ -/**************************************************************************** -** -** 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 <QApplication> -#include <QtGui> -#include <QtCore> +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + +#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..b6ee6b1ba 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 @@ -1,37 +1,38 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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..4207ffd5e 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 @@ -1,32 +1,32 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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/heuristics/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt index 1eed403b7..f8c994f34 100644 --- a/tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt @@ -1,5 +1,4 @@ Updating 'project\.ts'\.\.\. - Found 3 source text\(s\) \(3 new and 0 already existing\) - Removed 5 obsolete entries - Number heuristic provided 1 translation\(s\) + Found 2 source text\(s\) \(2 new and 0 already existing\) + Removed 4 obsolete entries Same-text heuristic provided 1 translation\(s\) diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/main.cpp b/tests/auto/linguist/lupdate/testdata/good/heuristics/main.cpp index 2d42d7336..50e2aac78 100644 --- a/tests/auto/linguist/lupdate/testdata/good/heuristics/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/main.cpp @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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!!! @@ -36,9 +36,6 @@ class A: public QObject { Q_OBJECT void foo() { - // number Heuristics - tr("version 2.0 now"); - // same text match tr("this is the matched same text"); diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.before index e72debed9..2d1b201a9 100644 --- a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.before +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.before @@ -2,14 +2,6 @@ <!DOCTYPE TS> <TS version="2.0" language="de_DE"> <context> - <name>A</name> - <message> - <location filename="main.cpp" line="53"/> - <source>version 1.0 now</source> - <translation>teraz wersja 1.0</translation> - </message> -</context> -<context> <name>B</name> <message> <location filename="main.cpp" line="56"/> diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.result index 351bdff7d..3c150a30c 100644 --- a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.result @@ -5,16 +5,11 @@ <name>A</name> <message> <location filename="main.cpp" line="40"/> - <source>version 2.0 now</source> - <translation type="unfinished">teraz wersja 1.0 {2.0 ?}</translation> - </message> - <message> - <location filename="main.cpp" line="43"/> <source>this is the matched same text</source> <translation type="unfinished">der same-text-treffer</translation> </message> <message> - <location filename="main.cpp" line="46"/> + <location filename="main.cpp" line="43"/> <source>this is the non-matched same text</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/main.cpp b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/main.cpp index d8e7db2a8..640f208ad 100644 --- a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/main.cpp @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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!!! 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..640f208ad --- /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. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + + +// 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..d94c031ad 100644 --- a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp @@ -1,32 +1,32 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only -/**************************************************************************** -** -** 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> // 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_versions/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ts.result index 51a15683d..9f5c925cb 100644 --- a/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ts.result @@ -4,10 +4,12 @@ <context> <name>FindDialog</name> <message> + <location filename="project.ui" line="18"/> <source>Qt Assistant - Finn text</source> <translation></translation> </message> <message> + <location filename="project.ui" line="21"/> <source>Finn tekst</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ui b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ui index db98879cd..93c36b08e 100644 --- a/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ui +++ b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ui @@ -1,32 +1,8 @@ <ui version="4.0" > - <author></author> - <comment>********************************************************************* -** -** 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$ -** -*********************************************************************</comment> +<comment> +* Copyright (C) 2016 The Qt Company Ltd. +* SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +</comment> <exportmacro></exportmacro> <class>FindDialog</class> <widget class="QWidget" name="FindDialog" > 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..afb5028e1 100644 --- a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/main.cpp @@ -1,32 +1,32 @@ -/**************************************************************************** -** -** 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 <QApplication> +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + +#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..afae71c03 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp @@ -1,43 +1,45 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only -// The first line in this file should always be empty, its part of the test!! - -/**************************************************************************** -** -** 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> +#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..d9c8c512d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp @@ -1,43 +1,43 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + #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..9b2d0d3d1 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.h @@ -0,0 +1,66 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + + +#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..e98111b69 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp @@ -1,42 +1,42 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + #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..9b2d0d3d1 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.h @@ -0,0 +1,66 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + + +#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/mergeui/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result index 8d51b197d..683972961 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result @@ -8,17 +8,17 @@ <translation type="vanished">Qt Assistant - Finn tekst</translation> </message> <message> - <location filename="project.ui" line="44"/> + <location filename="project.ui" line="19"/> <source>Qt Assistant - Find Text</source> <translation type="unfinished"></translation> </message> <message> - <location filename="project.ui" line="47"/> + <location filename="project.ui" line="22"/> <source>300px</source> <translation>300px</translation> </message> <message> - <location filename="project.ui" line="50"/> + <location filename="project.ui" line="25"/> <source>401 pixels</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui index 7e521d19d..400480bde 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui @@ -1,33 +1,8 @@ <ui version="4.0" > <author></author> <comment> -********************************************************************* -** -** 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$ -** -********************************************************************* +* Copyright (C) 2016 The Qt Company Ltd. +* SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only </comment> <exportmacro></exportmacro> <class>FindDialog</class> 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..587950751 100644 --- a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/finddialog.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/finddialog.cpp @@ -1,34 +1,42 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -QT_TRANSLATE_NOOP("context", "just a message"); +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + + +#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..6f093aeff 100644 --- a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/main.cpp @@ -1,62 +1,63 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + -//: This is a comment, too. -QT_TRANSLATE_NOOP("context", "just a message"); + + + + + + +#include <QtCore> +class DClass +{ + +//: This is a comment, too. + 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..c761c0dec 100644 --- a/tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + #include <QtCore> @@ -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..c51a722df 100644 --- a/tests/auto/linguist/lupdate/testdata/good/notargetlanguage/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/notargetlanguage/main.cpp @@ -1,32 +1,32 @@ -/**************************************************************************** -** -** 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 <QApplication> -#include <QPushButton> +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + +#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..d19e193bf 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 @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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..7a5fff93d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/main.cpp @@ -1,36 +1,36 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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 // @@ -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..7a5fff93d --- /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. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + + +// 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/excluded.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/excluded.cpp index 592ceb4d8..32d0210a6 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/excluded.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/excluded.cpp @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + int main(int argc, char **argv) { 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..65d5ede30 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp @@ -1,100 +1,100 @@ -/**************************************************************************** -** -** 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" -#include "mainwindow.h" -#include "tabbedbrowser.h" -#include "helpwindow.h" - -#include <QTextBrowser> +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + + +//#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..ff7fe370b 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/included.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/included.cpp @@ -1,29 +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$ -** -****************************************************************************/ - -QObject::tr("message from #included .cpp file"); +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + +#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..49f30a8e3 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp @@ -1,48 +1,48 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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); + //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,52 @@ 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"); +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") + }; +} + + + +// QTBUG-91521: context in static initializers with parentheses +class Hogus : QObject { + Q_OBJECT + static const QString myString; }; -class testing { + +const QString Hogus::myString(QT_TR_NOOP("this should be in Hogus")); + + + +// QTBUG-99415: multiple specifiers after method parameter list +class QTBUG99415 : QObject { Q_OBJECT - static const char * const test_string_n3[] = { - QT_TR_N_NOOP("%n test"); - }; + const QString text1() const noexcept { return tr("text1"); } + const QString text2() const noexcept; +}; + +const QString QTBUG99415::text2() const noexcept { return tr("text2"); } + +// QTBUG-110630: Support quoting in extras field to allow whitespace preservation +class QTBUG110630 : QObject { + Q_OBJECT + const QString txt() { + //~ quoted " string with spaces " + tr("translation with extras-quoted field"); + } +}; + +// enum class - C++11 +enum class Bar : unsigned short; +// QTBUG-36589: Don't treat enum classes as a normal class +class QTBUG36589 : QObject { + Q_OBJECT + const QString txt() { + tr("string after an enum class"); + } }; diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/notincluded.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/notincluded.cpp index 3cdbb3524..3f502fffe 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/notincluded.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/notincluded.cpp @@ -1,29 +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$ -** -****************************************************************************/ - -QObject::tr("message from not #included .cpp file"); +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + +#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..fe5c00d96 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result @@ -166,6 +166,14 @@ backslashed \ stuff.</source> </message> </context> <context> + <name>Hogus</name> + <message> + <location filename="main.cpp" line="700"/> + <source>this should be in Hogus</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>Internal::Message</name> <message> <location filename="main.cpp" line="283"/> @@ -296,21 +304,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 'LTR' in left-to-right languages or to 'RTL' 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 +331,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 'LTR' in left-to-right languages or to 'RTL' 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 +416,48 @@ 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>QTBUG110630</name> + <message> + <location filename="main.cpp" line="718"/> + <source>translation with extras-quoted field</source> + <translation type="unfinished"></translation> + <extra-quoted> string with spaces </extra-quoted> + </message> +</context> +<context> + <name>QTBUG36589</name> + <message> + <location filename="main.cpp" line="728"/> + <source>string after an enum class</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QTBUG99415</name> + <message> + <location filename="main.cpp" line="707"/> + <source>text1</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="711"/> + <source>text2</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..85a1e3ac0 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp @@ -1,32 +1,32 @@ -/**************************************************************************** -** -** 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, +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + + +// 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 @@ -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,97 @@ 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"); + + +// New in C++14: integer literals may contain single quotes as separator. +struct IntLiteralsWithSeparators { + long d = 10'000'000'0'00; + int x = 0x1'AF'FE; + int X = 0X2'E5E7; +}; + + +// QTBUG-59802: prefixed string literals +class PrefixedStringLiterals : public QObject { + Q_OBJECT + void foo() + { + #if 0 + tr(u8"UTF-8 string literal"); + tr(u8R"(UTF-8 raw string literal)"); + tr(u"UTF-16 string literal"); + tr(uR"(UTF-16 raw string literal)"); + tr(U"UTF-32 string literal"); + tr(UR"(UTF-32 raw string literal)"); + tr(L"wide string literal"); + tr(LR"(wide raw string literal)"); + #endif + } +}; + +// QTBUG-110949: trailing return types with template parameters +class TrailingReturnType : public QObject { + Q_OBJECT + auto f1() -> QString + { + return tr("f1: trailing return type"); + } + auto f2() -> QString; + auto f3() -> std::vector<QString> + { + return { tr("f3: trailing return type") }; + } + auto f4() -> std::vector<QString> + { + return { tr("f4: trailing return type") }; + } + auto f5() -> decltype([]() { return 1; }) + { + tr("f5: trailing return type"); + } + auto f6() -> decltype([]() { return 1; }); +}; + +auto TrailingReturnType::f2() -> QString +{ + return tr("f2: trailing return type"); +} + +auto TrailingReturnType::f4() -> std::vector<QString> +{ + return { tr("f4: trailing return type") }; +} + +auto TrailingReturnType::f6() -> decltype([]() { return 1; }) +{ + tr("f6: trailing return type"); + return {}; +} + +// Check that our -> handling doesn't break the common cases. +class SomeClassWithArrowInMethods : public QObject { + Q_OBJECT + void f1() + { + mainWindow->setWindowTitle(QObject::tr("SomeClassWithArrowInMethods::f1")); + } + void f2(); + void f3() + { + mainWindow->setWindowTitle(tr("SomeClassWithArrowInMethods::f3")); + } + void f4(); +}; + +SomeClassWithArrowInMethods::f2() +{ + mainWindow->setWindowTitle(QObject::tr("SomeClassWithArrowInMethods::f2")); +} + +SomeClassWithArrowInMethods::f4() +{ + mainWindow->setWindowTitle(tr("SomeClassWithArrowInMethods::f4")); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.h b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.h index 23aa03ab1..b1e01da6c 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.h +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.h @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result index 0710915de..2f65832ed 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result @@ -18,6 +18,49 @@ </message> </context> <context> + <name>PrefixedStringLiterals</name> + <message> + <location filename="main.cpp" line="158"/> + <source>UTF-8 string literal</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="159"/> + <source>UTF-8 raw string literal</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="160"/> + <source>UTF-16 string literal</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="161"/> + <source>UTF-16 raw string literal</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="162"/> + <source>UTF-32 string literal</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="163"/> + <source>UTF-32 raw string literal</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="164"/> + <source>wide string literal</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="165"/> + <source>wide raw string literal</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>QObject</name> <message> <location filename="main.cpp" line="107"/> @@ -48,6 +91,29 @@ This is a test string </source> <translation type="unfinished"></translation> </message> + <message> + <location filename="main.cpp" line="214"/> + <source>SomeClassWithArrowInMethods::f1</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="226"/> + <source>SomeClassWithArrowInMethods::f2</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>SomeClassWithArrowInMethods</name> + <message> + <location filename="main.cpp" line="219"/> + <source>SomeClassWithArrowInMethods::f3</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="231"/> + <source>SomeClassWithArrowInMethods::f4</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>TopLevel</name> @@ -66,6 +132,40 @@ This is a test string </message> </context> <context> + <name>TrailingReturnType</name> + <message> + <location filename="main.cpp" line="175"/> + <source>f1: trailing return type</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="180"/> + <source>f3: trailing return type</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="184"/> + <location filename="main.cpp" line="200"/> + <source>f4: trailing return type</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="188"/> + <source>f5: trailing return type</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="195"/> + <source>f2: trailing return type</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="205"/> + <source>f6: trailing return type</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>global</name> <message> <location filename="main.cpp" line="127"/> 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..933337894 --- /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. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + + +// 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..ccdefdad5 --- /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. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + + +// 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 " 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> +"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." +</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/expectedoutput.txt new file mode 100644 index 000000000..4ce39f634 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/expectedoutput.txt @@ -0,0 +1,5 @@ +.*[/\\]lupdate[/\\]testdata[/\\]good[/\\]parsecpp_clang_only[/\\]test_QT_TR_NOOP_context.cpp:51:26: QT_TR_NOOP cannot be called without context\. The call is ignored \(missing Q_OBJECT maybe\?\) +.*[/\\]lupdate[/\\]testdata[/\\]good[/\\]parsecpp_clang_only[/\\]test_QT_TR_NOOP_context.cpp:91:26: QT_TR_NOOP cannot be called without context\. The call is ignored \(missing Q_OBJECT maybe\?\) +.*[/\\]lupdate[/\\]testdata[/\\]good[/\\]parsecpp_clang_only[/\\]test_QT_TR_NOOP_context_bis.cpp:51:26: QT_TR_NOOP cannot be called without context\. The call is ignored \(missing Q_OBJECT maybe\?\) +.*[/\\]lupdate[/\\]testdata[/\\]good[/\\]parsecpp_clang_only[/\\]test_QT_TR_NOOP_context_bis.cpp:91:26: QT_TR_NOOP cannot be called without context\. The call is ignored \(missing Q_OBJECT maybe\?\) +.*[/\\]lupdate[/\\]testdata[/\\]good[/\\]parsecpp_clang_only[/\\]test_isolatedComments.cpp:84:0: TRANSLATOR cannot be called without comment. The call is ignored. diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/lupdatecmd new file mode 100644 index 000000000..e8aa3b3d0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/lupdatecmd @@ -0,0 +1 @@ +lupdate project.pro -tr-function-alias QT_TRANSLATE_NOOP+=ma_fonction_a_moi diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/my_include.h b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/my_include.h new file mode 100644 index 000000000..bd6cc0ca0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/my_include.h @@ -0,0 +1,33 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + +#include <QtCore> + +class Foo +{ + Q_OBJECT +}; diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.pro new file mode 100644 index 000000000..e9e5188d9 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.pro @@ -0,0 +1,9 @@ +SOURCES += test_QT_TR_NOOP_context.cpp +SOURCES += test_QT_TR_NOOP_context_bis.cpp +SOURCES += test_isolatedComments.cpp +SOURCES += test_sameLineComments.cpp +SOURCES += test_contain_only_alias.cpp +SOURCES += test_line_directive.cpp +SOURCES += test_header_only.cpp + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.ts.result new file mode 100644 index 000000000..47bd60e6b --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.ts.result @@ -0,0 +1,319 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1"> +<context> + <name>Class</name> + <message> + <location filename="test_header_only.h" line="36"/> + <source>translation_in_hearder</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>CommentOnSameLineExtraComment</name> + <message> + <location filename="test_sameLineComments.cpp" line="46"/> + <source>extra comment before translation. , and = in between</source> + <extracomment>other extra comment</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="test_sameLineComments.cpp" line="47"/> + <source>extra comment before translation. = in between</source> + <extracomment>extra2</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="test_sameLineComments.cpp" line="50"/> + <source>extra comment before translation</source> + <extracomment>extra3</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="test_sameLineComments.cpp" line="53"/> + <source>extra comment before translation. ; in between</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>CommentOnSameLineMetaDataComment</name> + <message id="other metaData"> + <location filename="test_sameLineComments.cpp" line="35"/> + <source>meta data comment before translation. , and = in between</source> + <translation type="unfinished"></translation> + </message> + <message id="metaData2"> + <location filename="test_sameLineComments.cpp" line="36"/> + <source>meta data comment before translation. = in between</source> + <translation type="unfinished"></translation> + </message> + <message id="metaData3"> + <location filename="test_sameLineComments.cpp" line="39"/> + <source>meta data comment before translation</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Foo</name> + <message> + <location filename="test_QT_TR_NOOP_context.cpp" line="37"/> + <location filename="test_QT_TR_NOOP_context_bis.cpp" line="37"/> + <source>context Foo. noop</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>FooChild</name> + <message> + <location filename="test_QT_TR_NOOP_context_with_comments.h" line="35"/> + <source>context FooChild. noop with comments</source> + <extracomment>Some comments</extracomment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>GluedNumber1</name> + <message> + <location filename="test_isolatedComments.cpp" line="59"/> + <source></source> + <comment>blabla</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>GluedNumber2</name> + <message> + <location filename="test_isolatedComments.cpp" line="60"/> + <source></source> + <comment>blabla</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>GluedNumber3</name> + <message> + <location filename="test_isolatedComments.cpp" line="61"/> + <source></source> + <comment>blabla</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>GluedNumber4</name> + <message> + <location filename="test_isolatedComments.cpp" line="62"/> + <source></source> + <comment>// whatever we have here</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>GluedNumber5</name> + <message> + <location filename="test_isolatedComments.cpp" line="69"/> + <source></source> + <comment>// whatever2 we2 have2 here2</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>GluedOnSameLineOne</name> + <message> + <location filename="test_isolatedComments.cpp" line="76"/> + <source></source> + <comment>blabla</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>GluedOnSameLineTwo</name> + <message> + <location filename="test_isolatedComments.cpp" line="76"/> + <source></source> + <comment>blabla</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>IN_NESTED</name> + <message> + <location filename="test_QT_TR_NOOP_context.cpp" line="61"/> + <location filename="test_QT_TR_NOOP_context_bis.cpp" line="61"/> + <source>context IN_NESTED. tr</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="test_QT_TR_NOOP_context.cpp" line="62"/> + <location filename="test_QT_TR_NOOP_context_bis.cpp" line="62"/> + <source>context IN_NESTED. noop</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>MULTIPLELINE</name> + <message> + <location filename="test_isolatedComments.cpp" line="32"/> + <source></source> + <comment>first line second line</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>MultipleAppearance</name> + <message> + <location filename="test_isolatedComments.cpp" line="55"/> + <source></source> + <comment>first appearance</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="test_isolatedComments.cpp" line="57"/> + <source></source> + <comment>second appearance</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>MultipleLineFourthTry</name> + <message> + <location filename="test_isolatedComments.cpp" line="48"/> + <source></source> + <comment>first line second line</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>MultipleLineSecondTry</name> + <message> + <location filename="test_isolatedComments.cpp" line="36"/> + <source></source> + <comment>first line second line</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>MultipleLineThirdTry</name> + <message> + <location filename="test_isolatedComments.cpp" line="42"/> + <source></source> + <comment>first line second line</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>ONLY_Q</name> + <message> + <location filename="test_QT_TR_NOOP_context.cpp" line="44"/> + <location filename="test_QT_TR_NOOP_context_bis.cpp" line="44"/> + <source>context ONLY_Q. noop</source> + <translation type="unfinished"></translation> + </message> + <message numerus="yes"> + <location filename="test_QT_TR_NOOP_context.cpp" line="45"/> + <location filename="test_QT_TR_NOOP_context_bis.cpp" line="45"/> + <source>context ONLY_Q. noop N</source> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> +</context> +<context> + <name>QObject</name> + <message> + <location filename="test_line_directive.cpp" line="3"/> + <source>blabla 1</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="test_line_directive.cpp" line="7"/> + <source>blabla 2</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>WithQDeclareTr::Nested</name> + <message> + <location filename="test_QT_TR_NOOP_context.cpp" line="74"/> + <location filename="test_QT_TR_NOOP_context_bis.cpp" line="74"/> + <source>context WithQDeclareTr::Nested. tr</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="test_QT_TR_NOOP_context.cpp" line="75"/> + <location filename="test_QT_TR_NOOP_context_bis.cpp" line="75"/> + <source>context WithQDeclareTr::Nested. noop</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>inHeader</name> + <message> + <location filename="test_isolatedComments.h" line="29"/> + <source></source> + <comment>how to pick this up Not triggering visit from AST visitor</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>my_arg</name> + <message> + <location filename="test_QT_TR_NOOP_context.cpp" line="63"/> + <location filename="test_QT_TR_NOOP_context_bis.cpp" line="63"/> + <source>context my_arg. translate_noop</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>test2::BB</name> + <message> + <location filename="test_QT_TR_NOOP_context.cpp" line="114"/> + <location filename="test_QT_TR_NOOP_context_bis.cpp" line="114"/> + <source>context test2::BB. tr</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="test_QT_TR_NOOP_context.cpp" line="115"/> + <location filename="test_QT_TR_NOOP_context_bis.cpp" line="115"/> + <source>context test2::BB. noop</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>test3::D</name> + <message> + <location filename="test_QT_TR_NOOP_context.cpp" line="137"/> + <location filename="test_QT_TR_NOOP_context_bis.cpp" line="137"/> + <source>context test3::D. tr</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="test_QT_TR_NOOP_context.cpp" line="138"/> + <location filename="test_QT_TR_NOOP_context_bis.cpp" line="138"/> + <source>context test3::D. noop</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>test4::A::B::C</name> + <message> + <location filename="test_QT_TR_NOOP_context.cpp" line="158"/> + <location filename="test_QT_TR_NOOP_context_bis.cpp" line="158"/> + <source>context is test4::A::B::C. tr</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="test_QT_TR_NOOP_context.cpp" line="159"/> + <location filename="test_QT_TR_NOOP_context_bis.cpp" line="159"/> + <source>context is test4::A::B::C. noop</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>zscope</name> + <message> + <location filename="test_contain_only_alias.cpp" line="33"/> + <source>string_a_moi</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_QT_TR_NOOP_context.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_QT_TR_NOOP_context.cpp new file mode 100644 index 000000000..0eca1e66a --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_QT_TR_NOOP_context.cpp @@ -0,0 +1,165 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + + +#include <QtCore> +#include "my_include.h" + +int X = 111222332444; + +// Q_OBJECT declared in an other file +class FooChild : public Foo +{ + const char *c_noop = QT_TR_NOOP("context Foo. noop"); +}; + +// No Q_OBJECT. Q_DECLARE_TR_FUNCTIONS. It is enough for tr, it is enough for QT_TR_NOOP +class OnlyQDeclare +{ + Q_DECLARE_TR_FUNCTIONS(ONLY_Q) + const char *c_noop = QT_TR_NOOP("context ONLY_Q. noop"); + const char *c_noop_n = QT_TR_N_NOOP("context ONLY_Q. noop N"); +}; + +// Show the message warning that the QT_TR_NOOP is ignored because no context could be found. +class Nothing +{ + const char *c_noop = QT_TR_NOOP("context Nothing. noop with no Q_OBJECT nor Q_DECLARE_TR_FUNCTIONS"); +}; + +// The closest Q_OBJECT or Q_DECLARE_TR_FUNCTIONS gives the context +class WithQObject +{ + Q_OBJECT + class Nested + { + Q_DECLARE_TR_FUNCTIONS(IN_NESTED) + QString c_tr = tr("context IN_NESTED. tr"); + const char *c_noop = QT_TR_NOOP("context IN_NESTED. noop"); + const char *c_noop_translate = QT_TRANSLATE_NOOP("my_arg", "context my_arg. translate_noop"); + }; +}; + +// The closest Q_OBJECT or Q_DECLARE_TR_FUNCTIONS gives the context +class WithQDeclareTr +{ + Q_DECLARE_TR_FUNCTIONS(A_CONTEXT) + class Nested + { + Q_OBJECT + QString c_tr = tr("context WithQDeclareTr::Nested. tr"); + const char *c_noop = QT_TR_NOOP("context WithQDeclareTr::Nested. noop"); + }; +}; + +// Case where Q_OBJECT is not seen. Behavior reproduces tr function behavior +namespace test1 { + class AA + { + Q_OBJECT + public: + class A {}; + }; + + class B : public AA::A + { + //QString c_tr = tr(" the Q_OBJECT is not seen"); // this will generate an error. + const char *c_noop = QT_TR_NOOP("the Q_OBJECT is not seen"); // Once exploring the bases of B (that is AA:A) + // we are not looking for the parents + // AA is the parent of A in terms of CXXContextDecl::getParent() + // This reproduced tr behavior. + }; +} + +namespace test2 { + class AA + { + Q_OBJECT + public: + class A {}; + }; + + class C {}; + + class BB + { + Q_OBJECT + public: + class B : public AA::A, public C + { + QString c_tr = tr("context test2::BB. tr"); + const char *c_noop = QT_TR_NOOP("context test2::BB. noop"); + }; + }; +} + +namespace test3 { + class AA + { + Q_OBJECT + public: + class A {}; + }; + + class D {Q_OBJECT}; + class C : public D {}; + + class BB + { + Q_OBJECT + public: + class B : public AA::A, public C + { + QString c_tr = tr("context test3::D. tr"); + const char *c_noop = QT_TR_NOOP("context test3::D. noop"); + }; + }; +} + +namespace test4 { + + class A + { + Q_OBJECT + public: + class B + { + public: + class C + { + Q_OBJECT + public: + class D + { + QString c_tr = tr("context is test4::A::B::C. tr"); + const char *c_noop = QT_TR_NOOP("context is test4::A::B::C. noop"); + }; + }; + }; + }; + +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_QT_TR_NOOP_context_bis.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_QT_TR_NOOP_context_bis.cpp new file mode 100644 index 000000000..7d30a38ce --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_QT_TR_NOOP_context_bis.cpp @@ -0,0 +1,165 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + + +#include <QtCore> +#include "my_include.h" +// Testing with two files to check that patch https://codereview.qt-project.org/c/qt/qttools/+/338709/1..3 still works +int X = 111222332444; + +// Q_OBJECT declared in an other file +class FooChild : public Foo +{ + const char *c_noop = QT_TR_NOOP("context Foo. noop"); +}; + +// No Q_OBJECT. Q_DECLARE_TR_FUNCTIONS. It is enough for tr, it is enough for QT_TR_NOOP +class OnlyQDeclare +{ + Q_DECLARE_TR_FUNCTIONS(ONLY_Q) + const char *c_noop = QT_TR_NOOP("context ONLY_Q. noop"); + const char *c_noop_n = QT_TR_N_NOOP("context ONLY_Q. noop N"); +}; + +// Show the message warning that the QT_TR_NOOP is ignored because no context could be found. +class Nothing +{ + const char *c_noop = QT_TR_NOOP("context Nothing. noop with no Q_OBJECT nor Q_DECLARE_TR_FUNCTIONS"); +}; + +// The closest Q_OBJECT or Q_DECLARE_TR_FUNCTIONS gives the context +class WithQObject +{ + Q_OBJECT + class Nested + { + Q_DECLARE_TR_FUNCTIONS(IN_NESTED) + QString c_tr = tr("context IN_NESTED. tr"); + const char *c_noop = QT_TR_NOOP("context IN_NESTED. noop"); + const char *c_noop_translate = QT_TRANSLATE_NOOP("my_arg", "context my_arg. translate_noop"); + }; +}; + +// The closest Q_OBJECT or Q_DECLARE_TR_FUNCTIONS gives the context +class WithQDeclareTr +{ + Q_DECLARE_TR_FUNCTIONS(A_CONTEXT) + class Nested + { + Q_OBJECT + QString c_tr = tr("context WithQDeclareTr::Nested. tr"); + const char *c_noop = QT_TR_NOOP("context WithQDeclareTr::Nested. noop"); + }; +}; + +// Case where Q_OBJECT is not seen. Behavior reproduces tr function behavior +namespace test1 { + class AA + { + Q_OBJECT + public: + class A {}; + }; + + class B : public AA::A + { + //QString c_tr = tr(" the Q_OBJECT is not seen"); // this will generate an error. + const char *c_noop = QT_TR_NOOP("the Q_OBJECT is not seen"); // Once exploring the bases of B (that is AA:A) + // we are not looking for the parents + // AA is the parent of A in terms of CXXContextDecl::getParent() + // This reproduced tr behavior. + }; +} + +namespace test2 { + class AA + { + Q_OBJECT + public: + class A {}; + }; + + class C {}; + + class BB + { + Q_OBJECT + public: + class B : public AA::A, public C + { + QString c_tr = tr("context test2::BB. tr"); + const char *c_noop = QT_TR_NOOP("context test2::BB. noop"); + }; + }; +} + +namespace test3 { + class AA + { + Q_OBJECT + public: + class A {}; + }; + + class D {Q_OBJECT}; + class C : public D {}; + + class BB + { + Q_OBJECT + public: + class B : public AA::A, public C + { + QString c_tr = tr("context test3::D. tr"); + const char *c_noop = QT_TR_NOOP("context test3::D. noop"); + }; + }; +} + +namespace test4 { + + class A + { + Q_OBJECT + public: + class B + { + public: + class C + { + Q_OBJECT + public: + class D + { + QString c_tr = tr("context is test4::A::B::C. tr"); + const char *c_noop = QT_TR_NOOP("context is test4::A::B::C. noop"); + }; + }; + }; + }; + +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_QT_TR_NOOP_context_with_comments.h b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_QT_TR_NOOP_context_with_comments.h new file mode 100644 index 000000000..59da401e9 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_QT_TR_NOOP_context_with_comments.h @@ -0,0 +1,36 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + + +#include <QtCore> + +class FooChild +{ + Q_OBJECT + //: Some comments + const char *c_noop = QT_TR_NOOP("context FooChild. noop with comments"); +}; diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_contain_only_alias.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_contain_only_alias.cpp new file mode 100644 index 000000000..3af8c48e5 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_contain_only_alias.cpp @@ -0,0 +1,35 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + + +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include <QtCore> +const char *c_2 = ma_fonction_a_moi("zscope", "string_a_moi"); + +#endif diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_header_only.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_header_only.cpp new file mode 100644 index 000000000..01b0f6d24 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_header_only.cpp @@ -0,0 +1,28 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + +#include "test_header_only.h" diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_header_only.h b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_header_only.h new file mode 100644 index 000000000..3f8c1b0a8 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_header_only.h @@ -0,0 +1,39 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + + +#include <QtCore> + +class Class +{ + Q_OBJECT + void function() + { + tr("translation_in_hearder"); + } + +}; diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_isolatedComments.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_isolatedComments.cpp new file mode 100644 index 000000000..6677145d3 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_isolatedComments.cpp @@ -0,0 +1,84 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + +#include <QtCore/QtCore> +#include "test_isolatedComments.h" +#include "test_QT_TR_NOOP_context_with_comments.h" + +/* TRANSLATOR MULTIPLELINE + first line + second line + */ +/* TRANSLATOR + MultipleLineSecondTry + first line + second line + */ + +/* TRANSLATOR + MultipleLineThirdTry first + line + second line + */ + +/* TRANSLATOR + MultipleLineFourthTry first + line + second line + */ + + +/* TRANSLATOR MultipleAppearance first appearance */ + +/* TRANSLATOR MultipleAppearance second appearance */ + +/* TRANSLATOR GluedNumber1 blabla */ +/* TRANSLATOR GluedNumber2 blabla */ +// TRANSLATOR GluedNumber3 blabla +/*TRANSLATOR +GluedNumber4 + // whatever + we + have + here +*/ +/* TRANSLATOR GluedNumber5 + // whatever2 + we2 + have2 + here2 +*/ + +/* TRANSLATOR GluedOnSameLineOne blabla*/ /* TRANSLATOR GluedOnSameLineTwo blabla*/ +// TRANSLATORMISSINGSPACE this will not be picked up by clang cpp parser +// oooTRANSLATOR SomethingBeforeTranslator this should not be picked up +// ooo TRANSLATOR SomethingBeforeTranslatorTwo this should not be picked up +/* ooo TRANSLATOR SomethingBeforeTranslatorThree this should not be picked up */ +/* ~ TRANSLATOR SomethingBeforeTranslatorFour this + should not be picked up */ +// The following comment should be ignored because the comment part is empty +/* TRANSLATOR onlyContext */ diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_isolatedComments.h b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_isolatedComments.h new file mode 100644 index 000000000..94817de75 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_isolatedComments.h @@ -0,0 +1,33 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + + +/* TRANSLATOR + inHeader + how to pick this up + Not triggering visit from AST visitor + */ diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_line_directive.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_line_directive.cpp new file mode 100644 index 000000000..ed3fc9520 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_line_directive.cpp @@ -0,0 +1,7 @@ +#include <QtCore> + +QString t1 = QObject::tr("blabla 1"); + +#line 1 "toto.cpp" + +QString t2 = QObject::tr("blabla 2"); diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_sameLineComments.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_sameLineComments.cpp new file mode 100644 index 000000000..6f0ddefab --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/test_sameLineComments.cpp @@ -0,0 +1,54 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + + +#include <QtCore/QtCore> + +class CommentOnSameLineMetaDataComment +{ + Q_OBJECT + //= other metaData + void hello(int something /*= metaData1 */, QString str = tr("meta data comment before translation. , and = in between")); + void hellobis(/*= metaData2 */QString str = tr("meta data comment before translation. = in between")); + void hellobiss() + { + hellobis(/*= metaData3*/ tr("meta data comment before translation")); + } +}; +class CommentOnSameLineExtraComment +{ + Q_OBJECT + //: other extra comment + void hello(int something /*: extra1 */, QString str = tr("extra comment before translation. , and = in between")); + void hellobis(/*: extra2 */QString str = tr("extra comment before translation. = in between")); + void hellobiss() + { + hellobis(/*: extra3*/ tr("extra comment before translation")); + } + //: other extra comment + QString toto/*: extra4*/; QString titi = tr("extra comment before translation. ; in between"); +}; 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..66e6152ef --- /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. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + + +//#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..ff7fe370b --- /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. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + +#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..0b70f3b14 --- /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. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + + +// 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..3f502fffe --- /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. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + +#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..ad871b20c --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_parser/project.ts.result @@ -0,0 +1,666 @@ +<?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 " 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>&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<<</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 'LTR' in left-to-right languages or to 'RTL' 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> + <message> + <location filename="included.cpp" line="30"/> + <source>message from #included .cpp file</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/parseidbasedui/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseidbasedui/project.ts.result index 989aabcbb..96ad9277e 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseidbasedui/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parseidbasedui/project.ts.result @@ -4,12 +4,12 @@ <context> <name>FindDialog</name> <message id="windowTitleId"> - <location filename="project.ui" line="42"/> + <location filename="project.ui" line="18"/> <source>Qt Assistant - Finn text</source> <translation type="unfinished"></translation> </message> <message id="heightId"> - <location filename="project.ui" line="45"/> + <location filename="project.ui" line="21"/> <source>Finn tekst - Der Bjørn möchte auch mal.</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/parseidbasedui/project.ui b/tests/auto/linguist/lupdate/testdata/good/parseidbasedui/project.ui index 684033ddb..f44278306 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseidbasedui/project.ui +++ b/tests/auto/linguist/lupdate/testdata/good/parseidbasedui/project.ui @@ -1,32 +1,8 @@ <ui version="4.0" idbasedtr="true"> - <author></author> -<comment>********************************************************************* -** -** Copyright (C) 2017 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$ -** -*********************************************************************</comment> +<comment> +* Copyright (C) 2017 The Qt Company Ltd. +* SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +</comment> <exportmacro></exportmacro> <class>FindDialog</class> <widget class="QWidget" name="FindDialog" > diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejava/main.java b/tests/auto/linguist/lupdate/testdata/good/parsejava/main.java index da3af7650..3bb2c111c 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsejava/main.java +++ b/tests/auto/linguist/lupdate/testdata/good/parsejava/main.java @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtTools 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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!!! diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejs/main.js b/tests/auto/linguist/lupdate/testdata/good/parsejs/main.js index 9f61cea8f..964ec72a1 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsejs/main.js +++ b/tests/auto/linguist/lupdate/testdata/good/parsejs/main.js @@ -89,3 +89,6 @@ var more_greeting_strings = [ QT_TRID_NOOP("qtn_needle"), QT_TRID_NOOP("qtn_hays //: qsTrId() with comment, meta-data and plurals. //~ well-tested True qsTrId("qtn_bar_baz", 10); + +//~ quoted " string with spaces " +qsTr("translation with extras-quoted field"); diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejs/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsejs/project.ts.result index 8df655fec..b505d3608 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsejs/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsejs/project.ts.result @@ -191,5 +191,11 @@ <numerusform></numerusform> </translation> </message> + <message> + <location filename="main.js" line="94"/> + <source>translation with extras-quoted field</source> + <translation type="unfinished"></translation> + <extra-quoted> string with spaces </extra-quoted> + </message> </context> </TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejs4/main.js b/tests/auto/linguist/lupdate/testdata/good/parsejs4/main.js index 7a709ad92..3daafc480 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsejs4/main.js +++ b/tests/auto/linguist/lupdate/testdata/good/parsejs4/main.js @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + .pragma library .import QtQuick 2.0 as Quick2 diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejscontexts/main.js b/tests/auto/linguist/lupdate/testdata/good/parsejscontexts/main.js index aa510c1ae..e34662062 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsejscontexts/main.js +++ b/tests/auto/linguist/lupdate/testdata/good/parsejscontexts/main.js @@ -27,3 +27,6 @@ qsTranslate("Foo", "Nine"); // Empty context. // TRANSLATOR qsTr("Ten"); + +// setting context with TRANSLATOR comment is not supported on the QML side +// The support on the lupdate side has been removed diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejscontexts/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsejscontexts/project.ts.result index e36dbe4fa..61de0454c 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsejscontexts/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsejscontexts/project.ts.result @@ -2,45 +2,25 @@ <!DOCTYPE TS> <TS version="2.1"> <context> - <name></name> - <message> - <location filename="main.js" line="29"/> - <source>Ten</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>Bar</name> + <name>Foo</name> <message> - <location filename="main.js" line="10"/> - <source>Five</source> + <location filename="main.js" line="25"/> + <source>Nine</source> <translation type="unfinished"></translation> </message> </context> <context> - <name>Bar::Baz</name> + <name>main</name> <message> - <location filename="main.js" line="22"/> - <source>Eight</source> + <location filename="main.js" line="2"/> + <source>One</source> <translation type="unfinished"></translation> </message> -</context> -<context> - <name>Baz</name> - <message> - <location filename="main.js" line="12"/> - <source></source> - <comment>This is a comment to the translator.</comment> - <translation></translation> - </message> <message> - <location filename="main.js" line="16"/> - <source>Six</source> + <location filename="main.js" line="3"/> + <source>Two</source> <translation type="unfinished"></translation> </message> -</context> -<context> - <name>Foo</name> <message> <location filename="main.js" line="6"/> <source>Three</source> @@ -52,29 +32,28 @@ <translation type="unfinished"></translation> </message> <message> - <location filename="main.js" line="25"/> - <source>Nine</source> + <location filename="main.js" line="10"/> + <source>Five</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="16"/> + <source>Six</source> <translation type="unfinished"></translation> </message> -</context> -<context> - <name>Foo.Bar</name> <message> <location filename="main.js" line="19"/> <source>Seven</source> <translation type="unfinished"></translation> </message> -</context> -<context> - <name>main</name> <message> - <location filename="main.js" line="2"/> - <source>One</source> + <location filename="main.js" line="22"/> + <source>Eight</source> <translation type="unfinished"></translation> </message> <message> - <location filename="main.js" line="3"/> - <source>Two</source> + <location filename="main.js" line="29"/> + <source>Ten</source> <translation type="unfinished"></translation> </message> </context> diff --git a/tests/auto/linguist/lupdate/testdata/good/parseobjc/main.mm b/tests/auto/linguist/lupdate/testdata/good/parseobjc/main.mm index 7cc1c34e3..f04701a98 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseobjc/main.mm +++ b/tests/auto/linguist/lupdate/testdata/good/parseobjc/main.mm @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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$ -** -****************************************************************************/ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + #include <QtCore/qcoreapplication.h> diff --git a/tests/auto/linguist/lupdate/testdata/good/parsepython/main.py b/tests/auto/linguist/lupdate/testdata/good/parsepython/main.py new file mode 100644 index 000000000..5c0c77851 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsepython/main.py @@ -0,0 +1,95 @@ +from pathlib import Path +import sys + +from PySide6.QtCore import (QItemSelection, QLibraryInfo, QLocale, QTranslator, + Qt, Slot) +from PySide6.QtWidgets import (QAbstractItemView, QApplication, QListWidget, + QMainWindow, QWidget) +import linguist_rc + +"""" + Misleading indentation (5) for PYSIDE-2379""" + +class Window(QMainWindow): + def __init__(self): + super().__init__() + #: File menu + file_menu = self.menuBar().addMenu(self.tr("&File")) + #= quit_id + quit_action = file_menu.addAction(self.tr("Quit")) + quit_action.setShortcut(self.tr("CTRL+Q")) + quit_action.triggered.connect(self.close) + help_menu = self.menuBar().addMenu(self.tr("&Help")) + about_qt_action = help_menu.addAction(self.tr("About Qt")) + about_qt_action.triggered.connect(qApp.aboutQt) + + self._list_widget = QListWidget() + self._list_widget.setSelectionMode(QAbstractItemView.MultiSelection) + self._list_widget.selectionModel().selectionChanged.connect(self.selection_changed) + self._list_widget.addItem("C++") + self._list_widget.addItem("Java") + self._list_widget.addItem("Python") + self.setCentralWidget(self._list_widget) + + @Slot(QItemSelection, QItemSelection) + def selection_changed(self, selected, deselected): + count = len(self._list_widget.selectionModel().selectedRows()) + message = self.tr("%n language(s) selected", "", count) + self.statusBar().showMessage(message) + + def test_translate_trailing_comma_behavior(self): + self.translate("CONTEXT", + "SOME TEXT, NO COMMENT, TRAILING COMMA", + ) + self.translate("CONTEXT", + "SOME TEXT", + "A COMMENT, NO TRAILING COMMA" + ) + self.translate("CONTEXT", + "SOME MORE TEXT", + "A COMMENT WITH A TRAILING COMMA", + ) + self.translate("CONTEXT", + "EVEN MORE TEXT", + "A COMMENT WITH PLURALIZATION", + 42 + ) + self.translate("CONTEXT", + "YET MORE TEXT", + "A COMMENT WITH PLURALIZATION AND A TRAILING COMMA", + 42, + ) + self.translate("CONTEXT", + "SOME TEXT, SHOULD NOT BE EXTRACTED", + "A COMMENT WITH PLURALIZATION AND A TRAILING COMMA AND GARBAGE", + 42, + "THIS SHOULD NOT WORK" + ) + + class NestedClass: + def foo(self): + msg = self.tr("Nested Message") + + def window_method(self): # PYSIDE-2379, Don't put this into NestedClass + msg = self.tr("Window Message") + msg = self.tr(f"An f-string\\") + msg = self.tr(r"A raw strin\g") + msg = self.tr(r"A raw strin\g""continued\\") + msg = self.tr(r"A raw string with escaped quote\"bla") + + +if __name__ == '__main__': + app = QApplication(sys.argv) + + path = QLibraryInfo.location(QLibraryInfo.TranslationsPath) + translator = QTranslator(app) + if translator.load(QLocale.system(), 'qtbase_', '', path): + app.installTranslator(translator) + translator = QTranslator(app) + path = ':/translations' + if translator.load(QLocale.system(), 'example_', '', path): + app.installTranslator(translator) + + window = Window() + window.show() + sys.exit(app.exec()) diff --git a/tests/auto/linguist/lupdate/testdata/good/parsepython/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsepython/project.pro new file mode 100644 index 000000000..ed8aba541 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsepython/project.pro @@ -0,0 +1,3 @@ +SOURCES += main.py + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/parsepython/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsepython/project.ts.result new file mode 100644 index 000000000..df1788672 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsepython/project.ts.result @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1"> +<context> + <name>CONTEXT</name> + <message> + <location filename="main.py" line="44"/> + <source>SOME TEXT, NO COMMENT, TRAILING COMMA</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.py" line="48"/> + <source>SOME TEXT</source> + <comment>A COMMENT, NO TRAILING COMMA</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.py" line="52"/> + <source>SOME MORE TEXT</source> + <comment>A COMMENT WITH A TRAILING COMMA</comment> + <translation type="unfinished"></translation> + </message> + <message numerus="yes"> + <location filename="main.py" line="57"/> + <source>EVEN MORE TEXT</source> + <comment>A COMMENT WITH PLURALIZATION</comment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message numerus="yes"> + <location filename="main.py" line="62"/> + <source>YET MORE TEXT</source> + <comment>A COMMENT WITH PLURALIZATION AND A TRAILING COMMA</comment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> +</context> +<context> + <name>NestedClass</name> + <message> + <location filename="main.py" line="73"/> + <source>Nested Message</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Window</name> + <message> + <location filename="main.py" line="17"/> + <source>&File</source> + <extracomment>File menu</extracomment> + <translation type="unfinished"></translation> + </message> + <message id="quit_id"> + <location filename="main.py" line="19"/> + <source>Quit</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.py" line="20"/> + <source>CTRL+Q</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.py" line="22"/> + <source>&Help</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.py" line="23"/> + <source>About Qt</source> + <translation type="unfinished"></translation> + </message> + <message numerus="yes"> + <location filename="main.py" line="37"/> + <source>%n language(s) selected</source> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message> + <location filename="main.py" line="75"/> + <source>Window Message</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.py" line="76"/> + <source>An f-string\</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.py" line="77"/> + <source>A raw strin\g</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.py" line="78"/> + <source>A raw strin\gcontinued\</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.py" line="81"/> + <source>A raw string with escaped quote"bla</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml b/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml index c966fa112..c19bffc72 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml +++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml @@ -96,5 +96,12 @@ QtObject { //% "Source text" qsTrId("qtn_baz_biz"); + + //~ quoted " string with spaces " + qsTr("translation with extras-quoted field"); + + // template literals are supported + qsTr(`template literal`); + qsTranslate("TemplateLiteral", 'template literal 2'); } } diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml/main_test_pragma.qml b/tests/auto/linguist/lupdate/testdata/good/parseqml/main_test_pragma.qml new file mode 100644 index 000000000..4a13bd3f0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/main_test_pragma.qml @@ -0,0 +1,104 @@ +import QtQuick 1.0 + +pragma Translator: PragmaContext +QtObject { + function translate() { + qsTr("One"); + qsTranslate("FooContext", "Two"); + + var greeting_strings = [ + QT_TR_NOOP("Hello"), + QT_TRANSLATE_NOOP("FooContext", "Goodbye") + ]; + + qsTr("One", "not the same one"); + + //: My first comment. + qsTr("See comment"); + + //: My second comment. + qsTranslate("BarContext", "See other comment"); + + //: My third comment + //: spans two lines. + qsTr("The comment explains it all"); + + //: My fourth comment + //: spans a whopping + //: three lines. + qsTranslate("BazContext", "It should be clear by now"); + + /*: C-style comment. */ + qsTr("I love C++"); + + /*: Another C-style comment. */ + qsTranslate("FooContext", "I really love C++"); + + /*: C-style comment, followed by */ + /*: another one. */ + qsTr("Qt is the best"); + + /*: Another C-style comment, followed by */ + /*: yet another one. */ + qsTranslate("BarContext", "Qt is the very best"); + + // This comment doesn't have any effect. + qsTr("The comment had no effect"); + + // This comment doesn't have any effect either. + qsTranslate("BazContext", "The comment had no effect, really"); + + /* This C-style comment doesn't have any effect. */ + qsTr("No comment to your comment"); + + /* This C-style comment doesn't have any effect either. */ + qsTranslate("FooContext", "I refuse to comment on that"); + + //= id_foo + qsTr("This string has an identifier"); + + //= id_bar + qsTranslate("BarContext", "This string also has an identifier"); + + //~ loc-blank False + qsTr("This string has meta-data"); + + //~ loc-layout_id foo_dialog + qsTranslate("BazContext", "This string also has meta-data"); + + // This comment is to be ignored. + //: This is a comment for the translator. + //= id_baz + //~ foo 123 + //~ magic-stuff This means something special. + qsTr("This string has a lot of information"); + + // This comment is also to be ignored. + //: This is another comment for the translator. + //= id_babar + //~ foo-bar Important stuff + //~ needle-in-haystack Found + //~ overflow True + qsTranslate("FooContext", "This string has even more information"); + + qsTr("This string has disambiguation", "Disambiguation"); + + qsTranslate("BarContext", "This string also has disambiguation", "Another disambiguation"); + + qsTr("This string contains plurals", "", 10); + + qsTrId("qtn_foo_bar"); + + var more_greeting_strings = [ QT_TRID_NOOP("qtn_needle"), QT_TRID_NOOP("qtn_haystack") ]; + + //: qsTrId() with comment, meta-data and plurals. + //~ well-tested True + qsTrId("qtn_bar_baz", 10); + + //% "Source text" + qsTrId("qtn_baz_biz"); + + //~ quoted " string with spaces " + qsTr("translation with extras-quoted field"); + } +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml/project.pro b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.pro index 1040e2227..4e67693d7 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseqml/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.pro @@ -1,3 +1,4 @@ SOURCES += main.qml +SOURCES += main_test_pragma.qml TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result index ce57bd44d..6dc3a5a27 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result @@ -5,21 +5,25 @@ <name></name> <message id="qtn_foo_bar"> <location filename="main.qml" line="89"/> + <location filename="main_test_pragma.qml" line="90"/> <source></source> <translation type="unfinished"></translation> </message> <message id="qtn_needle"> <location filename="main.qml" line="91"/> + <location filename="main_test_pragma.qml" line="92"/> <source></source> <translation type="unfinished"></translation> </message> <message id="qtn_haystack"> <location filename="main.qml" line="91"/> + <location filename="main_test_pragma.qml" line="92"/> <source></source> <translation type="unfinished"></translation> </message> <message id="qtn_bar_baz" numerus="yes"> <location filename="main.qml" line="95"/> + <location filename="main_test_pragma.qml" line="96"/> <source></source> <extracomment>qsTrId() with comment, meta-data and plurals.</extracomment> <translation type="unfinished"> @@ -29,6 +33,7 @@ </message> <message id="qtn_baz_biz"> <location filename="main.qml" line="98"/> + <location filename="main_test_pragma.qml" line="99"/> <source>Source text</source> <translation type="unfinished"></translation> </message> @@ -37,23 +42,27 @@ <name>BarContext</name> <message> <location filename="main.qml" line="19"/> + <location filename="main_test_pragma.qml" line="20"/> <source>See other comment</source> <extracomment>My second comment.</extracomment> <translation type="unfinished"></translation> </message> <message> <location filename="main.qml" line="42"/> + <location filename="main_test_pragma.qml" line="43"/> <source>Qt is the very best</source> <extracomment>Another C-style comment, followed by yet another one.</extracomment> <translation type="unfinished"></translation> </message> <message id="id_bar"> <location filename="main.qml" line="60"/> + <location filename="main_test_pragma.qml" line="61"/> <source>This string also has an identifier</source> <translation type="unfinished"></translation> </message> <message> <location filename="main.qml" line="85"/> + <location filename="main_test_pragma.qml" line="86"/> <source>This string also has disambiguation</source> <comment>Another disambiguation</comment> <translation type="unfinished"></translation> @@ -63,17 +72,20 @@ <name>BazContext</name> <message> <location filename="main.qml" line="28"/> + <location filename="main_test_pragma.qml" line="29"/> <source>It should be clear by now</source> <extracomment>My fourth comment spans a whopping three lines.</extracomment> <translation type="unfinished"></translation> </message> <message> <location filename="main.qml" line="48"/> + <location filename="main_test_pragma.qml" line="49"/> <source>The comment had no effect, really</source> <translation type="unfinished"></translation> </message> <message> <location filename="main.qml" line="66"/> + <location filename="main_test_pragma.qml" line="67"/> <source>This string also has meta-data</source> <translation type="unfinished"></translation> <extra-loc-layout_id>foo_dialog</extra-loc-layout_id> @@ -83,27 +95,32 @@ <name>FooContext</name> <message> <location filename="main.qml" line="6"/> + <location filename="main_test_pragma.qml" line="7"/> <source>Two</source> <translation type="unfinished"></translation> </message> <message> <location filename="main.qml" line="10"/> + <location filename="main_test_pragma.qml" line="11"/> <source>Goodbye</source> <translation type="unfinished"></translation> </message> <message> <location filename="main.qml" line="34"/> + <location filename="main_test_pragma.qml" line="35"/> <source>I really love C++</source> <extracomment>Another C-style comment.</extracomment> <translation type="unfinished"></translation> </message> <message> <location filename="main.qml" line="54"/> + <location filename="main_test_pragma.qml" line="55"/> <source>I refuse to comment on that</source> <translation type="unfinished"></translation> </message> <message id="id_babar"> <location filename="main.qml" line="81"/> + <location filename="main_test_pragma.qml" line="82"/> <source>This string has even more information</source> <extracomment>This is another comment for the translator.</extracomment> <translation type="unfinished"></translation> @@ -113,6 +130,92 @@ </message> </context> <context> + <name>PragmaContext</name> + <message> + <location filename="main_test_pragma.qml" line="6"/> + <source>One</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main_test_pragma.qml" line="10"/> + <source>Hello</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main_test_pragma.qml" line="14"/> + <source>One</source> + <comment>not the same one</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main_test_pragma.qml" line="17"/> + <source>See comment</source> + <extracomment>My first comment.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main_test_pragma.qml" line="24"/> + <source>The comment explains it all</source> + <extracomment>My third comment spans two lines.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main_test_pragma.qml" line="32"/> + <source>I love C++</source> + <extracomment>C-style comment.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main_test_pragma.qml" line="39"/> + <source>Qt is the best</source> + <extracomment>C-style comment, followed by another one.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main_test_pragma.qml" line="46"/> + <source>The comment had no effect</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main_test_pragma.qml" line="52"/> + <source>No comment to your comment</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main_test_pragma.qml" line="64"/> + <source>This string has meta-data</source> + <translation type="unfinished"></translation> + <extra-loc-blank>False</extra-loc-blank> + </message> + <message> + <location filename="main_test_pragma.qml" line="84"/> + <source>This string has disambiguation</source> + <comment>Disambiguation</comment> + <translation type="unfinished"></translation> + </message> + <message numerus="yes"> + <location filename="main_test_pragma.qml" line="88"/> + <source>This string contains plurals</source> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message> + <location filename="main_test_pragma.qml" line="102"/> + <source>translation with extras-quoted field</source> + <translation type="unfinished"></translation> + <extra-quoted> string with spaces </extra-quoted> + </message> +</context> +<context> + <name>TemplateLiteral</name> + <message> + <location filename="main.qml" line="105"/> + <source>template literal 2</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>main</name> <message> <location filename="main.qml" line="5"/> @@ -166,6 +269,7 @@ </message> <message id="id_foo"> <location filename="main.qml" line="57"/> + <location filename="main_test_pragma.qml" line="58"/> <source>This string has an identifier</source> <translation type="unfinished"></translation> </message> @@ -177,6 +281,7 @@ </message> <message id="id_baz"> <location filename="main.qml" line="73"/> + <location filename="main_test_pragma.qml" line="74"/> <source>This string has a lot of information</source> <extracomment>This is a comment for the translator.</extracomment> <translation type="unfinished"></translation> @@ -196,5 +301,16 @@ <numerusform></numerusform> </translation> </message> + <message> + <location filename="main.qml" line="101"/> + <source>translation with extras-quoted field</source> + <translation type="unfinished"></translation> + <extra-quoted> string with spaces </extra-quoted> + </message> + <message> + <location filename="main.qml" line="104"/> + <source>template literal</source> + <translation type="unfinished"></translation> + </message> </context> </TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml2/main.qml b/tests/auto/linguist/lupdate/testdata/good/parseqml2/main.qml index 2b08bf7a0..b5e58420c 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseqml2/main.qml +++ b/tests/auto/linguist/lupdate/testdata/good/parseqml2/main.qml @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + import QtQuick 1.0; QtObject { function translate() { @@ -85,4 +85,4 @@ QT_TRID_NOOP("qtn_bar"); } -}
\ No newline at end of file +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.cpp index a7052dada..dba66cfd6 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.cpp @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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/parseqrc/main.qml b/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.qml index abeb4c4a3..ab47681fe 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.qml +++ b/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.qml @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + import QtQuick 1.0 diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqrc_json/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parseqrc_json/main.cpp new file mode 100644 index 000000000..2b6c70877 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqrc_json/main.cpp @@ -0,0 +1,10 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +// 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/QCoreApplication> + +void func1() { + QCoreApplication::tr("Hello world"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqrc_json/main.js b/tests/auto/linguist/lupdate/testdata/good/parseqrc_json/main.js new file mode 100644 index 000000000..b2e1dd9e0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqrc_json/main.js @@ -0,0 +1 @@ +qsTr("From JavaScript file"); diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqrc_json/main.qml b/tests/auto/linguist/lupdate/testdata/good/parseqrc_json/main.qml new file mode 100644 index 000000000..f86ec5343 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqrc_json/main.qml @@ -0,0 +1,10 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick 1.0 + +QtObject { + function translate() { + qsTr("From QML file in root"); + } +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqrc_json/project.json b/tests/auto/linguist/lupdate/testdata/good/parseqrc_json/project.json new file mode 100644 index 000000000..d7a1db7a3 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqrc_json/project.json @@ -0,0 +1,16 @@ +[ + { + "excluded": [], + "includePaths": [ + ], + "projectFile": "project.pro", + "sources": [ + "main.cpp", + "main.qml", + "project.qrc" + ], + "translations": [ + "project.ts" + ] + } +] diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqrc_json/project.qrc b/tests/auto/linguist/lupdate/testdata/good/parseqrc_json/project.qrc new file mode 100644 index 000000000..87bacf228 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqrc_json/project.qrc @@ -0,0 +1,5 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource prefix="/"> + <file>main.js</file> +</qresource> +</RCC> diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqrc_json/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseqrc_json/project.ts.result new file mode 100644 index 000000000..ea847ab55 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqrc_json/project.ts.result @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1"> +<context> + <name>QCoreApplication</name> + <message> + <location filename="main.cpp" line="9"/> + <source>Hello world</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>main</name> + <message> + <location filename="main.qml" line="8"/> + <source>From QML file in root</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="1"/> + <source>From JavaScript file</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result index 027a366d5..80edae5d7 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result @@ -4,12 +4,12 @@ <context> <name>FindDialog</name> <message> - <location filename="project.ui" line="42"/> + <location filename="project.ui" line="18"/> <source>Qt Assistant - Finn text</source> <translation type="unfinished"></translation> </message> <message> - <location filename="project.ui" line="45"/> + <location filename="project.ui" line="21"/> <source>Finn tekst - Der Bjørn möchte auch mal.</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ui b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ui index 84e1818b7..7be23cbb8 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ui +++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ui @@ -1,32 +1,8 @@ <ui version="4.0" > - <author></author> -<comment>********************************************************************* -** -** 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$ -** -*********************************************************************</comment> +<comment> +* Copyright (C) 2016 The Qt Company Ltd. +* SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +</comment> <exportmacro></exportmacro> <class>FindDialog</class> <widget class="QWidget" name="FindDialog" > diff --git a/tests/auto/linguist/lupdate/testdata/good/prefix/main.cpp b/tests/auto/linguist/lupdate/testdata/good/prefix/main.cpp index 6cef7a28c..05d46a3fd 100644 --- a/tests/auto/linguist/lupdate/testdata/good/prefix/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/prefix/main.cpp @@ -1,35 +1,35 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + +#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..063d51344 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/prefix/main.h @@ -0,0 +1,48 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + +#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..05d46a3fd --- /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. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + +#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..063d51344 --- /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. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + +#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..e831d285d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/preprocess/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/preprocess/main.cpp @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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..fe7615b1e --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/preprocess_clang_parser/expectedoutput.txt @@ -0,0 +1 @@ +.*[/\\]lupdate[/\\]testdata[/\\]good[/\\]preprocess_clang_parser[/\\]main.cpp Code with translation information has been skipped between lines .. and .. 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..bc20bef00 --- /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. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + + +// 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/proparsing/main.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/main.cpp index e7400ce28..1de627e4c 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/main.cpp @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + // 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 <QApplication> void func1() { QApplication::tr("Hello world", "Platform-independent file"); diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/main.qml b/tests/auto/linguist/lupdate/testdata/good/proparsing/main.qml index da332363c..c5933cef9 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing/main.qml +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/main.qml @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + import QtQuick 1.0 diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/main_mac.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/main_mac.cpp index 7c00a19a7..6811d06ae 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing/main_mac.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/main_mac.cpp @@ -1,38 +1,35 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + // 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 <QApplication> void func1() { QApplication::tr("Hello macworld", "mac-only file"); } - - - diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/main_unix.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/main_unix.cpp index 4274c6f72..4da7161b1 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing/main_unix.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/main_unix.cpp @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + // 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 <QApplication> void func1() { QApplication::tr("Hello unixworld", "unix-only file"); diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/main_win.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/main_win.cpp index a963f3eeb..58021aa6f 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing/main_win.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/main_win.cpp @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + // 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 <QApplication> void func1() { QApplication::tr("Hello windowsworld", "Windows-only file"); diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro index 7c6ad99dd..c6a970fae 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro @@ -1,6 +1,8 @@ # Try to reference a variable that does not exist: MYVAR=$$THIS_VARIABLE_IS_NOT_DEFINED +QT += widgets + SOURCES += main.cpp win32 { diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/qml/excluded.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/qml/excluded.cpp index 592ceb4d8..32d0210a6 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing/qml/excluded.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/qml/excluded.cpp @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + int main(int argc, char **argv) { diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/qml/notmain.qml b/tests/auto/linguist/lupdate/testdata/good/proparsing/qml/notmain.qml index 795c9b675..55ebfa0af 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing/qml/notmain.qml +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/qml/notmain.qml @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + import QtQuick 1.0 diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/vpaths/dependpath/main_dependpath.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/vpaths/dependpath/main_dependpath.cpp index 2ac487555..cf9b325f7 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing/vpaths/dependpath/main_dependpath.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/vpaths/dependpath/main_dependpath.cpp @@ -1,38 +1,36 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + // 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 <QApplication> int main(int argc, char **argv) { QCoreApplication::tr("Hello from a VPATH", "See if the VPATH thing works"); } - - diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/main1.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/main1.cpp index ed0cb245e..bbc8d6c0d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/main1.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/main1.cpp @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + // 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 <QApplication> void func1() { QApplication::tr("Hello world", "wildcard/main1.cpp"); diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/mainfile.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/mainfile.cpp index 895e9ffa4..83336d307 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/mainfile.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/mainfile.cpp @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + // 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 <QApplication> void func1() { QApplication::tr("Hello world", "wildcard/main2.cpp"); diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard1.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard1.cpp index 0f6694166..e9c39eaf9 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard1.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard1.cpp @@ -1,37 +1,35 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + // 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 <QApplication> void func1() { QApplication::tr("Hello world", "wildcard1.cpp"); } - - diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard99.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard99.cpp index da6e45f2b..beb679bda 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard99.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard99.cpp @@ -1,37 +1,35 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + // 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 <QApplication> void func1() { QApplication::tr("Hello world", "wildcard99.cpp"); } - - diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/a b/tests/auto/linguist/lupdate/testdata/good/proparsing2/a index cc56055fb..5c63bafa2 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/a +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/a @@ -1,31 +1,31 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Linguist 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + +#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..ddd62c9e8 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/a.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/a.cpp @@ -1,31 +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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + +#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..5625aea06 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/b +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/b @@ -1,31 +1,31 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Linguist 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + +#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..7656986df 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/b.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/b.cpp @@ -1,31 +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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + +#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..a2a4aa1e7 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/e +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/e @@ -1,31 +1,31 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Linguist 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + +#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..1edb1fe4c 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/f/g.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/f/g.cpp @@ -1,31 +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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + +#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..8e7dd8ef1 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/spaces/z +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/spaces/z @@ -1,31 +1,31 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Linguist 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + +#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..7e1f39060 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/variable_with_spaces +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/variable_with_spaces @@ -1,31 +1,31 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Linguist 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + +#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..42f49ad98 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/with +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/with @@ -1,31 +1,31 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Linguist 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + +#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..ba5c3e9a4 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/d +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/d @@ -1,31 +1,31 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Linguist 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + +#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..467394a15 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/variable +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/variable @@ -1,31 +1,31 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Linguist 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + +#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..33ddbb155 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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..1332563bc 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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..19ccb47e2 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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..9af9cfaa0 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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..3118ac1a0 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/main.cpp @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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..436ecefb7 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 @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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..5f43b80c8 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/relativity.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/relativity.cpp @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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..010299a21 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 @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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..ed41af6e2 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 @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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..3118ac1a0 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/main.cpp @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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..3118ac1a0 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/main.cpp @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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..bd88d290f 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/excluded/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/excluded/main.cpp @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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..436ecefb7 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 @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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..fbb0ff89b 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 @@ -1,35 +1,35 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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..412737279 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 @@ -1,35 +1,35 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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..010299a21 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 @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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..ed41af6e2 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 @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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..435b13c63 100644 --- a/tests/auto/linguist/lupdate/testdata/good/reloutput/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/reloutput/main.cpp @@ -1,34 +1,34 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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/resources_cmdline/main.qml b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/main.qml index abeb4c4a3..ab47681fe 100644 --- a/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/main.qml +++ b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/main.qml @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + import QtQuick 1.0 diff --git a/tests/auto/linguist/lupdate/testdata/good/respfile/source1.cpp b/tests/auto/linguist/lupdate/testdata/good/respfile/source1.cpp index 06715c627..64f8d4e61 100644 --- a/tests/auto/linguist/lupdate/testdata/good/respfile/source1.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/respfile/source1.cpp @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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!!! diff --git a/tests/auto/linguist/lupdate/testdata/good/respfile/source2.cpp b/tests/auto/linguist/lupdate/testdata/good/respfile/source2.cpp index c8e4e11f1..d015a26b3 100644 --- a/tests/auto/linguist/lupdate/testdata/good/respfile/source2.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/respfile/source2.cpp @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + // 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!!! diff --git a/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/lupdatecmd index e2f91b5f1..c5dcb6b33 100644 --- a/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/lupdatecmd +++ b/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/lupdatecmd @@ -1 +1 @@ -lupdate main.cpp main.qml -tr-function-alias QT_TRANSLATE_NOOP+=QT_TRANSLATE_NOOP_ALIAS,QT_TRANSLATE_NOOP_UTF8+=QT_TRANSLATE_NOOP_UTF8_ALIAS,QT_TRANSLATE_NOOP3+=QT_TRANSLATE_NOOP3_ALIAS,QT_TRANSLATE_NOOP3_UTF8+=QT_TRANSLATE_NOOP3_UTF8_ALIAS,QT_TRID_NOOP+=QT_TRID_NOOP_ALIAS,Q_DECLARE_TR_FUNCTIONS+=Q_DECLARE_TR_FUNCTIONS_ALIAS,qtTrId+=qtTrId_alias,QT_TR_NOOP+=QT_TR_NOOP_ALIAS,QT_TR_NOOP_UTF8+=QT_TR_NOOP_UTF8_ALIAS,tr+=tr_alias,trUtf8+=trUtf8_alias,translate+=translate_alias,qsTr=MySingletonCustomTranslator.subObject.tr -ts project.ts +lupdate project.pro -tr-function-alias QT_TRANSLATE_NOOP+=QT_TRANSLATE_NOOP_ALIAS,QT_TRANSLATE_NOOP_UTF8+=QT_TRANSLATE_NOOP_UTF8_ALIAS,QT_TRANSLATE_NOOP3+=QT_TRANSLATE_NOOP3_ALIAS,QT_TRANSLATE_NOOP3_UTF8+=QT_TRANSLATE_NOOP3_UTF8_ALIAS,QT_TRID_NOOP+=QT_TRID_NOOP_ALIAS,Q_DECLARE_TR_FUNCTIONS+=Q_DECLARE_TR_FUNCTIONS_ALIAS,qtTrId+=qtTrId_alias,QT_TR_NOOP+=QT_TR_NOOP_ALIAS,QT_TR_NOOP_UTF8+=QT_TR_NOOP_UTF8_ALIAS,tr+=tr_alias,trUtf8+=trUtf8_alias,translate+=translate_alias,qsTr=MySingletonCustomTranslator.subObject.tr -ts project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/main.cpp b/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/main.cpp index 6b92d678f..8bb614c78 100644 --- a/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/main.cpp @@ -1,46 +1,46 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com> -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com> +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + #ifndef MYOBJECT_H #define MYOBJECT_H -#include <QtCore/QObject> - -QT_TRANSLATE_NOOP("scope", "string") -QT_TRANSLATE_NOOP_ALIAS("scope", "string_alias") -QT_TRANSLATE_NOOP_UTF8("scope", "utf8_string") -QT_TRANSLATE_NOOP_UTF8_ALIAS("scope", "utf8_string_alias") -QT_TRANSLATE_NOOP3("scope", "string_with_comment", "comment") -QT_TRANSLATE_NOOP3_ALIAS("scope", "string_with_comment_alias", "comment") -QT_TRANSLATE_NOOP3_UTF8("scope", "utf8_string_with_comment", "comment") -QT_TRANSLATE_NOOP3_UTF8_ALIAS("scope", "utf8_string_with_comment_alias", "comment") -QT_TRID_NOOP("this_a_id") -QT_TRID_NOOP_ALIAS("this_a_id_alias") +#include <QtCore> + +const char *c_1 = QT_TRANSLATE_NOOP("scope", "string"); +const char *c_2 = QT_TRANSLATE_NOOP_ALIAS("scope", "string_alias"); +const char *c_3 = QT_TRANSLATE_NOOP_UTF8("scope", "utf8_string"); +const char *c_4 = QT_TRANSLATE_NOOP_UTF8_ALIAS("scope", "utf8_string_alias"); +const char *c_5[2] = QT_TRANSLATE_NOOP3("scope", "string_with_comment", "comment"); +const char *c_6[2] = QT_TRANSLATE_NOOP3_ALIAS("scope", "string_with_comment_alias", "comment"); +const char *c_7[2] = QT_TRANSLATE_NOOP3_UTF8("scope", "utf8_string_with_comment", "comment"); +const char *c_8[2] = QT_TRANSLATE_NOOP3_UTF8_ALIAS("scope", "utf8_string_with_comment_alias", "comment"); +const char *c_9 = QT_TRID_NOOP("this_a_id"); +const char *c_10 = QT_TRID_NOOP_ALIAS("this_a_id_alias"); QString test = qtTrId("yet_another_id"); QString test_alias = qtTrId_alias("yet_another_id_alias"); @@ -53,7 +53,7 @@ class Bogus : QObject { const char * const Bogus::s_strings[] = { QT_TR_NOOP("this should be in Bogus"), QT_TR_NOOP_ALIAS("this should be in Bogus Alias"), - QT_TR_NOOP_UTF8("this should be utf8 in Bogus") + QT_TR_NOOP_UTF8("this should be utf8 in Bogus"), QT_TR_NOOP_UTF8_ALIAS("this should be utf8 in Bogus Alias") }; @@ -64,10 +64,10 @@ class MyObject : public QObject { tr("Boo", "nsF::D"); tr_alias("Boo_alias", "nsB::C"); - trUtf8("utf8_Boo", "nsF::D"); + tr("utf8_Boo", "nsF::D"); // trUtf8 is now obsolete trUtf8_alias("utf8_Boo_alias", "nsF::D"); - translate("QTranslator", "Simple"); - translate_alias("QTranslator", "Simple with comment alias", "with comment") + QCoreApplication::translate("QTranslator", "Simple"); + translate_alias("QTranslator", "Simple with comment alias", "with comment"); } }; @@ -79,10 +79,10 @@ struct NonQObject { tr("NonQObject_Boo", "nsF::NonQObject_D"); tr_alias("NonQObject_Boo_alias", "nsB::NonQObject_C"); - trUtf8("utf_NonQObject_Boo", "nsF::D"); + tr("utf_NonQObject_Boo", "nsF::D"); trUtf8_alias("utf8_NonQObject_Boo_alias", "nsF::D"); - translate("NonQObject_QTranslator", "Simple"); - translate_alias("NonQObject_QTranslator", "Simple with comment alias", "with comment") + QCoreApplication::translate("NonQObject_QTranslator", "Simple"); + translate_alias("NonQObject_QTranslator", "Simple with comment alias", "with comment"); } }; diff --git a/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/project.pro b/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/project.pro new file mode 100644 index 000000000..d624cadac --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/project.pro @@ -0,0 +1,4 @@ +SOURCES += main.cpp +SOURCES += main.qml + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/main.cpp b/tests/auto/linguist/lupdate/testdata/recursivescan/main.cpp index 79932bcb1..74742e54b 100644 --- a/tests/auto/linguist/lupdate/testdata/recursivescan/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/main.cpp @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + #include <QApplication> #include <QDebug> diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui b/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui index 5a26d6ed2..6e5775c86 100644 --- a/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui @@ -1,33 +1,8 @@ <ui version="4.0" > <author></author> <comment> -********************************************************************* -** -** 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$ -** -********************************************************************* +* Copyright (C) 2016 The Qt Company Ltd. +* SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only </comment> <exportmacro></exportmacro> <class>FindDialog</class> diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.c++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.c++ index e1d5232c6..9527549ac 100644 --- a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.c++ +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.c++ @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Linguist 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + #include <QApplication> diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cpp b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cpp index a0d5e374f..9ae45aa16 100644 --- a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cpp @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + #include <QApplication> diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cxx b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cxx index d1b99e763..70aa43197 100644 --- a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cxx +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cxx @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Linguist 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + #include <QApplication> diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp index 6f8c35eba..69d719493 100644 --- a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + #include "finddialog.h" #include "mainwindow.h" diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir1/main.cpp b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir1/main.cpp index b06785a80..3a3fc177f 100644 --- a/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir1/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir1/main.cpp @@ -1,33 +1,33 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + +#include <QtCore> + QString foo() { - QCoreApplication::translate("subdir1","minimal test"); + return QCoreApplication::translate("subdir1","minimal test"); } diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub1/main.cpp b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub1/main.cpp index 766d615cb..c57ada17f 100644 --- a/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub1/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub1/main.cpp @@ -1,33 +1,33 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + +#include <QtCore> + QString foo() { - QCoreApplication::translate("subsub1","minimal test"); + return QCoreApplication::translate("subsub1","minimal test"); } diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub2/main.cpp b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub2/main.cpp index 5617fd1ce..bd0acde61 100644 --- a/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub2/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub2/main.cpp @@ -1,33 +1,33 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + +#include <QtCore> + QString foo() { - QCoreApplication::translate("subsub2","minimal test"); + return QCoreApplication::translate("subsub2","minimal test"); } diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir1/main.cpp b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir1/main.cpp index b06785a80..3a3fc177f 100644 --- a/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir1/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir1/main.cpp @@ -1,33 +1,33 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + +#include <QtCore> + QString foo() { - QCoreApplication::translate("subdir1","minimal test"); + return QCoreApplication::translate("subdir1","minimal test"); } diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub1/main.cpp b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub1/main.cpp index 766d615cb..c57ada17f 100644 --- a/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub1/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub1/main.cpp @@ -1,33 +1,33 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + +#include <QtCore> + QString foo() { - QCoreApplication::translate("subsub1","minimal test"); + return QCoreApplication::translate("subsub1","minimal test"); } diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub2/main.cpp b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub2/main.cpp index 5617fd1ce..bd0acde61 100644 --- a/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub2/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub2/main.cpp @@ -1,33 +1,33 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + +#include <QtCore> + QString foo() { - QCoreApplication::translate("subsub2","minimal test"); + return QCoreApplication::translate("subsub2","minimal test"); } diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index 41457969f..e850a63dc 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -1,41 +1,23 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #if CHECK_SIMTEXTH #include "../shared/simtexth.h" #endif -#include <QtCore/QDir> +#include <QtCore/QByteArray> #include <QtCore/QDebug> +#include <QtCore/QDir> #include <QtCore/QFile> -#include <QtCore/QByteArray> +#include <QtCore/private/qconfig_p.h> +#include <QtCore/QSet> #include <QtTest/QtTest> +#include <QtTools/private/qttools-config_p.h> + +#include <iostream> + +using namespace Qt::Literals::StringLiterals; class tst_lupdate : public QObject { @@ -62,7 +44,7 @@ private: tst_lupdate::tst_lupdate() { - QString binPath = QLibraryInfo::location(QLibraryInfo::BinariesPath); + QString binPath = QLibraryInfo::path(QLibraryInfo::BinariesPath); m_cmdLupdate = binPath + QLatin1String("/lupdate"); m_basePath = QFINDTESTDATA("testdata/"); } @@ -200,8 +182,9 @@ void tst_lupdate::doCompare(QStringList actual, const QString &expectedFn, bool diff += ">>>>>>> expected\n"; for (int j = oam; j < qMin(oam + 3, actual.size()); j++) diff += actual.at(j) + '\n'; - QFAIL(qPrintable((err ? "Output for " : "Result for ") + expectedFn + " does not meet expectations:\n" + diff)); -} + QFAIL(qPrintable((err ? "Output for " : "Result for ") + + expectedFn + " does not meet expectations:\n" + diff)); + } void tst_lupdate::doCompare(const QString &actualFn, const QString &expectedFn, bool err) { @@ -215,6 +198,7 @@ void tst_lupdate::doCompare(const QString &actualFn, const QString &expectedFn, void tst_lupdate::good_data() { QTest::addColumn<QString>("directory"); + QTest::addColumn<bool>("useClangCpp"); QDir parsingDir(m_basePath + "good"); QStringList dirs = parsingDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name); @@ -225,19 +209,48 @@ void tst_lupdate::good_data() #ifndef Q_OS_MACOS dirs.removeAll(QLatin1String("parseobjc")); #endif + QSet<QString> ignoredTests = { + "lacksqobject_clang_parser", "parsecontexts_clang_parser", "parsecpp2_clang_parser", + "parsecpp_clang_parser", "prefix_clang_parser", "preprocess_clang_parser", + "parsecpp_clang_only"}; + + // Add test rows for the "classic" lupdate + for (const QString &dir : dirs) { + if (ignoredTests.contains(dir)) + continue; + QTest::newRow(dir.toLocal8Bit()) << dir << false; + } - for (const QString &dir : qAsConst(dirs)) - QTest::newRow(dir.toLocal8Bit()) << dir; +#if QT_CONFIG(clangcpp) && QT_CONFIG(widgets) + // Add test rows for the clang-based lupdate + ignoredTests = { + "lacksqobject", + "parsecontexts", + "parsecpp", + "parsecpp2", + "parseqrc_json", + "prefix", + "preprocess", + "proparsing2", // llvm8 cannot handle file name without extension + "respfile", //@lst not supported with the new parser yet (include not properly set in the compile_command.json) + "cmdline_deeppath", //no project file, new parser does not support (yet) this way of launching lupdate + "cmdline_order", // no project, new parser do not pickup on macro defined but not used. Test not needed for new parser. + "cmdline_recurse", // recursive scan without project file not supported (yet) with the new parser + }; + for (const QString &dir : dirs) { + if (ignoredTests.contains(dir)) + continue; + QTest::newRow("clang-" + dir.toLocal8Bit()) << dir << true; + } +#endif } void tst_lupdate::good() { QFETCH(QString, directory); + QFETCH(bool, useClangCpp); QString dir = m_basePath + "good/" + directory; - - qDebug() << "Checking..."; - QString workDir = dir; QStringList generatedtsfiles(QLatin1String("project.ts")); QStringList lupdateArguments; @@ -268,7 +281,7 @@ void tst_lupdate::good() file.close(); } - for (const QString &ts : qAsConst(generatedtsfiles)) { + for (const QString &ts : std::as_const(generatedtsfiles)) { QString genTs = workDir + QLatin1Char('/') + ts; QFile::remove(genTs); QString beforetsfile = dir + QLatin1Char('/') + ts + QLatin1String(".before"); @@ -280,9 +293,18 @@ void tst_lupdate::good() QVERIFY(file.open(QIODevice::WriteOnly)); file.close(); - if (lupdateArguments.isEmpty()) - lupdateArguments.append(QLatin1String("project.pro")); + if (lupdateArguments.isEmpty()) { + // Automatically pass "project.pro" or "-project project.json". + if (QFile::exists(dir + u"/project.json"_s)) { + lupdateArguments << u"-project"_s << u"project.json"_s; + } else { + lupdateArguments.append(QLatin1String("project.pro")); + } + } + lupdateArguments.prepend("-silent"); + if (useClangCpp) + lupdateArguments.append("-clang-parser"); QProcess proc; proc.setWorkingDirectory(workDir); @@ -290,7 +312,7 @@ void tst_lupdate::good() const QString command = m_cmdLupdate + ' ' + lupdateArguments.join(' '); proc.start(m_cmdLupdate, lupdateArguments, QIODevice::ReadWrite | QIODevice::Text); QVERIFY2(proc.waitForStarted(), qPrintable(command + QLatin1String(" :") + proc.errorString())); - QVERIFY2(proc.waitForFinished(30000), qPrintable(command)); + QVERIFY2(proc.waitForFinished(60000), qPrintable(command)); const QString output = QString::fromLocal8Bit(proc.readAll()); QVERIFY2(proc.exitStatus() == QProcess::NormalExit, qPrintable(QLatin1Char('"') + command + "\" crashed\n" + output)); @@ -308,9 +330,15 @@ void tst_lupdate::good() return; } - for (const QString &ts : qAsConst(generatedtsfiles)) + for (const QString &ts : std::as_const(generatedtsfiles)) { + if (dir.endsWith("preprocess_clang_parser")) { + doCompare(workDir + QLatin1Char('/') + ts, + dir + QLatin1Char('/') + ts + QLatin1String(".result"), true); + } else { doCompare(workDir + QLatin1Char('/') + ts, dir + QLatin1Char('/') + ts + QLatin1String(".result"), false); + } + } } #if CHECK_SIMTEXTH |