Small cleanups:

* Implement criterion specs just like it is done in the spec for the config
* Declare variables in test case early so the 'my' keyword can be dropped in the actual test cases
This commit is contained in:
Ingo Bürk 2015-04-19 10:47:09 +02:00
parent 761a8713df
commit 09d1deda7f
2 changed files with 14 additions and 12 deletions

View File

@ -46,10 +46,10 @@ state CRITERIA:
ctype = 'window_role' -> CRITERION ctype = 'window_role' -> CRITERION
ctype = 'con_id' -> CRITERION ctype = 'con_id' -> CRITERION
ctype = 'id' -> CRITERION ctype = 'id' -> CRITERION
ctype = 'window_type' -> CRITERION
ctype = 'con_mark' -> CRITERION ctype = 'con_mark' -> CRITERION
ctype = 'title' -> CRITERION ctype = 'title' -> CRITERION
ctype = 'urgent' -> CRITERION ctype = 'urgent' -> CRITERION
ctype = 'window_type' -> CRITERION
']' -> call cmd_criteria_match_windows(); INITIAL ']' -> call cmd_criteria_match_windows(); INITIAL
state CRITERION: state CRITERION:

View File

@ -18,21 +18,23 @@
# Bug still in: 4.8-16-g6888a1f # Bug still in: 4.8-16-g6888a1f
use i3test; use i3test;
my ($ws, $win1, $win2, $win3, $ws_con);
############################################################################### ###############################################################################
# Tets moving with 'id' criterion. # Tets moving with 'id' criterion.
############################################################################### ###############################################################################
my $ws = fresh_workspace; $ws = fresh_workspace;
my $win1 = open_window; $win1 = open_window;
my $win2 = open_window; $win2 = open_window;
my $win3 = open_window; $win3 = open_window;
# move win1 from the left to the right # move win1 from the left to the right
cmd '[id="' . $win1->{id} . '"] move right'; cmd '[id="' . $win1->{id} . '"] move right';
# now they should be switched, with win2 still being focused # now they should be switched, with win2 still being focused
my $ws_con = get_ws($ws); $ws_con = get_ws($ws);
# win2 should be on the left # win2 should be on the left
is($ws_con->{nodes}[0]->{window}, $win2->{id}, 'the `move [direction]` command should work with criteria'); is($ws_con->{nodes}[0]->{window}, $win2->{id}, 'the `move [direction]` command should work with criteria');