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 that _NET_WM_VISIBLE_NAME is set correctly.
20 use X11::XCB qw(:all);
24 sub get_visible_name {
28 my $cookie = $x->get_property(
31 $x->atom(name => '_NET_WM_VISIBLE_NAME')->id,
32 $x->atom(name => 'UTF8_STRING')->id,
37 my $reply = $x->get_property_reply($cookie->{sequence});
38 return undef if $reply->{value_len} == 0;
39 return $reply->{value};
42 ###############################################################################
43 # 1: _NET_WM_VISIBLE_NAME is set when the title format of a window is changed.
44 ###############################################################################
47 $con = open_window(name => 'boring title');
48 is(get_visible_name($con), undef, 'sanity check: initially no visible name is set');
50 cmd 'title_format custom';
51 is(get_visible_name($con), 'custom', 'the visible name is updated');
53 cmd 'title_format "<s>%title</s>"';
54 is(get_visible_name($con), '<s>boring title</s>', 'markup is returned as is');
56 ###############################################################################
57 # 2: _NET_WM_VISIBLE_NAME is removed if not needed.
58 ###############################################################################
61 $con = open_window(name => 'boring title');
62 cmd 'title_format custom';
63 is(get_visible_name($con), 'custom', 'sanity check: a visible name is set');
65 cmd 'title_format %title';
66 is(get_visible_name($con), undef, 'the visible name is removed again');
68 ###############################################################################