summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-12-12 18:28:26 +0100
committerLiang Qi <liang.qi@qt.io>2016-12-12 18:28:26 +0100
commiteecd6b2baca331c33a948d9a81f93dd1b47ff14d (patch)
tree024ac0e7dba08dc8ef26d62824a7a4c431a5c850 /tests
parent7561e9b64aeb649ffb3d091b1bf615efff56c730 (diff)
parent4ae6d1db64d29bb3bba07c64dc51606a2c974691 (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/linguist/lconvert/tst_lconvert.cpp14
-rw-r--r--tests/auto/linguist/lrelease/tst_lrelease.cpp14
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parseqrc/main.cpp42
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parseqrc/main.js1
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parseqrc/main.qml40
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parseqrc/project.pro7
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parseqrc/project.qrc5
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parseqrc/project.ts.result25
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/resources_cmdline/lupdatecmd1
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/resources_cmdline/main.js1
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/resources_cmdline/main.qml40
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/resources_cmdline/project.qrc6
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/resources_cmdline/project.ts.result17
-rw-r--r--tests/auto/linguist/lupdate/tst_lupdate.cpp2
-rw-r--r--tests/auto/qtattributionsscanner/testdata/good/complete/qt_attribution.json1
-rw-r--r--tests/auto/qtattributionsscanner/testdata/good/expected.json6
-rw-r--r--tests/auto/qtattributionsscanner/testdata/warnings/incomplete/expected.json2
-rw-r--r--tests/auto/qtattributionsscanner/testdata/warnings/unknown/expected.json2
18 files changed, 212 insertions, 14 deletions
diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp
index fad27ab04..bf4ca9510 100644
--- a/tests/auto/linguist/lconvert/tst_lconvert.cpp
+++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp
@@ -34,7 +34,9 @@ class tst_lconvert : public QObject
Q_OBJECT
public:
- tst_lconvert() : dataDir(QFINDTESTDATA("data/")), binDir(QLibraryInfo::location(QLibraryInfo::BinariesPath)) {}
+ tst_lconvert()
+ : dataDir(QFINDTESTDATA("data/"))
+ , lconvert(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/lconvert") {}
private slots:
void initTestCase();
@@ -61,7 +63,7 @@ private:
const QList<QStringList> &args);
QString dataDir;
- QString binDir;
+ QString lconvert;
};
void tst_lconvert::initTestCase()
@@ -140,7 +142,7 @@ void tst_lconvert::doCompare(QIODevice *actualDev, const QString &expectedFn)
void tst_lconvert::verifyReadFail(const QString &fn)
{
QProcess cvt;
- cvt.start(binDir + "/lconvert", QStringList() << (dataDir + fn));
+ cvt.start(lconvert, QStringList() << (dataDir + fn));
QVERIFY(cvt.waitForFinished(10000));
QVERIFY(cvt.exitStatus() == QProcess::NormalExit);
QVERIFY2(cvt.exitCode() == 2, "Accepted invalid input");
@@ -167,7 +169,7 @@ void tst_lconvert::convertChain(const QString &_inFileName, const QString &_outF
if (!argList.isEmpty())
args += argList[i];
args << "-if" << stations[i] << "-i" << "-" << "-of" << stations[i + 1];
- cvts.at(i)->start(binDir + "/lconvert", args, QIODevice::ReadWrite | QIODevice::Text);
+ cvts.at(i)->start(lconvert, args, QIODevice::ReadWrite | QIODevice::Text);
}
int st = 0;
foreach (QProcess *cvt, cvts)
@@ -233,7 +235,7 @@ void tst_lconvert::converts()
QString outFileNameFq = dataDir + outFileName;
QProcess cvt;
- cvt.start(binDir + "/lconvert",
+ cvt.start(lconvert,
QStringList() << "-i" << (dataDir + inFileName) << "-of" << format,
QIODevice::ReadWrite | QIODevice::Text);
doWait(&cvt, 0);
@@ -328,7 +330,7 @@ void tst_lconvert::merge()
QProcess cvt;
QStringList args;
args << (dataDir + "idxmerge.ts") << (dataDir + "idxmerge-add.ts");
- cvt.start(binDir + "/lconvert", args, QIODevice::ReadWrite | QIODevice::Text);
+ cvt.start(lconvert, args, QIODevice::ReadWrite | QIODevice::Text);
doWait(&cvt, 1);
if (!QTest::currentTestFailed())
doCompare(&cvt, dataDir + "idxmerge.ts.out");
diff --git a/tests/auto/linguist/lrelease/tst_lrelease.cpp b/tests/auto/linguist/lrelease/tst_lrelease.cpp
index 2da0435d3..19ed47f52 100644
--- a/tests/auto/linguist/lrelease/tst_lrelease.cpp
+++ b/tests/auto/linguist/lrelease/tst_lrelease.cpp
@@ -39,7 +39,7 @@ class tst_lrelease : public QObject
public:
tst_lrelease()
- : binDir(QLibraryInfo::location(QLibraryInfo::BinariesPath))
+ : lrelease(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/lrelease")
, dataDir(QFINDTESTDATA("testdata/"))
{}
@@ -55,7 +55,7 @@ private slots:
private:
void doCompare(const QStringList &actual, const QString &expectedFn);
- QString binDir;
+ QString lrelease;
QString dataDir;
};
@@ -109,7 +109,7 @@ void tst_lrelease::doCompare(const QStringList &actual, const QString &expectedF
void tst_lrelease::translate()
{
- QVERIFY(!QProcess::execute(binDir + "/lrelease " + dataDir + "translate.ts"));
+ QVERIFY(!QProcess::execute(lrelease, QStringList() << (dataDir + "translate.ts")));
QTranslator translator;
QVERIFY(translator.load(dataDir + "translate.qm"));
@@ -159,7 +159,7 @@ void tst_lrelease::translate()
void tst_lrelease::compressed()
{
- QVERIFY(!QProcess::execute(binDir + "/lrelease -compress " + dataDir + "compressed.ts"));
+ QVERIFY(!QProcess::execute(lrelease, QStringList() << "-compress" << (dataDir + "compressed.ts")));
QTranslator translator;
QVERIFY(translator.load(dataDir + "compressed.qm"));
@@ -176,7 +176,7 @@ void tst_lrelease::compressed()
void tst_lrelease::idbased()
{
- QVERIFY(!QProcess::execute(binDir + "/lrelease -idbased " + dataDir + "idbased.ts"));
+ QVERIFY(!QProcess::execute(lrelease, QStringList() << "-idbased" << (dataDir + "idbased.ts")));
QTranslator translator;
QVERIFY(translator.load(dataDir + "idbased.qm"));
@@ -188,7 +188,7 @@ void tst_lrelease::idbased()
void tst_lrelease::markuntranslated()
{
- QVERIFY(!QProcess::execute(binDir + "/lrelease -markuntranslated # -idbased " + dataDir + "idbased.ts"));
+ QVERIFY(!QProcess::execute(lrelease, QStringList() << "-markuntranslated" << "#" << "-idbased" << (dataDir + "idbased.ts")));
QTranslator translator;
QVERIFY(translator.load(dataDir + "idbased.qm"));
@@ -201,7 +201,7 @@ void tst_lrelease::markuntranslated()
void tst_lrelease::dupes()
{
QProcess proc;
- proc.start(binDir + "/lrelease " + dataDir + "dupes.ts", QIODevice::ReadWrite | QIODevice::Text);
+ proc.start(lrelease, QStringList() << (dataDir + "dupes.ts"), QIODevice::ReadWrite | QIODevice::Text);
QVERIFY(proc.waitForFinished());
QVERIFY(proc.exitStatus() == QProcess::NormalExit);
doCompare(QString(proc.readAllStandardError()).trimmed().split('\n'), dataDir + "dupes.errors");
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));
diff --git a/tests/auto/qtattributionsscanner/testdata/good/complete/qt_attribution.json b/tests/auto/qtattributionsscanner/testdata/good/complete/qt_attribution.json
index eaebdb9ef..f8e7b1c68 100644
--- a/tests/auto/qtattributionsscanner/testdata/good/complete/qt_attribution.json
+++ b/tests/auto/qtattributionsscanner/testdata/good/complete/qt_attribution.json
@@ -2,6 +2,7 @@
"Id": "complete",
"Name": "Complete",
"QDocModule": "qtest",
+ "QtParts": ["examples"],
"License": "License",
"Copyright": "Copyright",
diff --git a/tests/auto/qtattributionsscanner/testdata/good/expected.json b/tests/auto/qtattributionsscanner/testdata/good/expected.json
index ed6d94344..2914dcc4b 100644
--- a/tests/auto/qtattributionsscanner/testdata/good/expected.json
+++ b/tests/auto/qtattributionsscanner/testdata/good/expected.json
@@ -9,7 +9,9 @@
"LicenseId": "xxx",
"Name": "Complete",
"Path": "%{PWD}/complete",
+ "Files": "",
"QDocModule": "qtest",
+ "QtParts": [ "examples" ],
"QtUsage": "Multi\nLine\nUsage",
"Version": "1.0",
"DownloadLocation": "www.qt.io/1.0"
@@ -24,7 +26,11 @@
"LicenseId": "",
"Name": "Minimal",
"Path": "%{PWD}/minimal",
+ "Files": "",
"QDocModule": "qtest",
+ "QtParts": [
+ "libs"
+ ],
"QtUsage": "Usage",
"Version": "",
"DownloadLocation": ""
diff --git a/tests/auto/qtattributionsscanner/testdata/warnings/incomplete/expected.json b/tests/auto/qtattributionsscanner/testdata/warnings/incomplete/expected.json
index 0ee9ba07f..a28547bfe 100644
--- a/tests/auto/qtattributionsscanner/testdata/warnings/incomplete/expected.json
+++ b/tests/auto/qtattributionsscanner/testdata/warnings/incomplete/expected.json
@@ -9,7 +9,9 @@
"LicenseId": "",
"Name": "",
"Path": "%{PWD}",
+ "Files": "",
"QDocModule": "",
+ "QtParts": [ "libs" ],
"QtUsage": "",
"Version": "",
"DownloadLocation": ""
diff --git a/tests/auto/qtattributionsscanner/testdata/warnings/unknown/expected.json b/tests/auto/qtattributionsscanner/testdata/warnings/unknown/expected.json
index 7ce485b82..151af4093 100644
--- a/tests/auto/qtattributionsscanner/testdata/warnings/unknown/expected.json
+++ b/tests/auto/qtattributionsscanner/testdata/warnings/unknown/expected.json
@@ -9,7 +9,9 @@
"LicenseId": "",
"Name": "Unknown",
"Path": "%{PWD}",
+ "Files": "",
"QDocModule": "qtest",
+ "QtParts": [ "libs" ],
"QtUsage": "Usage",
"Version": "",
"DownloadLocation": ""