From e838cf644fe482d0ff04f2a32f081bc4b6e30297 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 5 Dec 2011 02:46:22 +0100 Subject: Test that options to macros work. Change-Id: Id2f57cc2f64ae25f5f84d1206035b7a2c309d1c7 Reviewed-by: Clinton Stimpson Reviewed-by: Stephen Kelly --- tests/manual/cmake/CMakeLists.txt | 2 ++ tests/manual/cmake/fail4/CMakeLists.txt | 18 ++++++++++ tests/manual/cmake/fail4/myobject.cpp | 54 ++++++++++++++++++++++++++++ tests/manual/cmake/fail4/myobject.h | 57 ++++++++++++++++++++++++++++++ tests/manual/cmake/fail4/pass4.qrc | 6 ++++ tests/manual/cmake/fail4/resource_file.txt | 1 + tests/manual/cmake/fail5/CMakeLists.txt | 15 ++++++++ tests/manual/cmake/fail5/myobject.cpp | 54 ++++++++++++++++++++++++++++ tests/manual/cmake/fail5/myobject.h | 57 ++++++++++++++++++++++++++++++ 9 files changed, 264 insertions(+) create mode 100644 tests/manual/cmake/fail4/CMakeLists.txt create mode 100644 tests/manual/cmake/fail4/myobject.cpp create mode 100644 tests/manual/cmake/fail4/myobject.h create mode 100644 tests/manual/cmake/fail4/pass4.qrc create mode 100644 tests/manual/cmake/fail4/resource_file.txt create mode 100644 tests/manual/cmake/fail5/CMakeLists.txt create mode 100644 tests/manual/cmake/fail5/myobject.cpp create mode 100644 tests/manual/cmake/fail5/myobject.h (limited to 'tests/manual') diff --git a/tests/manual/cmake/CMakeLists.txt b/tests/manual/cmake/CMakeLists.txt index b6d5f318fd..1f2bd3e80a 100644 --- a/tests/manual/cmake/CMakeLists.txt +++ b/tests/manual/cmake/CMakeLists.txt @@ -29,3 +29,5 @@ endmacro() # expect_pass(pass1) expect_pass(pass2) expect_pass(pass3) +expect_fail(fail4) +expect_fail(fail5) diff --git a/tests/manual/cmake/fail4/CMakeLists.txt b/tests/manual/cmake/fail4/CMakeLists.txt new file mode 100644 index 0000000000..dcd4b8bd65 --- /dev/null +++ b/tests/manual/cmake/fail4/CMakeLists.txt @@ -0,0 +1,18 @@ + +cmake_minimum_required(VERSION 2.8) + +project(pass4) + +find_package(Qt5Core REQUIRED) + +include_directories(${Qt5Core_INCLUDE_DIRS}) + +qt5_wrap_cpp(moc_files myobject.h) + +# Test options. The -binary option generates a binary to dlopen instead of +# a source file to compile. The compiler will consider it garbage when used +# in the add_executable call. +qt5_add_resources(rcc_files "pass4.qrc" OPTIONS -binary) + +add_executable(myobject myobject.cpp ${moc_files} ${rcc_files}) +target_link_libraries(myobject ${Qt5Core_LIBRARIES}) diff --git a/tests/manual/cmake/fail4/myobject.cpp b/tests/manual/cmake/fail4/myobject.cpp new file mode 100644 index 0000000000..251239cde0 --- /dev/null +++ b/tests/manual/cmake/fail4/myobject.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "myobject.h" + +MyObject::MyObject(QObject *parent) + : QObject(parent) +{ + emit someSignal(); +} + +int main(int argc, char **argv) +{ + MyObject myObject; + return 0; +} diff --git a/tests/manual/cmake/fail4/myobject.h b/tests/manual/cmake/fail4/myobject.h new file mode 100644 index 0000000000..e2e908d32c --- /dev/null +++ b/tests/manual/cmake/fail4/myobject.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include + +class MyObject : public QObject +{ + Q_OBJECT +public: + MyObject(QObject *parent = 0); + +signals: + void someSignal(); +}; + +#endif diff --git a/tests/manual/cmake/fail4/pass4.qrc b/tests/manual/cmake/fail4/pass4.qrc new file mode 100644 index 0000000000..00a17f541f --- /dev/null +++ b/tests/manual/cmake/fail4/pass4.qrc @@ -0,0 +1,6 @@ + + + resource_file.txt + + + diff --git a/tests/manual/cmake/fail4/resource_file.txt b/tests/manual/cmake/fail4/resource_file.txt new file mode 100644 index 0000000000..2c604a4f18 --- /dev/null +++ b/tests/manual/cmake/fail4/resource_file.txt @@ -0,0 +1 @@ +Ken sent me. diff --git a/tests/manual/cmake/fail5/CMakeLists.txt b/tests/manual/cmake/fail5/CMakeLists.txt new file mode 100644 index 0000000000..f82a62b626 --- /dev/null +++ b/tests/manual/cmake/fail5/CMakeLists.txt @@ -0,0 +1,15 @@ + +cmake_minimum_required(VERSION 2.8) + +project(pass5) + +find_package(Qt5Core REQUIRED) + +include_directories(${Qt5Core_INCLUDE_DIRS}) + +# Test options. The -i option removes the include "myobject.h" from the moc file +# causing a compile failure. -> Options work +qt5_wrap_cpp(moc_files myobject.h OPTIONS -i) + +add_executable(myobject myobject.cpp ${moc_files}) +target_link_libraries(myobject ${Qt5Core_LIBRARIES}) diff --git a/tests/manual/cmake/fail5/myobject.cpp b/tests/manual/cmake/fail5/myobject.cpp new file mode 100644 index 0000000000..251239cde0 --- /dev/null +++ b/tests/manual/cmake/fail5/myobject.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "myobject.h" + +MyObject::MyObject(QObject *parent) + : QObject(parent) +{ + emit someSignal(); +} + +int main(int argc, char **argv) +{ + MyObject myObject; + return 0; +} diff --git a/tests/manual/cmake/fail5/myobject.h b/tests/manual/cmake/fail5/myobject.h new file mode 100644 index 0000000000..e2e908d32c --- /dev/null +++ b/tests/manual/cmake/fail5/myobject.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include + +class MyObject : public QObject +{ + Q_OBJECT +public: + MyObject(QObject *parent = 0); + +signals: + void someSignal(); +}; + +#endif -- cgit v1.2.3