tests: use wait_for_{map,unmap} to eliminate more sleep()s

This commit is contained in:
Michael Stapelberg 2011-09-24 13:08:02 +01:00
parent 4821b13cae
commit 4da5b7e784
15 changed files with 139 additions and 84 deletions

View File

@ -42,6 +42,7 @@ my $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => $original_rect,
background_color => '#C0C0C0',
event_mask => [ 'structure_notify' ],
);
isa_ok($window, 'X11::XCB::Window');
@ -50,7 +51,7 @@ is_deeply($window->rect, $original_rect, "rect unmodified before mapping");
$window->map;
sleep 0.25;
wait_for_map $x;
# open another container to make the window get only half of the screen
cmd 'open';
@ -92,6 +93,7 @@ $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => $original_rect,
background_color => 61440,
event_mask => [ 'structure_notify' ],
);
is_deeply($window->rect, $original_rect, "rect unmodified before mapping");
@ -99,7 +101,7 @@ is_deeply($window->rect, $original_rect, "rect unmodified before mapping");
$window->fullscreen(1);
$window->map;
sleep(0.25);
wait_for_map $x;
$new_rect = $window->rect;
ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned after fullscreen");
@ -122,10 +124,12 @@ my $swindow = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => $original_rect,
background_color => '#C0C0C0',
event_mask => [ 'structure_notify' ],
);
$swindow->map;
sleep 0.25;
sync_with_i3($x);
ok(!$swindow->mapped, 'window not mapped while fullscreen window active');

View File

@ -17,13 +17,14 @@ my $window = $x->root->create_child(
background_color => '#C0C0C0',
# replace the type with 'utility' as soon as the coercion works again in X11::XCB
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
event_mask => [ 'structure_notify' ],
);
isa_ok($window, 'X11::XCB::Window');
$window->map;
sleep 0.25;
wait_for_map $x;
my ($absolute, $top) = $window->rect;
@ -40,13 +41,14 @@ $window = $x->root->create_child(
rect => [ 1, 1, 80, 90],
background_color => '#C0C0C0',
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
event_mask => [ 'structure_notify' ],
);
isa_ok($window, 'X11::XCB::Window');
$window->map;
sleep 0.25;
wait_for_map $x;
($absolute, $top) = $window->rect;
@ -70,13 +72,14 @@ $window = $x->root->create_child(
rect => [ 1, 1, 80, 90],
background_color => '#C0C0C0',
#window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
event_mask => [ 'structure_notify' ],
);
isa_ok($window, 'X11::XCB::Window');
$window->map;
sleep 0.25;
wait_for_map $x;
cmd 'floating enable';

View File

