From 0814d74548cda4e2e10183ed84ed8d0c4ff058fb Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Tue, 27 Nov 2018 13:06:21 +0100 Subject: Autogen: Add QtAutogen.UicNoGui test Adds a Qt core only test that has ``AUTOUIC`` enabled targets that don't link against QtXWidgets or Qt at all. --- Tests/QtAutogen/Tests.cmake | 1 + Tests/QtAutogen/UicNoGui/CMakeLists.txt | 16 ++++++++++++++++ Tests/QtAutogen/UicNoGui/MocOnly/CMakeLists.txt | 3 +++ Tests/QtAutogen/UicNoGui/MocOnly/main.cpp | 15 +++++++++++++++ Tests/QtAutogen/UicNoGui/NoQt/CMakeLists.txt | 2 ++ Tests/QtAutogen/UicNoGui/NoQt/main.cpp | 4 ++++ Tests/QtAutogen/UicNoGui/main.cpp | 9 +++++++++ 7 files changed, 50 insertions(+) create mode 100644 Tests/QtAutogen/UicNoGui/CMakeLists.txt create mode 100644 Tests/QtAutogen/UicNoGui/MocOnly/CMakeLists.txt create mode 100644 Tests/QtAutogen/UicNoGui/MocOnly/main.cpp create mode 100644 Tests/QtAutogen/UicNoGui/NoQt/CMakeLists.txt create mode 100644 Tests/QtAutogen/UicNoGui/NoQt/main.cpp create mode 100644 Tests/QtAutogen/UicNoGui/main.cpp diff --git a/Tests/QtAutogen/Tests.cmake b/Tests/QtAutogen/Tests.cmake index 5025d43..096d5e3 100644 --- a/Tests/QtAutogen/Tests.cmake +++ b/Tests/QtAutogen/Tests.cmake @@ -25,6 +25,7 @@ ADD_AUTOGEN_TEST(SameName sameName) ADD_AUTOGEN_TEST(StaticLibraryCycle slc) ADD_AUTOGEN_TEST(UicInclude uicInclude) ADD_AUTOGEN_TEST(UicInterface QtAutoUicInterface) +ADD_AUTOGEN_TEST(UicNoGui uicNoGui) ADD_AUTOGEN_TEST(UicOnly uicOnly) ADD_AUTOGEN_TEST(UicSkipSource) diff --git a/Tests/QtAutogen/UicNoGui/CMakeLists.txt b/Tests/QtAutogen/UicNoGui/CMakeLists.txt new file mode 100644 index 0000000..076299d --- /dev/null +++ b/Tests/QtAutogen/UicNoGui/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.13) +project(UicNoGui) +include("../AutogenCoreTest.cmake") + +# This tests creates a target that has AUTOUIC enabled but does not +# link against QtXWidgets. + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +add_subdirectory(MocOnly) +add_subdirectory(NoQt) + +add_executable(uicNoGui main.cpp) +target_link_libraries(uicNoGui mocOnly noQt) diff --git a/Tests/QtAutogen/UicNoGui/MocOnly/CMakeLists.txt b/Tests/QtAutogen/UicNoGui/MocOnly/CMakeLists.txt new file mode 100644 index 0000000..4fcd75f --- /dev/null +++ b/Tests/QtAutogen/UicNoGui/MocOnly/CMakeLists.txt @@ -0,0 +1,3 @@ +# Library uses QtCore only (no Widgets) +add_library(mocOnly main.cpp) +target_link_libraries(mocOnly ${QT_QTCORE_TARGET}) diff --git a/Tests/QtAutogen/UicNoGui/MocOnly/main.cpp b/Tests/QtAutogen/UicNoGui/MocOnly/main.cpp new file mode 100644 index 0000000..3091845 --- /dev/null +++ b/Tests/QtAutogen/UicNoGui/MocOnly/main.cpp @@ -0,0 +1,15 @@ +#include + +class LocalObject : public QObject +{ + Q_OBJECT +public: + LocalObject(){}; +}; + +void mocOnly() +{ + LocalObject obj; +} + +#include "main.moc" diff --git a/Tests/QtAutogen/UicNoGui/NoQt/CMakeLists.txt b/Tests/QtAutogen/UicNoGui/NoQt/CMakeLists.txt new file mode 100644 index 0000000..f2bf3ee --- /dev/null +++ b/Tests/QtAutogen/UicNoGui/NoQt/CMakeLists.txt @@ -0,0 +1,2 @@ +# Library doesn't use or link against Qt at all +add_library(noQt main.cpp) diff --git a/Tests/QtAutogen/UicNoGui/NoQt/main.cpp b/Tests/QtAutogen/UicNoGui/NoQt/main.cpp new file mode 100644 index 0000000..0052cc8 --- /dev/null +++ b/Tests/QtAutogen/UicNoGui/NoQt/main.cpp @@ -0,0 +1,4 @@ + +void noQt() +{ +} diff --git a/Tests/QtAutogen/UicNoGui/main.cpp b/Tests/QtAutogen/UicNoGui/main.cpp new file mode 100644 index 0000000..e90c60a --- /dev/null +++ b/Tests/QtAutogen/UicNoGui/main.cpp @@ -0,0 +1,9 @@ +extern void mocOnly(); +extern void noQt(); + +int main(int argc, char* argv[]) +{ + mocOnly(); + noQt(); + return 0; +} -- cgit v0.12