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

Proposed by Alan Griffiths
Status: Merged
Approved by: Lukáš Tinkl
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) Approve
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.
Revision history for this message
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
=== modified file 'debian/changelog'
--- debian/changelog 2017-02-02 17:30:41 +0000
+++ debian/changelog 2017-02-08 17:19:02 +0000
@@ -19,6 +19,7 @@
19 . top-level window is not raised along with its child (LP: #1658085)19 . top-level window is not raised along with its child (LP: #1658085)
20 . miral-shell depends on default cursor theme being installed20 . miral-shell depends on default cursor theme being installed
21 (LP: #1658159)21 (LP: #1658159)
22 . Chrome-less shell hint does not work any more (LP: #1658117)
2223
23 -- Cemil Azizoglu <cemil.azizoglu@canonical.com> Fri, 27 Jan 2017 03:02:28 +000024 -- Cemil Azizoglu <cemil.azizoglu@canonical.com> Fri, 27 Jan 2017 03:02:28 +0000
2425
2526
=== modified file 'include/miral/toolkit/window_spec.h'
--- include/miral/toolkit/window_spec.h 2017-02-03 12:10:41 +0000
+++ include/miral/toolkit/window_spec.h 2017-02-08 17:19:02 +0000
@@ -190,6 +190,16 @@
190 return *this;190 return *this;
191 }191 }
192192
193 auto set_shell_chrome(MirShellChrome chrome) -> WindowSpec&
194 {
195#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0)
196 mir_surface_spec_set_shell_chrome(*this, chrome);
197#else
198 mir_window_spec_set_shell_chrome(*this, chrome);
199#endif
200 return *this;
201 }
202
193 auto set_min_size(int min_width, int min_height) -> WindowSpec&203 auto set_min_size(int min_width, int min_height) -> WindowSpec&
194 {204 {
195#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0)205#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0)
196206
=== modified file 'miral/basic_window_manager.cpp'
--- miral/basic_window_manager.cpp 2017-02-02 17:18:42 +0000
+++ miral/basic_window_manager.cpp 2017-02-08 17:19:02 +0000
@@ -560,6 +560,7 @@
560 COPY_IF_SET(preferred_orientation);560 COPY_IF_SET(preferred_orientation);
561 COPY_IF_SET(confine_pointer);561 COPY_IF_SET(confine_pointer);
562 COPY_IF_SET(userdata);562 COPY_IF_SET(userdata);
563 COPY_IF_SET(shell_chrome);
563564
564#undef COPY_IF_SET565#undef COPY_IF_SET
565566
566567
=== modified file 'test/CMakeLists.txt'
--- test/CMakeLists.txt 2017-01-20 15:02:54 +0000
+++ test/CMakeLists.txt 2017-02-08 17:19:02 +0000
@@ -48,6 +48,7 @@
48 window_placement.cpp48 window_placement.cpp
49 window_placement_anchors_to_parent.cpp49 window_placement_anchors_to_parent.cpp
50 window_placement_client_api.cpp50 window_placement_client_api.cpp
51 window_properties.cpp
51 drag_active_window.cpp52 drag_active_window.cpp
52 modify_window_state.cpp53 modify_window_state.cpp
53 test_server.cpp test_server.h54 test_server.cpp test_server.h
5455
=== added file 'test/window_properties.cpp'
--- test/window_properties.cpp 1970-01-01 00:00:00 +0000
+++ test/window_properties.cpp 2017-02-08 17:19:02 +0000
@@ -0,0 +1,132 @@
1/*
2 * Copyright © 2017 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Alan Griffiths <alan@octopull.co.uk>
17 */
18
19#include <miral/window_manager_tools.h>
20
21#include <miral/toolkit/window.h>
22#include <miral/toolkit/window_spec.h>
23#include <mir_toolkit/mir_buffer_stream.h>
24
25#include "test_server.h"
26
27#include <gmock/gmock.h>
28#include <mir/test/signal.h>
29
30
31using namespace testing;
32using namespace miral::toolkit;
33using namespace std::chrono_literals;
34using miral::WindowManagerTools;
35
36namespace
37{
38#if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0)
39auto const mir_window_get_buffer_stream = mir_surface_get_buffer_stream;
40#endif
41
42std::string const a_window{"a window"};
43
44struct WindowProperties;
45
46struct WindowProperties : public miral::TestServer
47{
48 void SetUp() override
49 {
50 miral::TestServer::SetUp();
51 client_connection = connect_client("WindowProperties");
52 }
53
54 void TearDown() override
55 {
56 client_connection.reset();
57 miral::TestServer::TearDown();
58 }
59
60 Connection client_connection;
61};
62}
63
64TEST_F(WindowProperties, on_creation_default_shell_chrome_is_normal)
65{
66 auto const window = WindowSpec::for_normal_window(client_connection, 50, 50, mir_pixel_format_argb_8888)
67 .set_buffer_usage(mir_buffer_usage_software)
68 .set_name(a_window.c_str())
69 .create_window();
70
71 mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(window));
72
73 invoke_tools([&, this](WindowManagerTools& tools)
74 {
75 EXPECT_THAT(tools.info_for(tools.active_window()).shell_chrome(), Eq(mir_shell_chrome_normal));
76 });
77}
78
79TEST_F(WindowProperties, on_creation_client_setting_shell_chrome_low_is_seen_by_window_manager)
80{
81 auto const window = WindowSpec::for_normal_window(client_connection, 50, 50, mir_pixel_format_argb_8888)
82 .set_buffer_usage(mir_buffer_usage_software)
83 .set_name(a_window.c_str())
84 .set_shell_chrome(mir_shell_chrome_low)
85 .create_window();
86
87 mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(window));
88
89 invoke_tools([&, this](WindowManagerTools& tools)
90 {
91 EXPECT_THAT(tools.info_for(tools.active_window()).shell_chrome(), Eq(mir_shell_chrome_low));
92 });
93}
94
95TEST_F(WindowProperties, after_creation_client_setting_shell_chrome_low_is_seen_by_window_manager)
96{
97 auto const window = WindowSpec::for_normal_window(client_connection, 50, 50, mir_pixel_format_argb_8888)
98 .set_buffer_usage(mir_buffer_usage_software)
99 .set_name(a_window.c_str())
100 .create_window();
101
102 WindowSpec::for_changes(client_connection)
103 .set_shell_chrome(mir_shell_chrome_low)
104 .apply_to(window);
105
106 mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(window));
107
108 invoke_tools([&, this](WindowManagerTools& tools)
109 {
110 EXPECT_THAT(tools.info_for(tools.active_window()).shell_chrome(), Eq(mir_shell_chrome_low));
111 });
112}
113
114TEST_F(WindowProperties, after_creation_client_setting_shell_chrome_normal_is_seen_by_window_manager)
115{
116 auto const window = WindowSpec::for_normal_window(client_connection, 50, 50, mir_pixel_format_argb_8888)
117 .set_buffer_usage(mir_buffer_usage_software)
118 .set_name(a_window.c_str())
119 .set_shell_chrome(mir_shell_chrome_low)
120 .create_window();
121
122 WindowSpec::for_changes(client_connection)
123 .set_shell_chrome(mir_shell_chrome_normal)
124 .apply_to(window);
125
126 mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(window));
127
128 invoke_tools([&, this](WindowManagerTools& tools)
129 {
130 EXPECT_THAT(tools.info_for(tools.active_window()).shell_chrome(), Eq(mir_shell_chrome_normal));
131 });
132}

Subscribers

People subscribed via source and target branches