@ -10,7 +10,6 @@ BEGIN {
}
my $x = X11::XCB::Connection->new;
my $i3 = i3(get_socket_path());
#####################################################################
# verify that there is no dock window yet
@ -36,11 +35,12 @@ my $window = $x->root->create_child(
rect => [ 0, 0, 30, 30],
background_color => '#FF0000',
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
event_mask => [ 'structure_notify' ],
);
$window->map;
sleep 0.25;
wait_for_map $x;
my $rect = $window->rect;
is($rect->width, $primary->rect->width, 'dock client is as wide as the screen');
@ -67,7 +67,7 @@ is($docknode->{rect}->{height}, 30, 'dock node has unchanged height');
$window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 50, height => 40));
sleep 0.25;
sync_with_i3 $x;
@docked = get_dock_clients('top');
is(@docked, 1, 'one dock client found');
@ -82,7 +82,7 @@ is($docknode->{rect}->{height}, 40, 'dock height changed');
$window->destroy;
sleep 0.25;
wait_for_unmap $x;
@docked = get_dock_clients();
is(@docked, 0, 'no more dock clients');
@ -96,11 +96,12 @@ $window = $x->root->create_child(
rect => [ 0, 1000, 30, 30],
background_color => '#FF0000',
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
event_mask => [ 'structure_notify' ],
);
$window->map;
sleep 0.25;
wait_for_map $x;
my $rect = $window->rect;
is($rect->width, $primary->rect->width, 'dock client is as wide as the screen');
@ -111,7 +112,7 @@ is(@docked, 1, 'dock client on bottom');
$window->destroy;
sleep 0.25;
wait_for_unmap $x;
@docked = get_dock_clients();
is(@docked, 0, 'no more dock clients');
@ -125,6 +126,7 @@ $window = $x->root->create_child(
rect => [ 0, 1000, 30, 30],
background_color => '#FF0000',
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
event_mask => [ 'structure_notify' ],
);
$window->_create();
@ -145,14 +147,14 @@ $x->change_property(
$window->map;
sleep 0.25;
wait_for_map $x;
@docked = get_dock_clients('top');
is(@docked, 1, 'dock client on top');
$window->destroy;
sleep 0.25;
wait_for_unmap $x;
@docked = get_dock_clients();
is(@docked, 0, 'no more dock clients');
@ -162,6 +164,7 @@ $window = $x->root->create_child(
rect => [ 0, 1000, 30, 30],
background_color => '#FF0000',
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
event_mask => [ 'structure_notify' ],
);
$window->_create();
@ -182,7 +185,7 @@ $x->change_property(
$window->map;
sleep 0.25;
wait_for_map $x;
@docked = get_dock_clients('bottom');
is(@docked, 1, 'dock client on bottom');
@ -199,12 +202,13 @@ my $fwindow = $x->root->create_child(
rect => [ 0, 0, 30, 30],
background_color => '#FF0000',
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
event_mask => [ 'structure_notify' ],
);
$fwindow->transient_for($window);
$fwindow->map;
sleep 0.25;
wait_for_map $x;
does_i3_live;

View File

@ -9,7 +9,6 @@ BEGIN {
}
my $x = X11::XCB::Connection->new;
my $i3 = i3(get_socket_path());
my $tmp = fresh_workspace;
@ -25,6 +24,7 @@ my $left = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [0, 0, 30, 30],
background_color => '#FF0000',
event_mask => [ 'structure_notify' ],
);
$left->name('Left');
@ -34,12 +34,14 @@ my $right = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [0, 0, 30, 30],
background_color => '#FF0000',
event_mask => [ 'structure_notify' ],
);
$right->name('Right');
$right->map;
sleep 0.25;
ok(wait_for_map($x), 'left window mapped');
ok(wait_for_map($x), 'right window mapped');
my ($abs, $rgeom) = $right->rect;
@ -48,13 +50,14 @@ my $child = $x->root->create_child(
rect => [ 0, 0, 30, 30 ],
background_color => '#C0C0C0',
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
event_mask => [ 'structure_notify' ],
);
$child->name('Child window');
$child->client_leader($right);
$child->map;
sleep 0.25;
ok(wait_for_map($x), 'child window mapped');
my $cgeom;
($abs, $cgeom) = $child->rect;
@ -65,13 +68,14 @@ my $child2 = $x->root->create_child(
rect => [ 0, 0, 30, 30 ],
background_color => '#C0C0C0',
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
event_mask => [ 'structure_notify' ],
);
$child2->name('Child window 2');
$child2->client_leader($left);
$child2->map;
sleep 0.25;
ok(wait_for_map($x), 'second child window mapped');
($abs, $cgeom) = $child2->rect;
cmp_ok(($cgeom->x + $cgeom->width), '<', $rgeom->x, 'child above left window');
@ -83,12 +87,13 @@ my $fwindow = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30],
background_color => '#FF0000',
event_mask => [ 'structure_notify' ],
);
$fwindow->transient_for($right);
$fwindow->map;
sleep 0.25;
ok(wait_for_map($x), 'transient window mapped');
my ($absolute, $top) = $fwindow->rect;
ok($absolute->{x} != 0 && $absolute->{y} != 0, 'i3 did not map it to (0x0)');
@ -101,15 +106,16 @@ SKIP: {
#####################################################################
my $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#C0C0C0',
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#C0C0C0',
event_mask => [ 'structure_notify' ],
);
$window->name('Parent window');
$window->map;
sleep 0.25;
ok(wait_for_map($x), 'parent window mapped');
#########################################################################
# Switch to a different workspace and open a child window. It should be opened
@ -118,16 +124,17 @@ sleep 0.25;
fresh_workspace;
my $child = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#C0C0C0',
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#C0C0C0',
event_mask => [ 'structure_notify' ],
);
$child->name('Child window');
$child->client_leader($window);
$child->map;
sleep 0.25;
ok(wait_for_map($x), 'child window mapped');
isnt($x->input_focus, $child->id, "Child window focused");

