From 81dbf09d988d87f82496ba106b5f1dd2aad7967d Mon Sep 17 00:00:00 2001 From: Olivier Tilloy Date: Fri, 5 Oct 2012 11:59:50 +0200 Subject: Port to Qt5. To compile and test, one needs to install the qt5-meta-minimal package from the Canonical Qt5 Edgers PPA (https://launchpad.net/~canonical-qt5-edgers/+archive/qt5-beta1). This installs Qt5 in /opt/qt5/. cmake needs to be invoked with CMAKE_PREFIX_PATH=/opt/qt5/lib/cmake, and /opt/qt5/bin needs to be added to $PATH. --- tests/client/CMakeLists.txt | 7 +++++-- tests/client/actiongrouptest.cpp | 5 +++++ tests/client/menuchangestest.cpp | 5 +++++ tests/client/modeltest.cpp | 5 +++++ tests/client/servicetest.cpp | 5 +++++ tests/script/CMakeLists.txt | 4 +++- 6 files changed, 28 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/client/CMakeLists.txt b/tests/client/CMakeLists.txt index 2c48a07..e9de735 100644 --- a/tests/client/CMakeLists.txt +++ b/tests/client/CMakeLists.txt @@ -1,8 +1,9 @@ macro(declare_test testname) set(TEST_MOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${testname}.moc) - qt4_generate_moc(${testname}.cpp ${TEST_MOC_FILE}) + qt5_generate_moc(${testname}.cpp ${TEST_MOC_FILE}) add_executable(${testname} ${testname}.cpp ${TEST_MOC_FILE}) + qt5_use_modules(${testname} Core DBus Widgets Test) target_link_libraries(${testname} qmenumodel dbusmenuscript @@ -26,9 +27,10 @@ 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}) + qt5_generate_moc(${testname}.cpp ${TEST_MOC_FILE}) add_executable(${testname} ${testname}.cpp ${TEST_MOC_FILE}) + qt5_use_modules(${testname} Core Test) target_link_libraries(${testname} qmenumodel ${QT_QTTEST_LIBRARY} @@ -67,3 +69,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 */ +extern "C" { +#include +} + #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 */ +extern "C" { +#include +} + #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 */ +extern "C" { +#include +} + #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 */ +extern "C" { +#include +} + #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..bf415f5 100644 --- a/tests/script/CMakeLists.txt +++ b/tests/script/CMakeLists.txt @@ -8,7 +8,7 @@ set(DBUSMENUSCRIPT_HEADERS dbusmenuscript.h ) -qt4_wrap_cpp(DBUSMENUSCRIPT_MOC +qt5_wrap_cpp(DBUSMENUSCRIPT_MOC ${DBUSMENUSCRIPT_HEADERS} ) @@ -27,6 +27,8 @@ include_directories( ${QT_QTDBUS_INCLUDE_DIR} ) +qt5_use_modules(dbusmenuscript Core DBus Test) + target_link_libraries(dbusmenuscript ${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} -- cgit v1.2.3