[mutter] tests/wayland-fullscreen: Check surface size



commit 19df8888fbcd903c631a770c8d49f2d26de7940b
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Wed Sep 28 20:51:32 2022 +0200

    tests/wayland-fullscreen: Check surface size
    
    In the test in question, it should be smaller than the window geometry,
    since the black background makes the window geomerty larger than the
    surface.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2338>

 src/tests/wayland-fullscreen-test.c | 13 +++++++++++++
 src/wayland/meta-wayland-surface.h  |  3 +++
 2 files changed, 16 insertions(+)
---
diff --git a/src/tests/wayland-fullscreen-test.c b/src/tests/wayland-fullscreen-test.c
index 8e6fb4b25e..10a94667c3 100644
--- a/src/tests/wayland-fullscreen-test.c
+++ b/src/tests/wayland-fullscreen-test.c
@@ -19,12 +19,14 @@
 
 #include "backends/meta-virtual-monitor.h"
 #include "compositor/meta-window-actor-private.h"
+#include "core/window-private.h"
 #include "meta-test/meta-context-test.h"
 #include "tests/meta-test-utils.h"
 #include "tests/meta-wayland-test-driver.h"
 #include "tests/meta-wayland-test-utils.h"
 #include "backends/native/meta-renderer-native.h"
 #include "tests/meta-ref-test.h"
+#include "wayland/meta-wayland-surface.h"
 
 static MetaContext *test_context;
 static MetaWaylandTestDriver *test_driver;
@@ -32,6 +34,16 @@ static MetaVirtualMonitor *virtual_monitor;
 static MetaWaylandTestClient *wayland_test_client;
 static MetaWindow *test_window = NULL;
 
+#define assert_wayland_surface_size(window, width, height) \
+{ \
+  g_assert_cmpint (meta_wayland_surface_get_width (window->surface), \
+                   ==, \
+                   width); \
+  g_assert_cmpint (meta_wayland_surface_get_height (window->surface), \
+                   ==, \
+                   height); \
+}
+
 static ClutterStageView *
 get_view (void)
 {
@@ -101,6 +113,7 @@ toplevel_fullscreen (void)
   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);
 }
 
 static void
diff --git a/src/wayland/meta-wayland-surface.h b/src/wayland/meta-wayland-surface.h
index bb33ce2d24..3ac1ab989c 100644
--- a/src/wayland/meta-wayland-surface.h
+++ b/src/wayland/meta-wayland-surface.h
@@ -357,7 +357,10 @@ void                meta_wayland_surface_notify_subsurface_state_changed (MetaWa
 
 void                meta_wayland_surface_notify_unmapped (MetaWaylandSurface *surface);
 
+META_EXPORT_TEST
 int                 meta_wayland_surface_get_width (MetaWaylandSurface *surface);
+
+META_EXPORT_TEST
 int                 meta_wayland_surface_get_height (MetaWaylandSurface *surface);
 
 CoglScanout *       meta_wayland_surface_try_acquire_scanout (MetaWaylandSurface *surface,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]