View File

@ -35,8 +35,7 @@ cmd 'nop now killing the window';
my $id = $win->{id};
cmd qq|[con_id="$id"] kill|;
# give i3 some time to pick up the UnmapNotify event
sleep 0.25;
wait_for_unmap $x;
cmd 'nop checking if its gone';
$content = get_ws_content($tmp);
@ -75,25 +74,27 @@ my $left = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#0000ff',
event_mask => [ 'structure_notify' ],
);
$left->_create;
set_wm_class($left->id, 'special', 'special');
$left->name('left');
$left->map;
sleep 0.25;
ok(wait_for_map($x), 'left window mapped');
my $right = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#0000ff',
event_mask => [ 'structure_notify' ],
);
$right->_create;
set_wm_class($right->id, 'special', 'special');
$right->name('right');
$right->map;
sleep 0.25;
ok(wait_for_map($x), 'right window mapped');
# two windows should be here
$content = get_ws_content($tmp);
@ -116,13 +117,14 @@ $left = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#0000ff',
event_mask => [ 'structure_notify' ],
);
$left->_create;
set_wm_class($left->id, 'special7', 'special7');
$left->name('left');
$left->map;
sleep 0.25;
ok(wait_for_map($x), 'left window mapped');
# two windows should be here
$content = get_ws_content($tmp);
@ -130,7 +132,7 @@ ok(@{$content} == 1, 'window opened');
cmd '[class="^special[0-9]$"] kill';
sleep 0.25;
wait_for_unmap $x;
$content = get_ws_content($tmp);
is(@{$content}, 0, 'window killed');
@ -145,13 +147,14 @@ $left = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#0000ff',
event_mask => [ 'structure_notify' ],
);
$left->_create;
set_wm_class($left->id, 'special7', 'special7');
$left->name('ä 3');
$left->map;
sleep 0.25;
ok(wait_for_map($x), 'left window mapped');
# two windows should be here
$content = get_ws_content($tmp);
@ -159,7 +162,7 @@ ok(@{$content} == 1, 'window opened');
cmd '[title="^\w [3]$"] kill';
sleep 0.25;
wait_for_unmap $x;
$content = get_ws_content($tmp);
is(@{$content}, 0, 'window killed');

View File

@ -5,8 +5,6 @@
#
use i3test;
my $i3 = i3(get_socket_path());
my $x = X11::XCB::Connection->new;
my $tmp = fresh_workspace;
@ -17,6 +15,7 @@ my $win = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30),
background_color => '#C0C0C0',
event_mask => [ 'structure_notify' ],
);
# XXX: we should check screen size. in screens with an AR of 2.0,
@ -28,7 +27,7 @@ $aspect->max_num(600);
$aspect->max_den(300);
$win->_create;
$win->map;
sleep 0.25;
wait_for_map $x;
$win->hints->aspect($aspect);
$x->flush;

View File

