Merge lp:~gerboland/qtmir/use-mir-test-dev into lp:qtmir

Proposed by Gerry Boland on 2016-08-22
Status: Merged
Approved by: Gerry Boland on 2016-08-25
Approved revision: 541
Merged at revision: 562
Proposed branch: lp:~gerboland/qtmir/use-mir-test-dev
Merge into: lp:qtmir
Diff against target: 455 lines (+38/-237)
12 files modified
debian/control (+2/-1)
tests/CMakeLists.txt (+2/-0)
tests/framework/CMakeLists.txt (+1/-3)
tests/framework/mock_display.cpp (+0/-35)
tests/framework/mock_display.h (+0/-66)
tests/framework/mock_display_configuration.cpp (+0/-25)
tests/framework/mock_display_configuration.h (+0/-40)
tests/framework/mock_gl_display_buffer.cpp (+0/-30)
tests/framework/mock_gl_display_buffer.h (+4/-12)
tests/mirserver/ScreensModel/CMakeLists.txt (+1/-0)
tests/mirserver/ScreensModel/screensmodel_test.cpp (+9/-0)
tests/mirserver/ScreensModel/stub_display.h (+19/-25)
To merge this branch: bzr merge lp:~gerboland/qtmir/use-mir-test-dev
Reviewer Review Type Date Requested Status
Alan Griffiths 2016-08-22 Approve on 2016-08-25
Unity8 CI Bot continuous-integration Approve on 2016-08-23
Review via email: mp+303537@code.launchpad.net

Commit Message

[tests] refactor ScreensModel test to use mocks from mirtest-dev

To post a comment you must log in.
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

I like it, but...

+ mirtest-dev (>= 0.24.0)

s/$/,$/

review: Needs Fixing
lp:~gerboland/qtmir/use-mir-test-dev updated on 2016-08-22
540. By Gerry Boland on 2016-08-22

Debian control typo fix

Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:540
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/340/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/2615/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2643
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2521
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2521
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2521
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2515/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2515/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2515/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2515/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2515/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2515/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2515/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2515/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2515/console

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/340/rebuild

review: Needs Fixing (continuous-integration)
lp:~gerboland/qtmir/use-mir-test-dev updated on 2016-08-22
541. By Gerry Boland on 2016-08-22

Fix FTBFS: include pkg before adding subdirectories which require the pkg

Alan Griffiths (alan-griffiths) wrote :

Well, this time the error doesn't "leap out". I leave you to argue with debuild about search paths.

review: Approve
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:541
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/342/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/2621/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2649
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2526
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2526
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2526
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2520
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2520/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2520
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2520/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2520
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2520/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2520
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2520/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2520
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2520/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2520
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2520/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2520
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2520/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2520/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2520
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2520/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/342/rebuild

review: Needs Fixing (continuous-integration)
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:541
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/343/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/2633
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2661
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2535
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2535
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2535
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2529
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2529/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2529
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2529/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2529
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2529/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2529
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2529/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2529
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2529/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2529
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2529/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2529
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2529/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2529
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2529/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2529
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2529/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/343/rebuild

