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

@ -6,7 +6,7 @@
# assigned to an invisible workspace
#
use i3test;
use X11::XCB qw(PROP_MODE_REPLACE WINDOW_CLASS_INPUT_OUTPUT);
use X11::XCB qw(PROP_MODE_REPLACE);
# TODO: move to X11::XCB
sub set_wm_class {
@ -27,6 +27,16 @@ sub set_wm_class {
);
}
sub open_special {
my %args = @_;
my $wm_class = delete($args{wm_class}) || 'special';
$args{name} //= 'special window';
return open_window(
%args,
before_map => sub { set_wm_class($_->id, $wm_class, $wm_class) },
);
}
#####################################################################
# start a window and see that it does not get assigned with an empty config
@ -45,18 +55,7 @@ my $tmp = fresh_workspace;
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
ok(get_ws($tmp)->{focused}, 'current workspace focused');
my $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#0000ff',
);
$window->_create;
set_wm_class($window->id, 'special', 'special');
$window->name('special window');
$window->map;
sleep 0.25;
my $window = open_special;
ok(@{get_ws_content($tmp)} == 0, 'special window not on current workspace');
ok(@{get_ws_content('targetws')} == 1, 'special window on targetws');
@ -66,20 +65,10 @@ ok(get_ws($tmp)->{focused}, 'current workspace still focused');
# the same test, but with a floating window
#####################################################################
$window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#0000ff',
$window = open_special(
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
);
$window->_create;
set_wm_class($window->id, 'special', 'special');
$window->name('special window');
$window->map;
sleep 0.25;
ok(@{get_ws_content($tmp)} == 0, 'special window not on current workspace');
ok(@{get_ws_content('targetws')} == 1, 'special window on targetws');
ok(get_ws($tmp)->{focused}, 'current workspace still focused');