@ -31,11 +31,12 @@ my $window = $x->root->create_child(
rect => [ 0, 0, 30, 30],
background_color => '#FF0000',
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
event_mask => [ 'structure_notify' ],
);
$window->map;
sleep 0.25;
wait_for_map $x;
#####################################################################
# check that we can find it in the layout tree at the expected position
@ -69,7 +70,7 @@ is($docknode->{rect}->{height}, 30, 'dock node has unchanged height after restar
$window->destroy;
sleep 0.25;
wait_for_unmap $x;
@docked = get_dock_clients;
is(@docked, 0, 'no dock clients found');
@ -84,11 +85,12 @@ $window = $x->root->create_child(
rect => [ 0, 0, 30, 20],
background_color => '#00FF00',
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
event_mask => [ 'structure_notify' ],
);
$window->map;
sleep 0.25;
wait_for_map $x;
@docked = get_dock_clients;
is(@docked, 1, 'one dock client found');

View File

@ -15,13 +15,14 @@ my $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 400, 150],
background_color => '#C0C0C0',
event_mask => [ 'structure_notify' ],
);
isa_ok($window, 'X11::XCB::Window');
$window->map;
sleep 0.25;
wait_for_map $x;
my ($absolute, $top) = $window->rect;

View File

@ -11,7 +11,6 @@ BEGIN {
}
my $x = X11::XCB::Connection->new;
my $i3 = i3(get_socket_path());
my $tmp = fresh_workspace;
@ -33,11 +32,12 @@ my $first = $x->root->create_child(
rect => [ 0, 0, 30, 30],
background_color => '#FF0000',
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
event_mask => [ 'structure_notify' ],
);
$first->map;
sleep 0.25;
wait_for_map $x;
#####################################################################
# Open a second dock client
@ -48,11 +48,12 @@ my $second = $x->root->create_child(
rect => [ 0, 0, 30, 30],
background_color => '#FF0000',
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
event_mask => [ 'structure_notify' ],
);
$second->map;
sleep 0.25;
wait_for_map $x;
#####################################################################
# Kill the second dock client

View File

@ -12,7 +12,6 @@ BEGIN {
}
my $x = X11::XCB::Connection->new;
my $i3 = i3(get_socket_path());
my $tmp = fresh_workspace;
@ -24,11 +23,12 @@ my $first = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 200, 80],
background_color => '#FF0000',
event_mask => [ 'structure_notify' ],
);
$first->map;
sleep 0.25;
wait_for_map $x;
#####################################################################
# Open a second window with 300x90
@ -38,11 +38,12 @@ my $second = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 300, 90],
background_color => '#00FF00',
event_mask => [ 'structure_notify' ],
);
$second->map;
sleep 0.25;
wait_for_map $x;
#####################################################################
# Set the parent to floating

View File

@ -44,7 +44,19 @@ cmd 'fullscreen';
# Open a third window
#####################################################################
my $third = open_standard_window($x, '#0000ff');
#my $third = open_standard_window($x, '#0000ff');
my $third = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30 ),
background_color => '#0000ff',
event_mask => [ 'structure_notify' ],
);
$third->name('Third window');
$third->map;
sync_with_i3 $x;
diag("third = " . $third->id);

View File

