diff options
Diffstat (limited to 'tests/auto/tools/qmake')
-rw-r--r-- | tests/auto/tools/qmake/qmake.pro | 6 | ||||
-rw-r--r-- | tests/auto/tools/qmake/testdata/resources/main.cpp | 42 | ||||
-rw-r--r-- | tests/auto/tools/qmake/testdata/resources/resources.pro | 10 | ||||
-rw-r--r-- | tests/auto/tools/qmake/testdata/resources/subdir/file.txt | 0 | ||||
-rw-r--r-- | tests/auto/tools/qmake/testdata/resources/test.qrc | 5 | ||||
-rw-r--r-- | tests/auto/tools/qmake/tst_qmake.cpp | 42 |
6 files changed, 105 insertions, 0 deletions
diff --git a/tests/auto/tools/qmake/qmake.pro b/tests/auto/tools/qmake/qmake.pro index 5ed3073e20..d0817247db 100644 --- a/tests/auto/tools/qmake/qmake.pro +++ b/tests/auto/tools/qmake/qmake.pro @@ -8,5 +8,11 @@ SOURCES += tst_qmake.cpp testcompiler.cpp QT = core testlib cross_compile: DEFINES += QMAKE_CROSS_COMPILED +debug_and_release { + CONFIG(debug, debug|release): \ + DEFINES += DEBUG_BUILD + else: \ + DEFINES += RELEASE_BUILD +} TESTDATA += testdata/* diff --git a/tests/auto/tools/qmake/testdata/resources/main.cpp b/tests/auto/tools/qmake/testdata/resources/main.cpp new file mode 100644 index 0000000000..78f9814396 --- /dev/null +++ b/tests/auto/tools/qmake/testdata/resources/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$ +** +****************************************************************************/ + + + +#include <qguiapplication.h> + +int main( int argc, char **argv ) +{ + QGuiApplication a( argc, argv ); + return a.exec(); +} diff --git a/tests/auto/tools/qmake/testdata/resources/resources.pro b/tests/auto/tools/qmake/testdata/resources/resources.pro new file mode 100644 index 0000000000..f024fe5617 --- /dev/null +++ b/tests/auto/tools/qmake/testdata/resources/resources.pro @@ -0,0 +1,10 @@ +TEMPLATE = app +SOURCES = main.cpp + +pro_file.files = resources.pro +pro_file.prefix = /prefix + +subdir.files = subdir/file.txt +subdir.base = subdir + +RESOURCES = test.qrc main.cpp pro_file subdir diff --git a/tests/auto/tools/qmake/testdata/resources/subdir/file.txt b/tests/auto/tools/qmake/testdata/resources/subdir/file.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/auto/tools/qmake/testdata/resources/subdir/file.txt diff --git a/tests/auto/tools/qmake/testdata/resources/test.qrc b/tests/auto/tools/qmake/testdata/resources/test.qrc new file mode 100644 index 0000000000..decde3dd24 --- /dev/null +++ b/tests/auto/tools/qmake/testdata/resources/test.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>test.qrc</file> + </qresource> +</RCC> diff --git a/tests/auto/tools/qmake/tst_qmake.cpp b/tests/auto/tools/qmake/tst_qmake.cpp index da5314c83b..ac94d1a2b9 100644 --- a/tests/auto/tools/qmake/tst_qmake.cpp +++ b/tests/auto/tools/qmake/tst_qmake.cpp @@ -39,6 +39,14 @@ #include <QStandardPaths> #include <QDir> +#if defined(DEBUG_BUILD) +# define DIR_INFIX "debug/" +#elif defined(RELEASE_BUILD) +# define DIR_INFIX "release/" +#else +# define DIR_INFIX "" +#endif + class tst_qmake : public QObject { Q_OBJECT @@ -77,6 +85,7 @@ private slots: void substitutes(); void project(); void proFileCache(); + void resources(); private: TestCompiler test_compiler; @@ -490,5 +499,38 @@ void tst_qmake::proFileCache() QVERIFY( test_compiler.qmake( workDir, "pro_file_cache" )); } +void tst_qmake::resources() +{ + QString workDir = base_path + "/testdata/resources"; + QVERIFY(test_compiler.qmake(workDir, "resources")); + + { + QFile qrcFile(workDir + "/.rcc/" DIR_INFIX "qmake_pro_file.qrc"); + QVERIFY(qrcFile.exists()); + QVERIFY(qrcFile.open(QFile::ReadOnly)); + QByteArray qrcXml = qrcFile.readAll(); + QVERIFY(qrcXml.contains("alias=\"resources.pro\"")); + QVERIFY(qrcXml.contains("prefix=\"/prefix\"")); + } + + { + QFile qrcFile(workDir + "/.rcc/" DIR_INFIX "qmake_subdir.qrc"); + QVERIFY(qrcFile.exists()); + QVERIFY(qrcFile.open(QFile::ReadOnly)); + QByteArray qrcXml = qrcFile.readAll(); + QVERIFY(qrcXml.contains("alias=\"file.txt\"")); + } + + { + QFile qrcFile(workDir + "/.rcc/" DIR_INFIX "qmake_qmake_immediate.qrc"); + QVERIFY(qrcFile.exists()); + QVERIFY(qrcFile.open(QFile::ReadOnly)); + QByteArray qrcXml = qrcFile.readAll(); + QVERIFY(qrcXml.contains("alias=\"main.cpp\"")); + } + + QVERIFY(test_compiler.make(workDir)); +} + QTEST_MAIN(tst_qmake) #include "tst_qmake.moc" |