From c61da0049cd93f02637fa9390509d137569b3806 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Wed, 29 Jan 2014 19:28:07 +0200 Subject: [PATCH] Use a console app for Qt5 unit testing so it can be run headless. --- test cases/frameworks/4 qt5/main.cpp | 6 ++---- test cases/frameworks/4 qt5/meson.build | 10 ++++++++-- test cases/frameworks/4 qt5/q5core.cpp | 10 ++++++++++ 3 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 test cases/frameworks/4 qt5/q5core.cpp diff --git a/test cases/frameworks/4 qt5/main.cpp b/test cases/frameworks/4 qt5/main.cpp index 51d83b4e7..41d7d7016 100644 --- a/test cases/frameworks/4 qt5/main.cpp +++ b/test cases/frameworks/4 qt5/main.cpp @@ -10,9 +10,7 @@ int main(int argc, char **argv) { } win->setWindowTitle("Meson Qt5 build test"); - // Don't actually start the GUI so this - // can be run as a unit test. - //win->show(); - //return app.exec(); + win->show(); + return app.exec(); return 0; } diff --git a/test cases/frameworks/4 qt5/meson.build b/test cases/frameworks/4 qt5/meson.build index f9591f049..159f4441d 100644 --- a/test cases/frameworks/4 qt5/meson.build +++ b/test cases/frameworks/4 qt5/meson.build @@ -2,11 +2,17 @@ project('qt5 build test', 'cpp') qt5dep = dependency('qt5', modules : 'Widgets') -q5exe = executable('qt5test', +q5exe = executable('qt5app', sources : ['main.cpp', 'mainWindow.cpp'], # Sources that don't need preprocessing. moc_headers : ['mainWindow.h'], # These need to be fed through the moc tool before use. ui_files : 'mainWindow.ui', # XML files that need to be compiled with the uic tol. resources : 'stuff.qrc', # Resource file for rcc compiler. deps : qt5dep) -test('qt5test', q5exe) +# We need a console test application because some test environments +# do not have an X server. + +q5core = executable('q5core', 'q5core.cpp', +deps : dependency('qt5', modules : 'Core')) + +test('qt5test', q5core) diff --git a/test cases/frameworks/4 qt5/q5core.cpp b/test cases/frameworks/4 qt5/q5core.cpp new file mode 100644 index 000000000..706e4dc87 --- /dev/null +++ b/test cases/frameworks/4 qt5/q5core.cpp @@ -0,0 +1,10 @@ +#include + +int main(int argc, char **argv) { + QCoreApplication app(argc, argv); + + // Don't actually start the main loop so this + // can be run as a unit test. + //return app.exec(); + return 0; +}