]> git.sur5r.net Git - i3/i3/blobdiff - testcases/lib/i3test.pm
testcases: let i3test.pm export $x, adapt testcases
[i3/i3] / testcases / lib / i3test.pm
index ad598b846ccbf87a0ff3eadbd6bfc49d2aa42a6c..f5cb0602cd33e5e45f6a826a289c9efdabdef836 100644 (file)
@@ -39,6 +39,7 @@ our @EXPORT = qw(
     wait_for_event
     wait_for_map
     wait_for_unmap
+    $x
 );
 
 my $tester = Test::Builder->new();
@@ -46,6 +47,8 @@ my $_cached_socket_path = undef;
 my $_sync_window = undef;
 my $tmp_socket_path = undef;
 
+our $x;
+
 BEGIN {
     my $window_count = 0;
     sub counter_window {
@@ -72,6 +75,7 @@ __
     strict->import;
     warnings->import;
 
+    $x ||= i3test::X11->new;
     @_ = ($class);
     goto \&Exporter::import;
 }
@@ -404,7 +408,6 @@ sub get_socket_path {
         return $_cached_socket_path;
     }
 
-    my $x = X11::XCB::Connection->new;
     my $atom = $x->atom(name => 'I3_SOCKET_PATH');
     my $cookie = $x->get_property(0, $x->get_root_window(), $atom->id, GET_PROPERTY_TYPE_ANY, 0, 256);
     my $reply = $x->get_property_reply($cookie->{sequence});