diff options
Diffstat (limited to 'tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only')
14 files changed, 362 insertions, 177 deletions
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 index a1f551fda..4ce39f634 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/expectedoutput.txt +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/expectedoutput.txt @@ -2,4 +2,4 @@ .*[/\\]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:83:0: TRANSLATOR cannot be called without comment. The call is ignored. +.*[/\\]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/my_include.h b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/my_include.h index 53fc989e3..bd6cc0ca0 100644 --- 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 @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + #include <QtCore> class Foo diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.pro index 86959e1a9..e9e5188d9 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.pro @@ -3,5 +3,7 @@ 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 index 826662dd5..47bd60e6b 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp_clang_only/project.ts.result @@ -2,6 +2,14 @@ <!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"/> @@ -55,9 +63,18 @@ </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="58"/> + <location filename="test_isolatedComments.cpp" line="59"/> <source></source> <comment>blabla</comment> <translation type="unfinished"></translation> @@ -66,7 +83,7 @@ <context> <name>GluedNumber2</name> <message> - <location filename="test_isolatedComments.cpp" line="59"/> + <location filename="test_isolatedComments.cpp" line="60"/> <source></source> <comment>blabla</comment> <translation type="unfinished"></translation> @@ -75,7 +92,7 @@ <context> <name>GluedNumber3</name> <message> - <location filename="test_isolatedComments.cpp" line="60"/> + <location filename="test_isolatedComments.cpp" line="61"/> <source></source> <comment>blabla</comment> <translation type="unfinished"></translation> @@ -84,7 +101,7 @@ <context> <name>GluedNumber4</name> <message> - <location filename="test_isolatedComments.cpp" line="61"/> + <location filename="test_isolatedComments.cpp" line="62"/> <source></source> <comment>// whatever we have here</comment> <translation type="unfinished"></translation> @@ -93,7 +110,7 @@ <context> <name>GluedNumber5</name> <message> - <location filename="test_isolatedComments.cpp" line="68"/> + <location filename="test_isolatedComments.cpp" line="69"/> <source></source> <comment>// whatever2 we2 have2 here2</comment> <translation type="unfinished"></translation> @@ -102,7 +119,7 @@ <context> <name>GluedOnSameLineOne</name> <message> - <location filename="test_isolatedComments.cpp" line="75"/> + <location filename="test_isolatedComments.cpp" line="76"/> <source></source> <comment>blabla</comment> <translation type="unfinished"></translation> @@ -111,7 +128,7 @@ <context> <name>GluedOnSameLineTwo</name> <message> - <location filename="test_isolatedComments.cpp" line="75"/> + <location filename="test_isolatedComments.cpp" line="76"/> <source></source> <comment>blabla</comment> <translation type="unfinished"></translation> @@ -135,7 +152,7 @@ <context> <name>MULTIPLELINE</name> <message> - <location filename="test_isolatedComments.cpp" line="30"/> + <location filename="test_isolatedComments.cpp" line="32"/> <source></source> <comment>first line second line</comment> <translation type="unfinished"></translation> @@ -144,13 +161,13 @@ <context> <name>MultipleAppearance</name> <message> - <location filename="test_isolatedComments.cpp" line="54"/> + <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="56"/> + <location filename="test_isolatedComments.cpp" line="57"/> <source></source> <comment>second appearance</comment> <translation type="unfinished"></translation> @@ -159,7 +176,7 @@ <context> <name>MultipleLineFourthTry</name> <message> - <location filename="test_isolatedComments.cpp" line="47"/> + <location filename="test_isolatedComments.cpp" line="48"/> <source></source> <comment>first line second line</comment> <translation type="unfinished"></translation> @@ -168,7 +185,7 @@ <context> <name>MultipleLineSecondTry</name> <message> - <location filename="test_isolatedComments.cpp" line="35"/> + <location filename="test_isolatedComments.cpp" line="36"/> <source></source> <comment>first line second line</comment> <translation type="unfinished"></translation> @@ -177,7 +194,7 @@ <context> <name>MultipleLineThirdTry</name> <message> - <location filename="test_isolatedComments.cpp" line="41"/> + <location filename="test_isolatedComments.cpp" line="42"/> <source></source> <comment>first line second line</comment> <translation type="unfinished"></translation> @@ -201,6 +218,19 @@ </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"/> @@ -216,6 +246,15 @@ </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"/> 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 index ea48000ac..0eca1e66a 100644 --- 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 @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + #include <QtCore> #include "my_include.h" 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 index 8df5893ed..7d30a38ce 100644 --- 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 @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + #include <QtCore> #include "my_include.h" 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 index eb42f18c7..3af8c48e5 100644 --- 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 @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + #ifndef MYOBJECT_H #define MYOBJECT_H 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 index 362b6095d..6677145d3 100644 --- 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 @@ -1,37 +1,38 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// 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 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 index b5bf55f47..6f0ddefab 100644 --- 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 @@ -1,30 +1,30 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + #include <QtCore/QtCore> |