2 # vim:ts=4:sw=4:expandtab
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 # (alternatively: perldoc ./testcases/lib/i3test.pm)
11 # • http://build.i3wm.org/docs/ipc.html
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 # (unless you are already familiar with Perl)
17 # Tests for using X resources in the config.
19 use i3test i3_autostart => 0;
20 use X11::XCB qw(PROP_MODE_REPLACE);
23 return i3(get_socket_path())->get_marks->recv;
28 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
30 # This isn't necessarily what X resources are intended for, but it'll do the
32 set_from_resource \$mark i3wm.mark none
33 for_window [class=worksforme] mark \$mark
35 set_from_resource \$othermark i3wm.doesnotexist none
36 for_window [class=doesnotworkforme] mark \$othermark
42 $x->get_root_window(),
43 $x->atom(name => 'RESOURCE_MANAGER')->id,
44 $x->atom(name => 'STRING')->id,
46 length('*mark: works'),
50 my $pid = launch_with_config($config);
52 open_window(wm_class => 'worksforme');
54 is_deeply(get_marks(), [ 'works' ], 'the resource has loaded correctly');
58 open_window(wm_class => 'doesnotworkforme');
60 is_deeply(get_marks(), [ 'none' ], 'the resource fallback was used');
62 exit_gracefully($pid);