on xenial help sign in
Merge from test-early-disable
e329c01Michael Terry
cmake/modules/QmlTest.cmake+3
@@ -153,7 +153,9 @@ endmacro(add_qml_test_internal)
153
153
154macro(add_binary_qml_test CLASS_NAME LD_PATH DEPS ENVVAR)
154macro(add_binary_qml_test CLASS_NAME LD_PATH DEPS ENVVAR)
155 set(testCommand
155 set(testCommand
156+ ${ENVVAR}
156 LD_LIBRARY_PATH=${LD_PATH}
157 LD_LIBRARY_PATH=${LD_PATH}
158+ dbus-launch
157 ${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}TestExec
159 ${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}TestExec
158 -o ${CMAKE_BINARY_DIR}/test${CLASS_NAME}.xml,xunitxml
160 -o ${CMAKE_BINARY_DIR}/test${CLASS_NAME}.xml,xunitxml
159 -o -,txt)
161 -o -,txt)
@@ -171,6 +173,7 @@ macro(add_binary_qml_test CLASS_NAME LD_PATH DEPS ENVVAR)
171 ${ENVVAR}
173 ${ENVVAR}
172 LD_LIBRARY_PATH=${LD_PATH}
174 LD_LIBRARY_PATH=${LD_PATH}
173 xvfb-run --server-args "-screen 0 1024x768x24" --auto-servernum
175 xvfb-run --server-args "-screen 0 1024x768x24" --auto-servernum
176+ dbus-launch
174 ${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}TestExec
177 ${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}TestExec
175 -o ${CMAKE_BINARY_DIR}/test${CLASS_NAME}.xml,xunitxml
178 -o ${CMAKE_BINARY_DIR}/test${CLASS_NAME}.xml,xunitxml
176 -o -,txt)
179 -o -,txt)
tests/plugins/LightDM/CMakeLists.txt+4−8
@@ -1,8 +1,8 @@
1−add_executable(test-lightdm-dbus
1+add_executable(GreeterDBusTestExec
2 dbus.cpp
2 dbus.cpp
3 ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp
3 ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp
4 )
4 )
5−qt5_use_modules(test-lightdm-dbus Core DBus Quick Test)
5+qt5_use_modules(GreeterDBusTestExec Core DBus Quick Test)
6
6
7include_directories(
7include_directories(
8 ${CMAKE_CURRENT_BINARY_DIR}
8 ${CMAKE_CURRENT_BINARY_DIR}
@@ -11,15 +11,11 @@ include_directories(
11 ${LIBLIGHTDM_INCLUDE_DIRS}
11 ${LIBLIGHTDM_INCLUDE_DIRS}
12 )
12 )
13
13
14−add_dependencies(test-lightdm-dbus MockLightDM-full)
15−target_link_libraries(test-lightdm-dbus
14+target_link_libraries(GreeterDBusTestExec
16 -L${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full
15 -L${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full
17 -llightdm-qt5-2
16 -llightdm-qt5-2
18 )
17 )
19
18
20add_definitions(-DCURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
19add_definitions(-DCURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
21
20
22−add_custom_target(testLightDMDBus xvfb-run --server-args "-screen 0 1024x768x24" --auto-servernum dbus-launch env QML2_IMPORT_PATH=${CMAKE_BINARY_DIR}/tests/mocks LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full ${CMAKE_CURRENT_BINARY_DIR}/test-lightdm-dbus)
21+add_binary_qml_test(GreeterDBus "${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full" MockLightDM-full "QML2_IMPORT_PATH=${CMAKE_BINARY_DIR}/tests/mocks")
23−add_dependencies(testLightDMDBus test-lightdm-dbus)
24−
25−add_dependencies(qmluitests testLightDMDBus)
tests/plugins/LightDM/dbus.cpp+5−2
@@ -162,9 +162,12 @@ private Q_SLOTS:
162 {
162 {
163 QSignalSpy spy(this, SIGNAL(PropertiesChangedRelay(QString, QVariantMap, QStringList)));
163 QSignalSpy spy(this, SIGNAL(PropertiesChangedRelay(QString, QVariantMap, QStringList)));
164 greeter->authenticate("no-password");
164 greeter->authenticate("no-password");
165− spy.wait();
166
165
167− QCOMPARE(spy.count(), 2); // once for user, once for locked; second will be for locked mode
166+ // once for user, once for locked; second will be for locked mode
167+ while (spy.count() != 2) {
168+ spy.wait();
169+ }
170+
168 QList<QVariant> arguments = spy.takeLast();
171 QList<QVariant> arguments = spy.takeLast();
169 QVERIFY(arguments.at(0).toString() == "com.canonical.UnityGreeter.List");
172 QVERIFY(arguments.at(0).toString() == "com.canonical.UnityGreeter.List");
170 QVERIFY(arguments.at(1).toMap().contains("EntryIsLocked"));
173 QVERIFY(arguments.at(1).toMap().contains("EntryIsLocked"));