@ -4,8 +4,6 @@
# Tests if WM_STATE is WM_STATE_NORMAL when mapped and WM_STATE_WITHDRAWN when
# unmapped.
#
use X11::XCB qw(:all);
use X11::XCB::Connection;
use i3test;
my $x = X11::XCB::Connection->new;
@ -18,6 +16,8 @@ sub two_windows {
my $first = open_standard_window($x);
my $second = open_standard_window($x);
sync_with_i3 $x;
is($x->input_focus, $second->id, 'second window focused');
ok(@{get_ws_content($tmp)} == 2, 'two containers opened');

View File

@ -32,18 +32,19 @@ my $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#00ff00',
event_mask => [ 'structure_notify' ],
);
$window->name('Border window');
$window->map;
sleep 0.25;
wait_for_map $x;
my @content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 1, 'one node on this workspace now');
is($content[0]->{border}, 'normal', 'normal border');
$window->unmap;
sleep 0.25;
wait_for_unmap $x;
my @content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 0, 'no more nodes');
@ -53,6 +54,7 @@ $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#00ff00',
event_mask => [ 'structure_notify' ],
);
$window->_create;
@ -79,14 +81,14 @@ sub set_wm_class {
set_wm_class($window->id, 'borderless', 'borderless');
$window->name('Borderless window');
$window->map;
sleep 0.25;
wait_for_map $x;
@content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 1, 'one node on this workspace now');
is($content[0]->{border}, 'none', 'no border');
$window->unmap;
sleep 0.25;
wait_for_unmap $x;
@content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 0, 'no more nodes');
@ -113,24 +115,25 @@ $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#00ff00',
event_mask => [ 'structure_notify' ],
);
$window->name('special title');
$window->map;
sleep 0.25;
wait_for_map $x;
@content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 1, 'one node on this workspace now');
is($content[0]->{border}, 'normal', 'normal border');
$window->name('special borderless title');
sleep 0.25;
sync_with_i3 $x;
@content = @{get_ws_content($tmp)};
is($content[0]->{border}, 'none', 'no border');
$window->name('special title');
sleep 0.25;
sync_with_i3 $x;
cmd 'border normal';
@ -138,13 +141,13 @@ cmd 'border normal';
is($content[0]->{border}, 'normal', 'border reset to normal');
$window->name('special borderless title');
sleep 0.25;
sync_with_i3 $x;
@content = @{get_ws_content($tmp)};
is($content[0]->{border}, 'normal', 'still normal border');
$window->unmap;
sleep 0.25;
wait_for_unmap $x;
@content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 0, 'no more nodes');
@ -172,11 +175,12 @@ $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#00ff00',
event_mask => [ 'structure_notify' ],
);
$window->name('special mark title');
$window->map;
sleep 0.25;
wait_for_map $x;
@content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 1, 'one node on this workspace now');
@ -215,6 +219,7 @@ $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#00ff00',
event_mask => [ 'structure_notify' ],
);
$window->_create;
@ -222,14 +227,14 @@ $window->_create;
set_wm_class($window->id, 'borderless', 'borderless');
$window->name('usethis');
$window->map;
sleep 0.25;
wait_for_map $x;
@content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 1, 'one node on this workspace now');
is($content[0]->{border}, 'none', 'no border');
$window->unmap;
sleep 0.25;
wait_for_unmap $x;
@content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 0, 'no nodes on this workspace now');
@ -237,7 +242,7 @@ cmp_ok(@content, '==', 0, 'no nodes on this workspace now');
set_wm_class($window->id, 'borderless', 'borderless');
$window->name('notthis');
$window->map;
sleep 0.25;
wait_for_map $x;
@content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 1, 'one node on this workspace now');
@ -264,6 +269,7 @@ $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#00ff00',
event_mask => [ 'structure_notify' ],
);
$window->_create;
@ -271,7 +277,7 @@ $window->_create;
set_wm_class($window->id, 'bar', 'foo');
$window->name('usethis');
$window->map;
sleep 0.25;
wait_for_map $x;
@content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 1, 'one node on this workspace now');
@ -298,6 +304,7 @@ $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#00ff00',
event_mask => [ 'structure_notify' ],
);
$window->_create;
@ -305,7 +312,7 @@ $window->_create;
set_wm_class($window->id, 'bar', 'foo');
$window->name('usethis');
$window->map;
sleep 0.25;
wait_for_map $x;
@content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 1, 'one node on this workspace now');
@ -334,6 +341,7 @@ $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#00ff00',
event_mask => [ 'structure_notify' ],
);
$window->_create;
@ -341,7 +349,7 @@ $window->_create;
set_wm_class($window->id, 'bar', 'foo');
$window->name('usethis');
$window->map;
sleep 0.25;
wait_for_map $x;
@content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 1, 'one node on this workspace now');
@ -370,6 +378,7 @@ $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#00ff00',
event_mask => [ 'structure_notify' ],
);
$window->_create;
@ -388,7 +397,7 @@ $x->change_property(
$window->name('usethis');
$window->map;
sleep 0.25;
wait_for_map $x;
@content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 1, 'one node on this workspace now');
@ -418,13 +427,14 @@ $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#00ff00',
event_mask => [ 'structure_notify' ],
);
$window->_create;
$window->name('usethis');
$window->map;
sleep 0.25;
wait_for_map $x;
@content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 1, 'one node on this workspace now');
@ -444,7 +454,7 @@ $x->change_property(
$x->flush;
sleep 0.25;
sync_with_i3 $x;
@content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 1, 'one node on this workspace now');

