Merge lp:~alan-griffiths/miral/fix-1658117 into lp:miral

Proposed by Alan Griffiths on 2017-02-08
Status: Merged
Approved by: Lukáš Tinkl on 2017-02-09
Approved revision: 505
Merged at revision: 504
Proposed branch: lp:~alan-griffiths/miral/fix-1658117
Merge into: lp:miral
Diff against target: 193 lines (+145/-0)
5 files modified
debian/changelog (+1/-0)
include/miral/toolkit/window_spec.h (+10/-0)
miral/basic_window_manager.cpp (+1/-0)
test/CMakeLists.txt (+1/-0)
test/window_properties.cpp (+132/-0)
To merge this branch: bzr merge lp:~alan-griffiths/miral/fix-1658117
Reviewer Review Type Date Requested Status
Lukáš Tinkl (community) 2017-02-08 Approve on 2017-02-09
Review via email: mp+316736@code.launchpad.net

Commit message

Tests (and correction) to shell chrome support

To post a comment you must log in.
Lukáš Tinkl (lukas-kde) wrote :

LGTM, the shell chrome is set correctly when using with u8, tests passing locally

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2017-02-02 17:30:41 +0000
3+++ debian/changelog 2017-02-08 17:19:02 +0000
4@@ -19,6 +19,7 @@
5 . top-level window is not raised along with its child (LP: #1658085)
6 . miral-shell depends on default cursor theme being installed
7 (LP: #1658159)
8+ . Chrome-less shell hint does not work any more (LP: #1658117)
9
10 -- Cemil Azizoglu <cemil.azizoglu@canonical.com> Fri, 27 Jan 2017 03:02:28 +0000
11
12
13=== modified file 'include/miral/toolkit/window_spec.h'
14--- include/miral/toolkit/window_spec.h 2017-02-03 12:10:41 +0000
15+++ include/miral/toolkit/window_spec.h 2017-02-08 17:19:02 +0000
16@@ -190,6 +190,16 @@
17 return *this;
18 }
19
20+ auto set_shell_chrome(MirShellChrome chrome) -> WindowSpec&
21+ {
22+#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0)
23+ mir_surface_spec_set_shell_chrome(*this, chrome);
24+#else
25+ mir_window_spec_set_shell_chrome(*this, chrome);
26+#endif
27+ return *this;
28+ }
29+
30 auto set_min_size(int min_width, int min_height) -> WindowSpec&
31 {
32 #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0)
33
34=== modified file 'miral/basic_window_manager.cpp'
35--- miral/basic_window_manager.cpp 2017-02-02 17:18:42 +0000
36+++ miral/basic_window_manager.cpp 2017-02-08 17:19:02 +0000
37@@ -560,6 +560,7 @@
38 COPY_IF_SET(preferred_orientation);
39 COPY_IF_SET(confine_pointer);
40 COPY_IF_SET(userdata);
41+ COPY_IF_SET(shell_chrome);
42
43 #undef COPY_IF_SET
44
45
46=== modified file 'test/CMakeLists.txt'
47--- test/CMakeLists.txt 2017-01-20 15:02:54 +0000
48+++ test/CMakeLists.txt 2017-02-08 17:19:02 +0000
49@@ -48,6 +48,7 @@
50 window_placement.cpp
51 window_placement_anchors_to_parent.cpp
52 window_placement_client_api.cpp
53+ window_properties.cpp
54 drag_active_window.cpp
55 modify_window_state.cpp
56 test_server.cpp test_server.h
57
58=== added file 'test/window_properties.cpp'
59--- test/window_properties.cpp 1970-01-01 00:00:00 +0000
60+++ test/window_properties.cpp 2017-02-08 17:19:02 +0000
61@@ -0,0 +1,132 @@
62+/*
63+ * Copyright © 2017 Canonical Ltd.
64+ *
65+ * This program is free software: you can redistribute it and/or modify it
66+ * under the terms of the GNU General Public License version 3,
67+ * as published by the Free Software Foundation.
68+ *
69+ * This program is distributed in the hope that it will be useful,
70+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
71+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
72+ * GNU General Public License for more details.
73+ *
74+ * You should have received a copy of the GNU General Public License
75+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
76+ *
77+ * Authored by: Alan Griffiths <alan@octopull.co.uk>
78+ */
79+
80+#include <miral/window_manager_tools.h>
81+
82+#include <miral/toolkit/window.h>
83+#include <miral/toolkit/window_spec.h>
84+#include <mir_toolkit/mir_buffer_stream.h>
85+
86+#include "test_server.h"
87+
88+#include <gmock/gmock.h>
89+#include <mir/test/signal.h>
90+
91+
92+using namespace testing;
93+using namespace miral::toolkit;
94+using namespace std::chrono_literals;
95+using miral::WindowManagerTools;
96+
97+namespace
98+{
99+#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0)
100+auto const mir_window_get_buffer_stream = mir_surface_get_buffer_stream;
101+#endif
102+
103+std::string const a_window{"a window"};
104+
105+struct WindowProperties;
106+
107+struct WindowProperties : public miral::TestServer
108+{
109+ void SetUp() override
110+ {
111+ miral::TestServer::SetUp();
112+ client_connection = connect_client("WindowProperties");
113+ }
114+
115+ void TearDown() override
116+ {
117+ client_connection.reset();
118+ miral::TestServer::TearDown();
119+ }
120+
121+ Connection client_connection;
122+};
123+}
124+
125+TEST_F(WindowProperties, on_creation_default_shell_chrome_is_normal)
126+{
127+ auto const window = WindowSpec::for_normal_window(client_connection, 50, 50, mir_pixel_format_argb_8888)
128+ .set_buffer_usage(mir_buffer_usage_software)
129+ .set_name(a_window.c_str())
130+ .create_window();
131+
132+ mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(window));
133+
134+ invoke_tools([&, this](WindowManagerTools& tools)
135+ {
136+ EXPECT_THAT(tools.info_for(tools.active_window()).shell_chrome(), Eq(mir_shell_chrome_normal));
137+ });
138+}
139+
140+TEST_F(WindowProperties, on_creation_client_setting_shell_chrome_low_is_seen_by_window_manager)
141+{
142+ auto const window = WindowSpec::for_normal_window(client_connection, 50, 50, mir_pixel_format_argb_8888)
143+ .set_buffer_usage(mir_buffer_usage_software)
144+ .set_name(a_window.c_str())
145+ .set_shell_chrome(mir_shell_chrome_low)
146+ .create_window();
147+
148+ mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(window));
149+
150+ invoke_tools([&, this](WindowManagerTools& tools)
151+ {
152+ EXPECT_THAT(tools.info_for(tools.active_window()).shell_chrome(), Eq(mir_shell_chrome_low));
153+ });
154+}
155+
156+TEST_F(WindowProperties, after_creation_client_setting_shell_chrome_low_is_seen_by_window_manager)
157+{
158+ auto const window = WindowSpec::for_normal_window(client_connection, 50, 50, mir_pixel_format_argb_8888)
159+ .set_buffer_usage(mir_buffer_usage_software)
160+ .set_name(a_window.c_str())
161+ .create_window();
162+
163+ WindowSpec::for_changes(client_connection)
164+ .set_shell_chrome(mir_shell_chrome_low)
165+ .apply_to(window);
166+
167+ mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(window));
168+
169+ invoke_tools([&, this](WindowManagerTools& tools)
170+ {
171+ EXPECT_THAT(tools.info_for(tools.active_window()).shell_chrome(), Eq(mir_shell_chrome_low));
172+ });
173+}
174+
175+TEST_F(WindowProperties, after_creation_client_setting_shell_chrome_normal_is_seen_by_window_manager)
176+{
177+ auto const window = WindowSpec::for_normal_window(client_connection, 50, 50, mir_pixel_format_argb_8888)
178+ .set_buffer_usage(mir_buffer_usage_software)
179+ .set_name(a_window.c_str())
180+ .set_shell_chrome(mir_shell_chrome_low)
181+ .create_window();
182+
183+ WindowSpec::for_changes(client_connection)
184+ .set_shell_chrome(mir_shell_chrome_normal)
185+ .apply_to(window);
186+
187+ mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(window));
188+
189+ invoke_tools([&, this](WindowManagerTools& tools)
190+ {
191+ EXPECT_THAT(tools.info_for(tools.active_window()).shell_chrome(), Eq(mir_shell_chrome_normal));
192+ });
193+}

Subscribers

People subscribed via source and target branches