summaryrefslogtreecommitdiff
path: root/tests/common/test_surface_integration.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/common/test_surface_integration.c')
-rw-r--r--tests/common/test_surface_integration.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/common/test_surface_integration.c b/tests/common/test_surface_integration.c
index 74c1574..662b26a 100644
--- a/tests/common/test_surface_integration.c
+++ b/tests/common/test_surface_integration.c
@@ -190,6 +190,18 @@ static void push(yasl_surface *s, struct yasl_private_event event)
event.surface = s;
assert(yasl_private_events_push(s->display, s, &event));
}
+/* Drains the queue; returns how many WINDOW events came, each of this pixel size. */
+static int windows_of(int pixel_width, int pixel_height)
+{
+ yasl_event e;
+ int n = 0;
+ while (yasl_wait_event(&e, 0) > 0)
+ if (e.type == YASL_EVENT_WINDOW) {
+ assert(e.window.pixel_width == pixel_width && e.window.pixel_height == pixel_height);
+ n++;
+ }
+ return n;
+}
static int refreshes;
/* Whether the display still lists the surface with this address; compared, never dereferenced. */
static bool listed(struct yasl_private_display *d, uintptr_t id)
@@ -210,8 +222,11 @@ static void refresh(yasl_surface *s)
assert(!yasl_surface_create(&options) && errno == EBUSY);
options.type = YASL_SURFACE_GL;
assert(!yasl_surface_create(&options) && errno == EBUSY);
+ /* The geometry being drawn is already current; its WINDOW event comes later. */
+ struct yasl_surface_info info = yasl_surface_get_info(s);
int w, h;
assert(yasl_cpu_pixels(s, &w, &h) && yasl_cpu_present(s) == 0);
+ assert(w == info.pixel_width && h == info.pixel_height);
}
int main(int argc, char **argv)
{
@@ -415,6 +430,22 @@ int main(int argc, char **argv)
#endif
s->refresh = NULL;
+ /* WINDOW events report the current geometry: resizes queued while the
+ * application was away fold into one, and a size it already has reports
+ * nothing. */
+ drain();
+ struct yasl_private_geometry real = {s->size, s->scale_120};
+ struct yasl_private_geometry wider = {{real.size.x + 8, real.size.y}, real.scale_120};
+ struct yasl_private_geometry larger = {{real.size.x + 16, real.size.y + 8}, real.scale_120};
+ yasl_private_surface_notify_configure(s, wider);
+ yasl_private_surface_notify_configure(s, larger);
+ assert(windows_of(larger.size.x, larger.size.y) == 1);
+ yasl_private_surface_notify_configure(s, wider);
+ yasl_private_surface_notify_configure(s, larger);
+ assert(windows_of(0, 0) == 0);
+ yasl_private_surface_notify_configure(s, real);
+ assert(windows_of(real.size.x, real.size.y) == 1);
+
/* Title and window requests: each either works or reports ENOTSUP. */
assert(yasl_surface_set_title(s, "CPU contract renamed") == 0);
/* Weston configures a minimized fullscreen window at 0 x 0, then rejects