533-randr15.t: Add test for bar output name canonicalization

This commit is contained in:
Vladimir Panteleev 2017-09-12 09:18:40 +00:00 committed by Michael Stapelberg
parent fb1d9efb27
commit 92ff6fbe24
1 changed files with 17 additions and 2 deletions

View File

@ -20,10 +20,16 @@
use File::Temp qw(tempfile); use File::Temp qw(tempfile);
use i3test i3_autostart => 0; use i3test i3_autostart => 0;
my $monitor_name = 'i3-fake-monitor';
my $output_name = 'i3-fake-output';
my $config = <<EOT; my $config = <<EOT;
# i3 config file (v4) # i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
bar {
output $output_name
}
EOT EOT
my ($outfh, $outname) = tempfile('i3-randr15reply-XXXXXX', UNLINK => 1); my ($outfh, $outname) = tempfile('i3-randr15reply-XXXXXX', UNLINK => 1);
@ -42,7 +48,6 @@ my $reply = pack('cxSLLLLx[LLL]',
# Manually intern _NET_CURRENT_DESKTOP as $x->atom will not create atoms if # Manually intern _NET_CURRENT_DESKTOP as $x->atom will not create atoms if
# they are not yet interned. # they are not yet interned.
my $monitor_name = 'i3-fake-monitor';
my $atom_cookie = $x->intern_atom(0, length($monitor_name), $monitor_name); my $atom_cookie = $x->intern_atom(0, length($monitor_name), $monitor_name);
my $monitor_name_atom = $x->intern_atom_reply($atom_cookie->{sequence})->{atom}; my $monitor_name_atom = $x->intern_atom_reply($atom_cookie->{sequence})->{atom};
@ -68,7 +73,6 @@ close($outfh);
# Prepare a RRGetOutputInfo reply as well; see RRGetOutputInfo in # Prepare a RRGetOutputInfo reply as well; see RRGetOutputInfo in
# https://www.x.org/releases/current/doc/randrproto/randrproto.txt # https://www.x.org/releases/current/doc/randrproto/randrproto.txt
my $output_name = 'i3-fake-output';
($outfh, my $outname_moninfo) = tempfile('i3-randr15reply-XXXXXX', UNLINK => 1); ($outfh, my $outname_moninfo) = tempfile('i3-randr15reply-XXXXXX', UNLINK => 1);
my $moninfo = pack('cxSLLLx[LLccSSSS]S a* x!4', my $moninfo = pack('cxSLLLx[LLccSSSS]S a* x!4',
1, # reply 1, # reply
@ -100,6 +104,17 @@ is_deeply($output_data->{rect}, {
y => 0, y => 0,
}, "Fake output at 3840x2160+0+0"); }, "Fake output at 3840x2160+0+0");
# Verify that i3 canonicalizes RandR output names to i3 output names
# (RandR monitor names) for bar configs
my $bars = i3->get_bar_config()->recv;
is(@$bars, 1, 'one bar configured');
my $bar_id = shift @$bars;
my $bar_config = i3->get_bar_config($bar_id)->recv;
is_deeply($bar_config->{outputs}, [ $monitor_name ], 'bar_config output name is normalized');
exit_gracefully($pid); exit_gracefully($pid);
################################################################################ ################################################################################