X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=testcases%2Ft%2F119-match.t;h=e6a4e832fdb3daa2a7da0d7abe565d68c9cba049;hb=6f8b2845863e9071d7d630b270729d46423c1eb5;hp=e2e553f439b372c52cabcf3ee5c579c7a47bec1a;hpb=fce7570f961bcb373e1ac0965bb3ed41747e0d3b;p=i3%2Fi3 diff --git a/testcases/t/119-match.t b/testcases/t/119-match.t index e2e553f4..e6a4e832 100644 --- a/testcases/t/119-match.t +++ b/testcases/t/119-match.t @@ -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' ], -); - -$left->_create; -set_wm_class($left->id, 'special', 'special'); -$left->name('left'); -$left->map; -ok(wait_for_map($left), '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; -ok(wait_for_map($right), 'right window mapped'); +sub open_special { + my %args = @_; + my $wm_class = delete($args{wm_class}) || 'special'; + + return open_window( + %args, + before_map => sub { set_wm_class($_->id, $wm_class, $wm_class) }, + ); +} + +my $left = open_special(name => 'left'); +ok($left->mapped, 'left window mapped'); + +my $right = open_special(name => 'right'); +ok($right->mapped, 'right window mapped'); # two windows should be here $content = get_ws_content($tmp); @@ -101,7 +91,7 @@ ok(@{$content} == 2, 'two windows opened'); cmd '[class="special" title="left"] kill'; -sync_with_i3($x); +sync_with_i3; $content = get_ws_content($tmp); is(@{$content}, 1, 'one window still there'); @@ -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);