View File

@ -50,13 +50,14 @@ my $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#0000ff',
event_mask => [ 'structure_notify' ],
);
$window->_create;
set_wm_class($window->id, 'special', 'special');
$window->name('special window');
$window->map;
sleep 0.25;
wait_for_map $x;
ok(@{get_ws_content($tmp)} == 1, 'special window got managed to current (random) workspace');
@ -64,8 +65,6 @@ exit_gracefully($process->pid);
$window->destroy;
sleep 0.25;
#####################################################################
# start a window and see that it gets assigned to a formerly unused
# workspace
@ -89,13 +88,14 @@ my $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#0000ff',
event_mask => [ 'structure_notify' ],
);
$window->_create;
set_wm_class($window->id, 'special', 'special');
$window->name('special window');
$window->map;
sleep 0.25;
wait_for_map $x;
ok(@{get_ws_content($tmp)} == 0, 'still no containers');
ok("targetws" ~~ @{get_workspace_names()}, 'targetws exists');
@ -128,13 +128,18 @@ my $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#0000ff',
event_mask => [ 'structure_notify' ],
);
$window->_create;
set_wm_class($window->id, 'special', 'special');
$window->name('special window');
$window->map;
sleep 0.25;
# We use sync_with_i3 instead of wait_for_map here because i3 will not actually
# map the window -- it will be assigned to a different workspace and will only
# be mapped once you switch to that workspace
sync_with_i3 $x;
ok(@{get_ws_content($tmp)} == 0, 'still no containers');
ok(@{get_ws_content('targetws')} == 2, 'two containers on targetws');
@ -164,13 +169,14 @@ my $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#0000ff',
event_mask => [ 'structure_notify' ],
);
$window->_create;
set_wm_class($window->id, 'special', 'special');
$window->name('special window');
$window->map;
sleep 0.25;
wait_for_map $x;
my $content = get_ws($tmp);
ok(@{$content->{nodes}} == 0, 'no tiling cons');
@ -204,13 +210,14 @@ my $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#0000ff',
event_mask => [ 'structure_notify' ],
);
$window->_create;
set_wm_class($window->id, 'SPEcial', 'SPEcial');
$window->name('special window');
$window->map;
sleep 0.25;
wait_for_map $x;
my $content = get_ws($tmp);
ok(@{$content->{nodes}} == 0, 'no tiling cons');
@ -249,13 +256,14 @@ my $window = $x->root->create_child(
rect => [ 0, 0, 30, 30 ],
background_color => '#0000ff',
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
event_mask => [ 'structure_notify' ],
);
$window->_create;
set_wm_class($window->id, 'special', 'special');
$window->name('special window');
$window->map;
sleep 0.25;
wait_for_map $x;
my $content = get_ws($tmp);
ok(@{$content->{nodes}} == 0, 'no tiling cons');

View File

@ -6,8 +6,6 @@
#
use i3test;
use X11::XCB qw(:all);
use X11::XCB::Connection;
my $x = X11::XCB::Connection->new;
@ -84,11 +82,12 @@ $first = $x->root->create_child(
background_color => '#C0C0C0',
# replace the type with 'utility' as soon as the coercion works again in X11::XCB
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
event_mask => [ 'structure_notify' ],
);
$first->map;
sleep 0.25;
wait_for_map $x;
my $wscontent = get_ws($tmp);
my @floating = @{$wscontent->{floating_nodes}};
@ -123,11 +122,12 @@ $first = $x->root->create_child(
background_color => '#C0C0C0',
# replace the type with 'utility' as soon as the coercion works again in X11::XCB
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
event_mask => [ 'structure_notify' ],
);
$first->map;
sleep 0.25;
wait_for_map $x;
$wscontent = get_ws($tmp);
@floating = @{$wscontent->{floating_nodes}};