aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/client/CMakeLists.txt35
-rw-r--r--tests/client/actiongrouptest.cpp5
-rw-r--r--tests/client/menuchangestest.cpp5
-rw-r--r--tests/client/modeltest.cpp5
-rw-r--r--tests/client/servicetest.cpp5
-rw-r--r--tests/script/CMakeLists.txt30
6 files changed, 32 insertions, 53 deletions
diff --git a/tests/client/CMakeLists.txt b/tests/client/CMakeLists.txt
index 2c48a07..7455b16 100644
--- a/tests/client/CMakeLists.txt
+++ b/tests/client/CMakeLists.txt
@@ -1,17 +1,12 @@
macro(declare_test testname)
- set(TEST_MOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${testname}.moc)
- qt4_generate_moc(${testname}.cpp ${TEST_MOC_FILE})
-
- add_executable(${testname} ${testname}.cpp ${TEST_MOC_FILE})
+ add_executable(${testname} ${testname}.cpp)
+ qt5_use_modules(${testname} Core DBus Widgets Test)
target_link_libraries(${testname}
qmenumodel
dbusmenuscript
- ${QT_QTTEST_LIBRARY}
- ${QT_QTCORE_LIBRARY}
- ${QT_QTGUI_LIBRARY}
- ${QT_QTDBUS_LIBRARY}
${GLIB_LDFLAGS}
- ${GIO_LDFLAGS})
+ ${GIO_LDFLAGS}
+ )
add_test(${testname}
${DBUS_RUNNER}
@@ -25,18 +20,13 @@ macro(declare_test testname)
endmacro(declare_test testname)
macro(declare_simple_test testname)
- set(TEST_MOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${testname}.moc)
- qt4_generate_moc(${testname}.cpp ${TEST_MOC_FILE})
-
- add_executable(${testname} ${testname}.cpp ${TEST_MOC_FILE})
+ add_executable(${testname} ${testname}.cpp)
+ qt5_use_modules(${testname} Core Test)
target_link_libraries(${testname}
qmenumodel
- ${QT_QTTEST_LIBRARY}
- ${QT_QTCORE_LIBRARY}
- ${QT_QTGUI_LIBRARY}
- ${QT_QTDBUS_LIBRARY}
${GLIB_LDFLAGS}
- ${GIO_LDFLAGS})
+ ${GIO_LDFLAGS}
+ )
add_test(${testname}
${CMAKE_CURRENT_BINARY_DIR}/${testname})
@@ -47,14 +37,8 @@ endmacro(declare_simple_test testname)
include_directories(${src_SOURCE_DIR}
${dbusmenuscript_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${QT_INCLUDE_DIR}
- ${QT_QTTEST_INCLUDE_DIR}
- ${QT_QTCORE_INCLUDE_DIR}
- ${QT_QTGUI_INCLUDE_DIR}
- ${QT_QTDBUS_INCLUDE_DIR}
${GLIB_INCLUDE_DIRS}
- ${GIO_INCLUDE_DIRS})
+)
add_definitions(-DTEST_SUITE)
set(TEST_PYTHONPATH ${dbusmenuscript_SOURCE_DIR})
@@ -67,3 +51,4 @@ declare_test(menuchangestest)
declare_test(modeltest)
declare_test(actiongrouptest)
declare_simple_test(convertertest)
+
diff --git a/tests/client/actiongrouptest.cpp b/tests/client/actiongrouptest.cpp
index 116bd44..958ddc7 100644
--- a/tests/client/actiongrouptest.cpp
+++ b/tests/client/actiongrouptest.cpp
@@ -17,6 +17,10 @@
* Renato Araujo Oliveira Filho <renato@canonical.com>
*/
+extern "C" {
+#include <glib-object.h>
+}
+
#include "qdbusmenumodel.h"
#include "qdbusactiongroup.h"
#include "dbusmenuscript.h"
@@ -38,6 +42,7 @@ private:
private Q_SLOTS:
void initTestCase()
{
+ g_type_init();
Q_ASSERT(m_script.connect());
}
diff --git a/tests/client/menuchangestest.cpp b/tests/client/menuchangestest.cpp
index 2015582..bc7dcbd 100644
--- a/tests/client/menuchangestest.cpp
+++ b/tests/client/menuchangestest.cpp
@@ -17,6 +17,10 @@
* Renato Araujo Oliveira Filho <renato@canonical.com>
*/
+extern "C" {
+#include <glib-object.h>
+}
+
#include "qdbusmenumodel.h"
#include "dbusmenuscript.h"
@@ -35,6 +39,7 @@ private:
private Q_SLOTS:
void initTestCase()
{
+ g_type_init();
Q_ASSERT(m_script.connect());
}
diff --git a/tests/client/modeltest.cpp b/tests/client/modeltest.cpp
index 9f6ee76..542b38a 100644
--- a/tests/client/modeltest.cpp
+++ b/tests/client/modeltest.cpp
@@ -17,6 +17,10 @@
* Renato Araujo Oliveira Filho <renato@canonical.com>
*/
+extern "C" {
+#include <glib-object.h>
+}
+
#include "qdbusmenumodel.h"
#include "dbusmenuscript.h"
@@ -35,6 +39,7 @@ private:
private Q_SLOTS:
void initTestCase()
{
+ g_type_init();
Q_ASSERT(m_script.connect());
}
diff --git a/tests/client/servicetest.cpp b/tests/client/servicetest.cpp
index a8b0c2a..d34ba79 100644
--- a/tests/client/servicetest.cpp
+++ b/tests/client/servicetest.cpp
@@ -17,6 +17,10 @@
* Renato Araujo Oliveira Filho <renato@canonical.com>
*/
+extern "C" {
+#include <glib-object.h>
+}
+
#include "qdbusmenumodel.h"
#include "dbusmenuscript.h"
@@ -42,6 +46,7 @@ private:
private Q_SLOTS:
void initTestCase()
{
+ g_type_init();
Q_ASSERT(m_script.connect());
}
diff --git a/tests/script/CMakeLists.txt b/tests/script/CMakeLists.txt
index 11af44e..afa073b 100644
--- a/tests/script/CMakeLists.txt
+++ b/tests/script/CMakeLists.txt
@@ -1,34 +1,8 @@
project(dbusmenuscript)
-set(DBUSMENUSCRIPT_SRC
- dbusmenuscript.cpp
-)
-
-set(DBUSMENUSCRIPT_HEADERS
- dbusmenuscript.h
-)
-
-qt4_wrap_cpp(DBUSMENUSCRIPT_MOC
- ${DBUSMENUSCRIPT_HEADERS}
-)
-
-add_library(dbusmenuscript STATIC
- ${DBUSMENUSCRIPT_SRC}
- ${DBUSMENUSCRIPT_MOC}
-)
+add_library(dbusmenuscript STATIC dbusmenuscript.cpp)
set_target_properties(dbusmenuscript PROPERTIES COMPILE_FLAGS -fPIC)
-include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${QT_INCLUDE_DIR}
- ${QT_QTTEST_INCLUDE_DIR}
- ${QT_QTCORE_INCLUDE_DIR}
- ${QT_QTDBUS_INCLUDE_DIR}
-)
+qt5_use_modules(dbusmenuscript Core DBus Test)
-target_link_libraries(dbusmenuscript
- ${QT_QTCORE_LIBRARY}
- ${QT_QTTEST_LIBRARY}
- ${QT_QTDBUS_LIBRARY}
-)