review: Approve (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

If CI is happy I am too

review: Approve
lp:~gerboland/qtmir/use-mir-test-dev updated on 2016-09-07
542. By Gerry Boland on 2016-09-07

Merge qtmir trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2016-08-30 12:32:13 +0000
3+++ debian/control 2016-09-07 09:24:06 +0000
4@@ -28,7 +28,8 @@
5 liburl-dispatcher1-dev,
6 libxkbcommon-dev,
7 libxrender-dev,
8- mir-renderer-gl-dev (>= 0.22.0),
9+ mir-renderer-gl-dev (>= 0.24.0),
10+ mirtest-dev (>= 0.24.0),
11 pkg-config,
12 # lttng-gen-ts needs python3, but doesn't depend on it itself: bug 1359147
13 python3:any,
14
15=== modified file 'tests/CMakeLists.txt'
16--- tests/CMakeLists.txt 2016-04-26 08:56:36 +0000
17+++ tests/CMakeLists.txt 2016-09-07 09:24:06 +0000
18@@ -1,5 +1,7 @@
19 find_package(GMock)
20
21+pkg_check_modules(MIRTEST mirtest>=0.24 REQUIRED)
22+
23 add_subdirectory(framework)
24 add_subdirectory(mirserver)
25 add_subdirectory(modules)
26
27=== modified file 'tests/framework/CMakeLists.txt'
28--- tests/framework/CMakeLists.txt 2016-08-30 12:24:19 +0000
29+++ tests/framework/CMakeLists.txt 2016-09-07 09:24:06 +0000
30@@ -8,6 +8,7 @@
31 ${APPLICATION_API_INCLUDE_DIRS}
32 ${MIRSERVER_INCLUDE_DIRS}
33 ${MIRRENDERERGLDEV_INCLUDE_DIRS}
34+ ${MIRTEST_INCLUDE_DIRS}
35
36 ${Qt5Quick_INCLUDE_DIRS}
37 ${Qt5DBus_INCLUDE_DIRS}
38@@ -18,9 +19,6 @@
39 fake_mirsurface.cpp
40 fake_session.cpp
41 mock_application_info.cpp
42- mock_display.cpp
43- mock_display_configuration.cpp
44- mock_gl_display_buffer.cpp
45 mock_main_loop.cpp
46 mock_mir_session.cpp
47 mock_proc_info.cpp
48
49=== removed file 'tests/framework/mock_display.cpp'
50--- tests/framework/mock_display.cpp 2015-11-11 10:43:36 +0000
51+++ tests/framework/mock_display.cpp 1970-01-01 00:00:00 +0000
52@@ -1,35 +0,0 @@
53-/*
54- * Copyright (C) 2015 Canonical, Ltd.
55- *
56- * This program is free software: you can redistribute it and/or modify it under
57- * the terms of the GNU Lesser General Public License version 3, as published by
58- * the Free Software Foundation.
59- *
60- * This program is distributed in the hope that it will be useful, but WITHOUT
61- * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
62- * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
63- * Lesser General Public License for more details.
64- *
65- * You should have received a copy of the GNU Lesser General Public License
66- * along with this program. If not, see <http://www.gnu.org/licenses/>.
67- */
68-
69-#include "mock_display.h"
70-#include <mir/graphics/event_handler_register.h>
71-#include <mir/graphics/display_configuration.h>
72-
73-MockDisplaySyncGroup::MockDisplaySyncGroup()
74-{
75-}
76-
77-MockDisplaySyncGroup::~MockDisplaySyncGroup()
78-{
79-}
80-
81-MockDisplay::MockDisplay()
82-{
83-}
84-
85-MockDisplay::~MockDisplay()
86-{
87-}
88
89=== removed file 'tests/framework/mock_display.h'
90--- tests/framework/mock_display.h 2016-02-19 10:41:15 +0000
91+++ tests/framework/mock_display.h 1970-01-01 00:00:00 +0000
92@@ -1,66 +0,0 @@
93-/*
94- * Copyright (C) 2015 Canonical, Ltd.
95- *
96- * This program is free software: you can redistribute it and/or modify it under
97- * the terms of the GNU Lesser General Public License version 3, as published by
98- * the Free Software Foundation.
99- *
100- * This program is distributed in the hope that it will be useful, but WITHOUT
101- * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
102- * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
103- * Lesser General Public License for more details.
104- *
105- * You should have received a copy of the GNU Lesser General Public License
106- * along with this program. If not, see <http://www.gnu.org/licenses/>.
107- */
108-
109-#ifndef MOCKDISPLAY_H
110-#define MOCKDISPLAY_H
111-
112-#include <mir/graphics/display.h>
113-#include <mir/graphics/gl_context.h>
114-#include <mir/version.h>
115-
116-#if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 20, 0)
117-#include <mir/graphics/virtual_output.h>
118-#endif
119-
120-#include <gmock/gmock.h>
121-#include "gmock_fixes.h"
122-
123-class MockDisplaySyncGroup : public mir::graphics::DisplaySyncGroup
124-{
125-public:
126- MockDisplaySyncGroup();
127- virtual ~MockDisplaySyncGroup();
128-
129- MOCK_METHOD1(for_each_display_buffer, void(std::function<void(mir::graphics::DisplayBuffer&)> const& f));
130- MOCK_METHOD0(post, void());
131-};
132-
133-struct MockDisplay : public mir::graphics::Display
134-{
135-public:
136- MockDisplay();
137- virtual ~MockDisplay();
138-
139- MOCK_METHOD1(for_each_display_sync_group, void(std::function<void(mir::graphics::DisplaySyncGroup&)> const&));
140- MOCK_CONST_METHOD0(configuration, std::unique_ptr<mir::graphics::DisplayConfiguration>());
141- MOCK_METHOD1(configure, void(mir::graphics::DisplayConfiguration const&));
142- MOCK_METHOD2(register_configuration_change_handler,
143- void(mir::graphics::EventHandlerRegister&, mir::graphics::DisplayConfigurationChangeHandler const&));
144-
145- MOCK_METHOD3(register_pause_resume_handlers, void(mir::graphics::EventHandlerRegister&,
146- mir::graphics::DisplayPauseHandler const&,
147- mir::graphics::DisplayResumeHandler const&));
148- MOCK_METHOD0(pause, void());
149- MOCK_METHOD0(resume, void());
150- MOCK_METHOD1(create_hardware_cursor, std::shared_ptr<mir::graphics::Cursor>(std::shared_ptr<mir::graphics::CursorImage> const&));
151- MOCK_METHOD0(create_gl_context, std::unique_ptr<mir::graphics::GLContext>());
152-
153-#if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 20, 0)
154- MOCK_METHOD2(create_virtual_output, std::unique_ptr<mir::graphics::VirtualOutput> (int width, int height));
155-#endif
156-};
157-
158-#endif // MOCKDISPLAY_H
159
160=== removed file 'tests/framework/mock_display_configuration.cpp'
161--- tests/framework/mock_display_configuration.cpp 2015-11-11 10:43:36 +0000
162+++ tests/framework/mock_display_configuration.cpp 1970-01-01 00:00:00 +0000
163@@ -1,25 +0,0 @@
164-/*
165- * Copyright (C) 2015 Canonical, Ltd.
166- *
167- * This program is free software: you can redistribute it and/or modify it under
168- * the terms of the GNU Lesser General Public License version 3, as published by
169- * the Free Software Foundation.
170- *
171- * This program is distributed in the hope that it will be useful, but WITHOUT
172- * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
173- * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
174- * Lesser General Public License for more details.
175- *
176- * You should have received a copy of the GNU Lesser General Public License
177- * along with this program. If not, see <http://www.gnu.org/licenses/>.
178- */
179-
180-#include "mock_display_configuration.h"
181-
182-MockDisplayConfiguration::MockDisplayConfiguration()
183-{
184-}
185-
186-MockDisplayConfiguration::~MockDisplayConfiguration()
187-{
188-}
189
190=== removed file 'tests/framework/mock_display_configuration.h'
191--- tests/framework/mock_display_configuration.h 2016-02-01 12:18:00 +0000
192+++ tests/framework/mock_display_configuration.h 1970-01-01 00:00:00 +0000
193@@ -1,40 +0,0 @@
194-/*
195- * Copyright (C) 2015 Canonical, Ltd.
196- *
197- * This program is free software: you can redistribute it and/or modify it under
198- * the terms of the GNU Lesser General Public License version 3, as published by
199- * the Free Software Foundation.
200- *
201- * This program is distributed in the hope that it will be useful, but WITHOUT
202- * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
203- * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
204- * Lesser General Public License for more details.
205- *
206- * You should have received a copy of the GNU Lesser General Public License
207- * along with this program. If not, see <http://www.gnu.org/licenses/>.
208- */
209-
210-#ifndef MOCK_DISPLAY_CONFIGURATION_H
211-#define MOCK_DISPLAY_CONFIGURATION_H
212-
213-#include <mir/graphics/display_configuration.h>
214-
215-#include <gmock/gmock.h>
216-#include "gmock_fixes.h"
217-
218-class MockDisplayConfiguration : public mir::graphics::DisplayConfiguration
219-{
220-public:
221- MockDisplayConfiguration();
222- virtual ~MockDisplayConfiguration();
223-
224- MOCK_CONST_METHOD1(for_each_card, void(std::function<void(mir::graphics::DisplayConfigurationCard const&)>));
225-
226- MOCK_CONST_METHOD1(for_each_output, void(std::function<void(mir::graphics::DisplayConfigurationOutput const&)>));
227- MOCK_METHOD1(for_each_output, void(std::function<void(mir::graphics::UserDisplayConfigurationOutput&)>));
228- MOCK_CONST_METHOD0(clone, std::unique_ptr<mir::graphics::DisplayConfiguration>());
229-
230- MOCK_CONST_METHOD0(valid, bool());
231-};
232-
233-#endif // MOCK_DISPLAY_CONFIGURATION_H
234
235=== removed file 'tests/framework/mock_gl_display_buffer.cpp'
236--- tests/framework/mock_gl_display_buffer.cpp 2015-11-11 10:43:36 +0000
237+++ tests/framework/mock_gl_display_buffer.cpp 1970-01-01 00:00:00 +0000
238@@ -1,30 +0,0 @@
239-/*
240- * Copyright (C) 2015 Canonical, Ltd.
241- *
242- * This program is free software: you can redistribute it and/or modify it under
243- * the terms of the GNU Lesser General Public License version 3, as published by
244- * the Free Software Foundation.
245- *
246- * This program is distributed in the hope that it will be useful, but WITHOUT
247- * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
248- * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
249- * Lesser General Public License for more details.
250- *
251- * You should have received a copy of the GNU Lesser General Public License
252- * along with this program. If not, see <http://www.gnu.org/licenses/>.
253- */
254-
255-#include "mock_gl_display_buffer.h"
256-
257-MockGLDisplayBuffer::MockGLDisplayBuffer()
258-{
259- using namespace testing;
260- ON_CALL(*this, view_area())
261- .WillByDefault(Return(mir::geometry::Rectangle{{0,0},{0,0}}));
262- ON_CALL(*this, native_display_buffer())
263- .WillByDefault(Return(dynamic_cast<mir::graphics::NativeDisplayBuffer*>(this)));
264-}
265-
266-MockGLDisplayBuffer::~MockGLDisplayBuffer()
267-{
268-}
269
270=== modified file 'tests/framework/mock_gl_display_buffer.h'
271--- tests/framework/mock_gl_display_buffer.h 2016-04-21 16:21:22 +0000
272+++ tests/framework/mock_gl_display_buffer.h 2016-09-07 09:24:06 +0000
273@@ -1,5 +1,5 @@
274 /*
275- * Copyright (C) 2015 Canonical, Ltd.
276+ * Copyright (C) 2015-2016 Canonical, Ltd.
277 *
278 * This program is free software: you can redistribute it and/or modify it under
279 * the terms of the GNU Lesser General Public License version 3, as published by
280@@ -17,24 +17,16 @@
281 #ifndef MOCK_GL_DISPLAY_BUFFER_H
282 #define MOCK_GL_DISPLAY_BUFFER_H
283
284-#include <mir/graphics/display_buffer.h>
285+#include <mir/test/doubles/null_display_buffer.h>
286 #include <mir/renderer/gl/render_target.h>
287
288 #include <gmock/gmock.h>
289
290-class MockGLDisplayBuffer : public mir::graphics::DisplayBuffer,
291- public mir::renderer::gl::RenderTarget,
292- public mir::graphics::NativeDisplayBuffer
293+class MockGLDisplayBuffer : public mir::test::doubles::NullDisplayBuffer,
294+ public mir::renderer::gl::RenderTarget
295 {
296 public:
297- MockGLDisplayBuffer();
298- virtual ~MockGLDisplayBuffer();
299-
300 MOCK_CONST_METHOD0(view_area, mir::geometry::Rectangle());
301- MOCK_METHOD1(post_renderables_if_optimizable, bool(mir::graphics::RenderableList const&));
302- MOCK_CONST_METHOD0(orientation, MirOrientation());
303- MOCK_CONST_METHOD0(mirror_mode, MirMirrorMode());
304- MOCK_METHOD0(native_display_buffer, mir::graphics::NativeDisplayBuffer*());
305
306 MOCK_METHOD0(make_current, void());
307 MOCK_METHOD0(bind, void());
308
309=== modified file 'tests/mirserver/ScreensModel/CMakeLists.txt'
310--- tests/mirserver/ScreensModel/CMakeLists.txt 2016-08-30 12:34:47 +0000
311+++ tests/mirserver/ScreensModel/CMakeLists.txt 2016-09-07 09:24:06 +0000
312@@ -18,6 +18,7 @@
313 ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
314 ${MIRSERVER_INCLUDE_DIRS}
315 ${MIRRENDERERGLDEV_INCLUDE_DIRS}
316+ ${MIRTEST_INCLUDE_DIRS}
317 )
318
319 add_executable(ScreensModelTest ${SCREENCONTROLLER_TEST_SOURCES})
320
321=== modified file 'tests/mirserver/ScreensModel/screensmodel_test.cpp'
322--- tests/mirserver/ScreensModel/screensmodel_test.cpp 2016-05-25 15:48:53 +0000
323+++ tests/mirserver/ScreensModel/screensmodel_test.cpp 2016-09-07 09:24:06 +0000
324@@ -19,20 +19,26 @@
325
326 #include "stub_display.h"
327 #include "mock_main_loop.h"
328+#include "mock_gl_display_buffer.h"
329 #include "qtcompositor.h"
330 #include "fake_displayconfigurationoutput.h"
331
332+#include <mir/test/doubles/stub_display_buffer.h>
333+
334 #include "testable_screensmodel.h"
335 #include "screen.h"
336 #include "screenwindow.h"
337
338 #include <QGuiApplication>
339+#include <QLoggingCategory>
340
341 using namespace ::testing;
342
343 namespace mg = mir::graphics;
344 namespace geom = mir::geometry;
345
346+using StubDisplayBuffer = mir::test::doubles::StubDisplayBuffer;
347+
348 class ScreensModelTest : public ::testing::Test {
349 protected:
350 void SetUp() override;
351@@ -49,6 +55,9 @@
352 setenv("QT_QPA_PLATFORM", "minimal", 1);
353 Screen::skipDBusRegistration = true;
354
355+ // We don't want the logging spam cluttering the test results
356+ QLoggingCategory::setFilterRules(QStringLiteral("qtmir.*=false"));
357+
358 screensModel = new TestableScreensModel;
359 display = std::make_shared<StubDisplay>();
360 compositor = std::make_shared<QtCompositor>();
361
362=== modified file 'tests/mirserver/ScreensModel/stub_display.h'
363--- tests/mirserver/ScreensModel/stub_display.h 2016-08-08 13:55:43 +0000
364+++ tests/mirserver/ScreensModel/stub_display.h 2016-09-07 09:24:06 +0000
365@@ -1,5 +1,5 @@
366 /*
367- * Copyright (C) 2015 Canonical, Ltd.
368+ * Copyright (C) 2015-2016 Canonical, Ltd.
369 *
370 * This program is free software: you can redistribute it and/or modify it under
371 * the terms of the GNU Lesser General Public License version 3, as published by
372@@ -17,13 +17,17 @@
373 #ifndef STUB_DISPLAY_H
374 #define STUB_DISPLAY_H
375
376-#include "mock_display.h"
377-#include "mock_gl_display_buffer.h"
378-#include "mock_display_configuration.h"
379-
380-namespace mg = mir::graphics;
381+#include <mir/test/doubles/null_display.h>
382+#include <mir/test/doubles/null_display_sync_group.h>
383+namespace mg = mir::graphics; // Bug lp:1614983
384+#include <mir/test/doubles/mock_display_configuration.h>
385 namespace geom = mir::geometry;
386
387+using NullDisplay = mir::test::doubles::NullDisplay;
388+using MockDisplayConfiguration = mir::test::doubles::MockDisplayConfiguration;
389+
390+class MockGLDisplayBuffer;
391+
392 class StubDisplayConfiguration : public MockDisplayConfiguration
393 {
394 public:
395@@ -38,37 +42,27 @@
396 }
397 }
398
399-
400- std::unique_ptr<mg::DisplayConfiguration> clone() const override
401- {
402- return std::make_unique<MockDisplayConfiguration>();
403- }
404-
405 private:
406 const std::vector<mg::DisplayConfigurationOutput> m_config;
407 };
408
409
410-class StubDisplaySyncGroup : public MockDisplaySyncGroup
411+class StubDisplaySyncGroup : public mir::test::doubles::NullDisplaySyncGroup
412 {
413 public:
414- StubDisplaySyncGroup(MockGLDisplayBuffer *buffer) : buffer(buffer) {}
415+ StubDisplaySyncGroup(mg::DisplayBuffer *buffer) : m_buffer(buffer) {}
416
417 void for_each_display_buffer(std::function<void(mg::DisplayBuffer&)> const& f) override
418 {
419- f(*buffer);
420- }
421- std::chrono::milliseconds recommended_sleep() const override
422- {
423- std::chrono::milliseconds one{1};
424- return one;
425- }
426+ f(*m_buffer);
427+ }
428+
429 private:
430- MockGLDisplayBuffer *buffer;
431+ mg::DisplayBuffer *m_buffer;
432 };
433
434
435-class StubDisplay : public MockDisplay
436+class StubDisplay : public NullDisplay
437 {
438 public:
439 // Note, GMock cannot mock functions which return non-copyable objects, so stubbing needed
440@@ -82,13 +76,13 @@
441 void for_each_display_sync_group(std::function<void(mg::DisplaySyncGroup&)> const& f) override
442 {
443 for (auto displayBuffer : m_displayBuffers) {
444- StubDisplaySyncGroup b(displayBuffer);
445+ StubDisplaySyncGroup b(reinterpret_cast<mg::DisplayBuffer *>(displayBuffer));
446 f(b);
447 }
448 }
449
450 void setFakeConfiguration(std::vector<mg::DisplayConfigurationOutput> &config,
451- std::vector<MockGLDisplayBuffer*> &displayBuffers)
452+ std::vector<MockGLDisplayBuffer*> displayBuffers)
453 {
454 m_config = config;
455 m_displayBuffers = displayBuffers;

Subscribers

People subscribed via source and target branches