From 7fab677324b13e254e3938c8fc70c8da181c1066 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 6 Dec 2012 14:38:00 +0100 Subject: Add unit tests for the cmake files. Change-Id: I2e07862e0e13d8a9747691d219185edbe6c86274 Reviewed-by: David Faure (KDE) --- tests/auto/auto.pro | 3 ++- tests/auto/cmake/CMakeLists.txt | 12 ++++++++++++ tests/auto/cmake/cmake.pro | 5 +++++ tests/auto/cmake/test_qx11_module/CMakeLists.txt | 25 ++++++++++++++++++++++++ tests/auto/cmake/test_qx11_module/main.cpp | 12 ++++++++++++ 5 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 tests/auto/cmake/CMakeLists.txt create mode 100644 tests/auto/cmake/cmake.pro create mode 100644 tests/auto/cmake/test_qx11_module/CMakeLists.txt create mode 100644 tests/auto/cmake/test_qx11_module/main.cpp (limited to 'tests') diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 127d6c6..5e02e95 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -1,3 +1,4 @@ TEMPLATE=subdirs SUBDIRS=\ - qx11info + qx11info \ + cmake diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt new file mode 100644 index 0000000..271ab54 --- /dev/null +++ b/tests/auto/cmake/CMakeLists.txt @@ -0,0 +1,12 @@ + +cmake_minimum_required(VERSION 2.8) + +project(qmake_cmake_files) + +enable_testing() + +find_package(Qt5Core REQUIRED) + +include("${_Qt5CTestMacros}") + +expect_pass(test_qx11_module) diff --git a/tests/auto/cmake/cmake.pro b/tests/auto/cmake/cmake.pro new file mode 100644 index 0000000..bf2dbcb --- /dev/null +++ b/tests/auto/cmake/cmake.pro @@ -0,0 +1,5 @@ + +# Cause make to do nothing. +TEMPLATE = subdirs + +CONFIG += ctest_testcase diff --git a/tests/auto/cmake/test_qx11_module/CMakeLists.txt b/tests/auto/cmake/test_qx11_module/CMakeLists.txt new file mode 100644 index 0000000..d6f050e --- /dev/null +++ b/tests/auto/cmake/test_qx11_module/CMakeLists.txt @@ -0,0 +1,25 @@ + +cmake_minimum_required(VERSION 2.8) + +project(test_qx11_module) + +find_package(Qt5Core REQUIRED) +find_package(Qt5Gui REQUIRED) + +find_package(Qt5X11Support REQUIRED) + +include_directories( + ${Qt5X11Support_INCLUDE_DIRS} +) + +add_definitions( + ${Qt5X11Support_DEFINITIONS} +) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}") + +add_executable(mainapp main.cpp) + +target_link_libraries(mainapp + ${Qt5X11Support_LIBRARIES} +) diff --git a/tests/auto/cmake/test_qx11_module/main.cpp b/tests/auto/cmake/test_qx11_module/main.cpp new file mode 100644 index 0000000..932521f --- /dev/null +++ b/tests/auto/cmake/test_qx11_module/main.cpp @@ -0,0 +1,12 @@ + +#include +#include +#include +#include + +int main(int argc, char **argv) +{ + QX11Info::appScreen(); + + return 0; +} -- cgit v1.2.3