Merge lp:~nick-dedekind/libdbusmenu-qt/Qt5-tests into lp:libdbusmenu-qt

Proposed by Nick Dedekind on 2015-03-05
Status: Merged
Approved by: Albert Astals Cid on 2016-02-17
Approved revision: 270
Merged at revision: 270
Proposed branch: lp:~nick-dedekind/libdbusmenu-qt/Qt5-tests
Merge into: lp:libdbusmenu-qt
Diff against target: 234 lines (+97/-32)
5 files modified
CMakeLists.txt (+17/-2)
src/CMakeLists.txt (+13/-3)
tests/CMakeLists.txt (+65/-27)
tests/dbusmenuexportertest.cpp (+1/-0)
tests/slowmenu.cpp (+1/-0)
To merge this branch: bzr merge lp:~nick-dedekind/libdbusmenu-qt/Qt5-tests
Reviewer Review Type Date Requested Status
David Edmundson (community) Approve on 2015-05-05
PS Jenkins bot (community) continuous-integration Approve on 2015-03-05
DBus Menu Team 2015-03-05 Pending
Review via email: mp+251954@code.launchpad.net

Commit message

Ported tests to Qt5.

Description of the change

Ported tests to Qt5.

To post a comment you must log in.
269. By Nick Dedekind on 2015-03-05

fixed spacing

270. By Nick Dedekind on 2015-03-05

moved cflags to root

David Edmundson (david.edmundson) wrote :

Looks good to me

review: Approve
Vsevolod Velichko (torkvemada) wrote :

