diff options
Diffstat (limited to 'tests/auto/linguist/lupdate')
12 files changed, 186 insertions, 1 deletions
diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.cpp new file mode 100644 index 000000000..7108f6784 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.cpp @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.js b/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.js new file mode 100644 index 000000000..b2e1dd9e0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.js @@ -0,0 +1 @@ +qsTr("From JavaScript file"); diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.qml b/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.qml new file mode 100644 index 000000000..ea2258343 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.qml @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +QtObject { + function translate() { + qsTr("From QML file in root"); + } +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqrc/project.pro b/tests/auto/linguist/lupdate/testdata/good/parseqrc/project.pro new file mode 100644 index 000000000..5000c7396 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqrc/project.pro @@ -0,0 +1,7 @@ + +SOURCES += main.cpp + +RESOURCES += project.qrc +RESOURCES += main.qml + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqrc/project.qrc b/tests/auto/linguist/lupdate/testdata/good/parseqrc/project.qrc new file mode 100644 index 000000000..87bacf228 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqrc/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/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseqrc/project.ts.result new file mode 100644 index 000000000..6dcd8c2a5 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqrc/project.ts.result @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1"> +<context> + <name>QApplication</name> + <message> + <location filename="main.cpp" line="39"/> + <source>Hello world</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>main</name> + <message> + <location filename="main.js" line="1"/> + <source>From JavaScript file</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="38"/> + <source>From QML file in root</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/lupdatecmd new file mode 100644 index 000000000..f3709944b --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/lupdatecmd @@ -0,0 +1 @@ +lupdate project.qrc -ts project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/main.js b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/main.js new file mode 100644 index 000000000..b2e1dd9e0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/main.js @@ -0,0 +1 @@ +qsTr("From JavaScript file"); diff --git a/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/main.qml b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/main.qml new file mode 100644 index 000000000..ea2258343 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/main.qml @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +QtObject { + function translate() { + qsTr("From QML file in root"); + } +} diff --git a/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/project.qrc b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/project.qrc new file mode 100644 index 000000000..c5bf15067 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/project.qrc @@ -0,0 +1,6 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource prefix="/"> + <file>main.qml</file> + <file>main.js</file> +</qresource> +</RCC> diff --git a/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/project.ts.result new file mode 100644 index 000000000..82719c026 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/project.ts.result @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1"> +<context> + <name>main</name> + <message> + <location filename="main.qml" line="38"/> + <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/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index 71d42dbb3..ea049a1f9 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -283,7 +283,7 @@ void tst_lupdate::good() QProcess proc; proc.setWorkingDirectory(workDir); proc.setProcessChannelMode(QProcess::MergedChannels); - const QString command = m_cmdLupdate + QLatin1Char(' ') + lupdatecmd; + const QString command = QLatin1Char('"') + m_cmdLupdate + QLatin1String("\" ") + lupdatecmd; proc.start(command, QIODevice::ReadWrite | QIODevice::Text); QVERIFY2(proc.waitForStarted(), qPrintable(command + QLatin1String(" :") + proc.errorString())); QVERIFY2(proc.waitForFinished(30000), qPrintable(command)); |