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 # Test that changes to WM_CLASS are internally processed by i3 by updating the
18 # cached property and running assignments. This allows the property to be used
19 # in criteria selection
21 # Bug still in: 4.8-73-g6bf7f8e
22 use i3test i3_autostart => 0;
23 use X11::XCB qw(PROP_MODE_REPLACE);
27 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
28 for_window [class="Special"] mark special_class_mark
31 my $pid = launch_with_config($config);
33 sub change_window_class {
34 my ($window, $class) = @_;
35 my $atomname = $x->atom(name => 'WM_CLASS');
36 my $atomtype = $x->atom(name => 'STRING');
49 my $ws = fresh_workspace;
51 my $win = open_window;
53 change_window_class($win, "special\0Special");
55 my $con = @{get_ws_content($ws)}[0];
57 is($con->{window_properties}->{class}, 'Special',
58 'The container class should be updated when a window changes class');
60 is($con->{window_properties}->{instance}, 'special',
61 'The container instance should be updated when a window changes instance');
63 # The mark `special_class_mark` is added in a `for_window` assignment in the
64 # config for testing purposes
65 is($con->{mark}, 'special_class_mark',
66 'A `for_window` assignment should run for a match when the window changes class');
68 exit_gracefully($pid);