Is there any life here?

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-06-18 07:41:27 +0000
3+++ CMakeLists.txt 2015-03-05 14:54:53 +0000
4@@ -57,6 +57,23 @@
5 set(QT_SUFFIX "qt")
6 endif()
7
8+include (CheckCXXCompilerFlag)
9+# Check some compiler flags
10+check_cxx_compiler_flag(-fvisibility=hidden __DBUSMENU_HAVE_GCC_VISIBILITY)
11+if (__DBUSMENU_HAVE_GCC_VISIBILITY AND NOT WIN32)
12+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
13+endif (__DBUSMENU_HAVE_GCC_VISIBILITY AND NOT WIN32)
14+
15+check_cxx_compiler_flag(-Woverloaded-virtual __DBUSMENU_HAVE_W_OVERLOADED_VIRTUAL)
16+if (__DBUSMENU_HAVE_W_OVERLOADED_VIRTUAL)
17+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Woverloaded-virtual")
18+endif (__DBUSMENU_HAVE_W_OVERLOADED_VIRTUAL)
19+
20+check_cxx_compiler_flag(-std=c++11 __DBUSMENU_HAVE_CXX11)
21+if (__DBUSMENU_HAVE_CXX11)
22+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
23+endif (__DBUSMENU_HAVE_CXX11)
24+
25 include(CMakePackageConfigHelpers)
26 include(GNUInstallDirs)
27 set(LIB_DESTINATION "${CMAKE_INSTALL_LIBDIR}")
28@@ -90,9 +107,7 @@
29 )
30
31 add_subdirectory(src)
32-if (NOT USE_QT5) # TODO port tests to Qt5
33 add_subdirectory(tests)
34-endif()
35 add_subdirectory(tools)
36
37 if(WITH_DOC)
38
39=== modified file 'src/CMakeLists.txt'
40--- src/CMakeLists.txt 2014-06-19 09:07:07 +0000
41+++ src/CMakeLists.txt 2015-03-05 14:54:53 +0000
42@@ -1,5 +1,9 @@
43 include(CheckCXXSourceCompiles)
44-include (CheckCXXCompilerFlag)
45+
46+check_cxx_compiler_flag(-Wall __DBUSMENU_HAVE_W_ALL)
47+if (__DBUSMENU_HAVE_W_ALL)
48+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
49+endif (__DBUSMENU_HAVE_W_ALL)
50
51 # Check some compiler flags
52 check_cxx_compiler_flag(-fvisibility=hidden __DBUSMENU_HAVE_GCC_VISIBILITY)
53@@ -24,8 +28,14 @@
54
55 # Check whether QIcon::name() exists. It was added in late Qt 4.7 cycle, and is
56 # not present in betas.
57-set(CMAKE_REQUIRED_INCLUDES "${QT_INCLUDE_DIR}")
58-set(CMAKE_REQUIRED_LIBRARIES "${QT_QTGUI_LIBRARIES};${QT_QTCORE_LIBRARIES}")
59+
60+if (NOT USE_QT5)
61+ set(CMAKE_REQUIRED_INCLUDES "${QT_INCLUDE_DIR}")
62+ set(CMAKE_REQUIRED_LIBRARIES "${QT_QTGUI_LIBRARIES};${QT_QTCORE_LIBRARIES}")
63+else()
64+ set(CMAKE_REQUIRED_INCLUDES "${Qt5Gui_INCLUDE_DIRS};${Qt5Core_INCLUDE_DIRS}")
65+ set(CMAKE_REQUIRED_LIBRARIES "${Qt5Gui_LIBRARIES};${Qt5Core_LIBRARIES}")
66+endif()
67 check_cxx_source_compiles("
68 #include <QtGui/QIcon>
69 int main() {
70
71=== modified file 'tests/CMakeLists.txt'
72--- tests/CMakeLists.txt 2010-06-22 15:07:11 +0000
73+++ tests/CMakeLists.txt 2015-03-05 14:54:53 +0000
74@@ -1,12 +1,57 @@
75-qt4_automoc(slowmenu.cpp)
76+if (NOT USE_QT5)
77+ qt4_automoc(slowmenu.cpp)
78+endif()
79 add_executable(slowmenu slowmenu.cpp)
80-target_link_libraries(
81- slowmenu
82- ${QT_QTGUI_LIBRARY}
83- ${QT_QTCORE_LIBRARY}
84- ${QT_QTDBUS_LIBRARY}
85- dbusmenu-qt
86- )
87+
88+if (NOT USE_QT5)
89+ target_link_libraries(slowmenu
90+ ${QT_QTGUI_LIBRARIES}
91+ ${QT_QTDBUS_LIBRARIES}
92+ ${QT_QTCORE_LIBRARIES}
93+ dbusmenu-qt
94+ )
95+
96+ set(test_LIBRARIES
97+ ${QT_QTGUI_LIBRARY}
98+ ${QT_QTCORE_LIBRARY}
99+ ${QT_QTDBUS_LIBRARY}
100+ ${QT_QTTEST_LIBRARY}
101+ dbusmenu-qt
102+ )
103+
104+ include_directories(
105+ ${CMAKE_CURRENT_SOURCE_DIR}/../src
106+ ${CMAKE_CURRENT_BINARY_DIR}/../src
107+ ${CMAKE_CURRENT_BINARY_DIR}
108+ ${QT_QTTEST_INCLUDE_DIR}
109+ ${QT_QTDBUS_INCLUDE_DIR}
110+ )
111+else()
112+ find_package(Qt5Test REQUIRED)
113+
114+ target_link_libraries(slowmenu
115+ ${Qt5Gui_LIBRARIES}
116+ ${Qt5Core_LIBRARIES}
117+ ${Qt5DBus_LIBRARIES}
118+ dbusmenu-qt5
119+ )
120+
121+ set(test_LIBRARIES
122+ ${Qt5Gui_LIBRARIES}
123+ ${Qt5Core_LIBRARIES}
124+ ${Qt5DBus_LIBRARIES}
125+ ${Qt5Test_LIBRARIES}
126+ dbusmenu-qt5
127+ )
128+
129+ include_directories(
130+ ${CMAKE_CURRENT_SOURCE_DIR}/../src
131+ ${CMAKE_CURRENT_BINARY_DIR}/../src
132+ ${CMAKE_CURRENT_BINARY_DIR}
133+ ${Qt5Test_INCLUDE_DIRS}
134+ ${Qt5DBus_INCLUDE_DIRS}
135+ )
136+endif()
137
138 # Macros to create "check" target
139 set(_test_executable_list "")
140@@ -23,31 +68,18 @@
141 DEPENDS ${_test_executable_list})
142 endmacro(create_check_target)
143
144-include_directories(
145- ${CMAKE_CURRENT_SOURCE_DIR}/../src
146- ${CMAKE_CURRENT_BINARY_DIR}/../src
147- ${CMAKE_CURRENT_BINARY_DIR}
148- ${QT_QTTEST_INCLUDE_DIR}
149- ${QT_QTDBUS_INCLUDE_DIR}
150- )
151-
152-set(test_LIBRARIES
153- ${QT_QTGUI_LIBRARY}
154- ${QT_QTCORE_LIBRARY}
155- ${QT_QTDBUS_LIBRARY}
156- ${QT_QTTEST_LIBRARY}
157- dbusmenu-qt
158- )
159-
160 enable_testing()
161
162+
163 # dbusmenuexportertest
164 set(dbusmenuexportertest_SRCS
165 dbusmenuexportertest.cpp
166 testutils.cpp
167 )
168
169-qt4_automoc(${dbusmenuexportertest_SRCS})
170+if (NOT USE_QT5)
171+ qt4_automoc(${dbusmenuexportertest_SRCS})
172+endif()
173
174 add_test_executable(dbusmenuexportertest ${dbusmenuexportertest_SRCS})
175
176@@ -55,13 +87,16 @@
177 ${test_LIBRARIES}
178 )
179
180+
181 # dbusmenuimportertest
182 set(dbusmenuimportertest_SRCS
183 dbusmenuimportertest.cpp
184 testutils.cpp
185 )
186
187-qt4_automoc(${dbusmenuimportertest_SRCS})
188+if (NOT USE_QT5)
189+ qt4_automoc(${dbusmenuimportertest_SRCS})
190+endif()
191
192 add_test_executable(dbusmenuimportertest ${dbusmenuimportertest_SRCS})
193
194@@ -69,12 +104,15 @@
195 ${test_LIBRARIES}
196 )
197
198+
199 # dbusmenushortcuttest
200 set(dbusmenushortcuttest_SRCS
201 dbusmenushortcuttest.cpp
202 )
203
204-qt4_automoc(${dbusmenushortcuttest_SRCS})
205+if (NOT USE_QT5)
206+ qt4_automoc(${dbusmenushortcuttest_SRCS})
207+endif()
208
209 add_test_executable(dbusmenushortcuttest ${dbusmenushortcuttest_SRCS})
210
211
212=== modified file 'tests/dbusmenuexportertest.cpp'
213--- tests/dbusmenuexportertest.cpp 2012-01-23 14:02:42 +0000
214+++ tests/dbusmenuexportertest.cpp 2015-03-05 14:54:53 +0000
215@@ -138,6 +138,7 @@
216 << "label"
217 << "enabled"
218 << "icon-name"
219+ << "icon-data" // Icon data is always provided if the icon is valid.
220 << "visible"
221 ;
222
223
224=== modified file 'tests/slowmenu.cpp'
225--- tests/slowmenu.cpp 2010-09-20 08:55:12 +0000
226+++ tests/slowmenu.cpp 2015-03-05 14:54:53 +0000
227@@ -24,6 +24,7 @@
228
229 #include <QtDBus>
230 #include <QtGui>
231+#include <QApplication>
232
233 static const char *TEST_SERVICE = "org.kde.dbusmenu-qt-test";
234 static const char *TEST_OBJECT_PATH = "/TestMenuBar";

Subscribers

People subscribed via source and target branches

to all changes: