summaryrefslogtreecommitdiff
path: root/tests/common
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-16 13:23:25 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-16 13:23:25 +0300
commit12d2735115528d741ebf47b6738c88b7c182b85b (patch)
tree8678b6ba956cffede1628dfab554cbe8bc322643 /tests/common
parenta075a2941f8fcdae155495da634cf63368c950b7 (diff)
Leave fullscreen before minimizing in the request test
Weston 15 configures a minimized fullscreen window at 0 x 0 and then rejects every frame with a protocol error. The test sent fullscreen, maximize and minimize in one burst, so it failed whenever a frame landed after that configure. It now waits for the window to enter and leave fullscreen before it maximizes and minimizes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/common')
-rw-r--r--tests/common/test_surface_integration.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/common/test_surface_integration.c b/tests/common/test_surface_integration.c
index 6946cf9..74c1574 100644
--- a/tests/common/test_surface_integration.c
+++ b/tests/common/test_surface_integration.c
@@ -17,6 +17,17 @@ static void drain(void)
while (yasl_wait_event(&e, 0) > 0)
assert(++n < 1000);
}
+/* Waits up to 2 s for the window to enter or leave fullscreen; a system that
+ * ignores the request leaves it as it is. */
+static void wait_fullscreen(yasl_surface *s, bool want)
+{
+ uint64_t deadline = yasl_time_ns() + 2000000000ull;
+ while (((yasl_surface_get_info(s).state & YASL_STATE_FULLSCREEN) != 0) != want &&
+ yasl_time_ns() < deadline) {
+ yasl_event e;
+ assert(yasl_wait_event(&e, 20) >= 0);
+ }
+}
static void *wake_thread(void *unused)
{
(void)unused;
@@ -406,11 +417,19 @@ int main(int argc, char **argv)
/* Title and window requests: each either works or reports ENOTSUP. */
assert(yasl_surface_set_title(s, "CPU contract renamed") == 0);
- static const enum yasl_request requests[] = {YASL_REQUEST_RESTORE, YASL_REQUEST_FULLSCREEN,
- YASL_REQUEST_MAXIMIZE, YASL_REQUEST_MINIMIZE};
+ /* Weston configures a minimized fullscreen window at 0 x 0, then rejects
+ * every frame, so the window leaves fullscreen before it minimizes. */
+ int fullscreen = yasl_surface_request(s, YASL_REQUEST_FULLSCREEN);
+ assert(fullscreen == 0 || fullscreen == -ENOTSUP);
+ if (fullscreen == 0)
+ wait_fullscreen(s, true);
+ static const enum yasl_request requests[] = {YASL_REQUEST_RESTORE, YASL_REQUEST_MAXIMIZE,
+ YASL_REQUEST_MINIMIZE};
for (size_t i = 0; i < sizeof requests / sizeof requests[0]; i++) {
int r = yasl_surface_request(s, requests[i]);
assert(r == 0 || r == -ENOTSUP);
+ if (i == 0 && r == 0)
+ wait_fullscreen(s, false);
}
drain();
int restored = yasl_surface_request(s, YASL_REQUEST_RESTORE);