testcases: use open_window everywhere

This commit is contained in:
Maik Fischer
2011-11-23 17:22:43 +01:00
committed by Michael Stapelberg
parent ec877f2ec4
commit 475dc3c532
11 changed files with 104 additions and 352 deletions

View File

@ -4,7 +4,7 @@
# Tests all kinds of matching methods
#
use i3test;
use X11::XCB qw(PROP_MODE_REPLACE WINDOW_CLASS_INPUT_OUTPUT);
use X11::XCB qw(PROP_MODE_REPLACE);
my $tmp = fresh_workspace;
@ -69,31 +69,21 @@ sub set_wm_class {
);
}
my $left = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#0000ff',
event_mask => [ 'structure_notify' ],
);
sub open_special {
my %args = @_;
my $wm_class = delete($args{wm_class}) || 'special';
$left->_create;
set_wm_class($left->id, 'special', 'special');
$left->name('left');
$left->map;
ok(wait_for_map($left), 'left window mapped');
return open_window(
%args,
before_map => sub { set_wm_class($_->id, $wm_class, $wm_class) },
);
}
my $right = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#0000ff',
event_mask => [ 'structure_notify' ],
);
my $left = open_special(name => 'left');
ok($left->mapped, 'left window mapped');
$right->_create;
set_wm_class($right->id, 'special', 'special');
$right->name('right');
$right->map;
ok(wait_for_map($right), 'right window mapped');
my $right = open_special(name => 'right');
ok($right->mapped, 'right window mapped');
# two windows should be here
$content = get_ws_content($tmp);
@ -112,18 +102,8 @@ is(@{$content}, 1, 'one window still there');
$tmp = fresh_workspace;
$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;
ok(wait_for_map($left), 'left window mapped');
$left = open_special(name => 'left', wm_class => 'special7');
ok($left->mapped, 'left window mapped');
# two windows should be here
$content = get_ws_content($tmp);
@ -142,18 +122,8 @@ is(@{$content}, 0, 'window killed');
$tmp = fresh_workspace;
$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;
ok(wait_for_map($left), 'left window mapped');
$left = open_special(name => 'ä 3', wm_class => 'special7');
ok($left->mapped, 'left window mapped');
# two windows should be here
$content = get_ws_content($tmp);