From 6856b232d69cf676375df3e128955b72056e500a Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Thu, 27 Dec 2012 18:02:23 +0100 Subject: [PATCH 1/1] t/175-startup-notification: use the testcases X11 connection This needs X11::XCB >= 0.07 and will be skipped if that is not installed. This fixes a race condition in the testsuite. --- testcases/t/175-startup-notification.t | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/testcases/t/175-startup-notification.t b/testcases/t/175-startup-notification.t index 7160399d..ee285ff7 100644 --- a/testcases/t/175-startup-notification.t +++ b/testcases/t/175-startup-notification.t @@ -21,6 +21,10 @@ use i3test; use POSIX qw(mkfifo); use File::Temp qw(:POSIX); +SKIP: { + + skip "X11::XCB too old (need >= 0.07)", 24 if $X11::XCB::VERSION < 0.07; + use ExtUtils::PkgConfig; # setup dependency on libstartup-notification using pkg-config @@ -42,16 +46,10 @@ static SnDisplay *sndisplay; static SnLauncheeContext *ctx; static xcb_connection_t *conn; -// TODO: this should use $x -void init_ctx() { - int screen; - if ((conn = xcb_connect(NULL, &screen)) == NULL || - xcb_connection_has_error(conn)) - errx(1, "x11 conn failed"); - - printf("screen = %d\n", screen); +void init_ctx(void *connptr) { + conn = (xcb_connection_t*)connptr; sndisplay = sn_xcb_display_new(conn, NULL, NULL); - ctx = sn_launchee_context_new_from_environment(sndisplay, screen); + ctx = sn_launchee_context_new_from_environment(sndisplay, 0); } const char *get_startup_id() { @@ -101,7 +99,7 @@ isnt($startup_id, '', 'startup_id not empty'); $ENV{DESKTOP_STARTUP_ID} = $startup_id; # Create a new libstartup-notification launchee context -init_ctx(); +init_ctx($x->get_xcb_conn()); # Make sure the context was set up successfully is(get_startup_id(), $startup_id, 'libstartup-notification returns the same id'); @@ -211,5 +209,6 @@ close($fh); unlink($tmp); is($startup_id, '', 'startup_id empty'); +} done_testing; -- 2.39.2