i3 Perl documentation
NAME
i3test::Test - Additional test instructions for use in i3 testcases
SYNOPSIS
use i3test; my $ws = fresh_workspace; is_num_children($ws, 0, 'no containers on this workspace yet'); cmd 'open'; is_num_children($ws, 1, 'one container after "open"'); done_testing;
DESCRIPTION
This module provides convenience methods for i3 testcases. If you notice that a certain pattern is present in 5 or more test cases, it should most likely be moved into this module.
EXPORT
is_num_children($workspace, $expected, $test_name)
Gets the number of children on the given workspace and verifies that they match the expected amount of children.
is_num_children('1', 0, 'no containers on workspace 1 at startup');
cmp_float($a, $b)
Compares floating point numbers $a
and $b
and returns true if they differ less then 1e-6.
$tmp = fresh_workspace; open_window for (1..4); cmd 'resize grow width 10 px or 25 ppt'; ($nodes, $focus) = get_ws_content($tmp); ok(cmp_float($nodes->[0]->{percent}, 0.166666666666667), 'first window got 16%'); ok(cmp_float($nodes->[1]->{percent}, 0.166666666666667), 'second window got 16%'); ok(cmp_float($nodes->[2]->{percent}, 0.166666666666667), 'third window got 16%'); ok(cmp_float($nodes->[3]->{percent}, 0.50), 'fourth window got 50%');
does_i3_live
Returns true if the layout tree can still be received from i3.
# i3 used to crash on invalid commands in revision X cmd 'invalid command'; does_i3_live;
AUTHOR
Michael Stapelberg <michael@i3wm.org>