tests/wayland-fullscreen: Also test toggling fullscreen

This tests that unfullscreen makes the black background disappear, and
that fullscreening again makes it re-appear.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2338>
This commit is contained in:
Jonas Ådahl 2022-09-28 20:53:18 +02:00 committed by Marge Bot
parent 19df8888fb
commit 21cddbae95
4 changed files with 41 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

View File

@ -26,6 +26,7 @@
#include "tests/meta-wayland-test-utils.h" #include "tests/meta-wayland-test-utils.h"
#include "backends/native/meta-renderer-native.h" #include "backends/native/meta-renderer-native.h"
#include "tests/meta-ref-test.h" #include "tests/meta-ref-test.h"
#include "wayland/meta-window-wayland.h"
#include "wayland/meta-wayland-surface.h" #include "wayland/meta-wayland-surface.h"
static MetaContext *test_context; static MetaContext *test_context;
@ -119,11 +120,49 @@ toplevel_fullscreen (void)
static void static void
toplevel_fullscreen_ref_test (void) toplevel_fullscreen_ref_test (void)
{ {
MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (test_window);
MetaRectangle rect;
wait_for_window_added (test_window); wait_for_window_added (test_window);
assert_wayland_surface_size (test_window, 10, 10);
g_assert_true (meta_window_wayland_is_acked_fullscreen (wl_window));
meta_ref_test_verify_view (get_view (), meta_ref_test_verify_view (get_view (),
g_test_get_path (), 1, g_test_get_path (), 1,
meta_ref_test_determine_ref_test_flag ()); meta_ref_test_determine_ref_test_flag ());
meta_window_unmake_fullscreen (test_window);
while (meta_window_wayland_is_acked_fullscreen (wl_window))
g_main_context_iteration (NULL, FALSE);
meta_window_move_frame (test_window, FALSE, 12, 13);
meta_window_get_frame_rect (test_window, &rect);
g_assert_cmpint (rect.width, ==, 10);
g_assert_cmpint (rect.height, ==, 10);
g_assert_cmpint (rect.x, ==, 12);
g_assert_cmpint (rect.y, ==, 13);
assert_wayland_surface_size (test_window, 10, 10);
meta_ref_test_verify_view (get_view (),
g_test_get_path (), 2,
meta_ref_test_determine_ref_test_flag ());
meta_window_make_fullscreen (test_window);
while (!meta_window_wayland_is_acked_fullscreen (wl_window))
g_main_context_iteration (NULL, FALSE);
meta_window_get_frame_rect (test_window, &rect);
g_assert_cmpint (rect.width, ==, 100);
g_assert_cmpint (rect.height, ==, 100);
g_assert_cmpint (rect.x, ==, 0);
g_assert_cmpint (rect.y, ==, 0);
assert_wayland_surface_size (test_window, 10, 10);
meta_ref_test_verify_view (get_view (),
g_test_get_path (), 3,
meta_ref_test_determine_ref_test_flag ());
} }
static void static void

View File

@ -32,6 +32,7 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#define META_TYPE_WINDOW_WAYLAND (meta_window_wayland_get_type()) #define META_TYPE_WINDOW_WAYLAND (meta_window_wayland_get_type())
META_EXPORT_TEST
G_DECLARE_FINAL_TYPE (MetaWindowWayland, meta_window_wayland, G_DECLARE_FINAL_TYPE (MetaWindowWayland, meta_window_wayland,
META, WINDOW_WAYLAND, META, WINDOW_WAYLAND,
MetaWindow) MetaWindow)
@ -81,6 +82,7 @@ gboolean meta_window_wayland_is_resize (MetaWindowWayland *wl_window,
int width, int width,
int height); int height);
META_EXPORT_TEST
gboolean meta_window_wayland_is_acked_fullscreen (MetaWindowWayland *wl_window); gboolean meta_window_wayland_is_acked_fullscreen (MetaWindowWayland *wl_window);
#endif #endif