533-randr15.t: Stop hard-coding the output name

Refactor away all mentions of DP3.
This commit is contained in:
Vladimir Panteleev 2017-09-12 08:50:40 +00:00
parent 8a0e5f89f9
commit fbeded23a9
No known key found for this signature in database
GPG Key ID: 5004F0FAD051576D
1 changed files with 8 additions and 7 deletions

View File

@ -42,13 +42,14 @@ 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 $atom_cookie = $x->intern_atom(0, length("DP3"), "DP3"); my $monitor_name = 'i3-fake-monitor';
my $DP3 = $x->intern_atom_reply($atom_cookie->{sequence})->{atom}; my $atom_cookie = $x->intern_atom(0, length($monitor_name), $monitor_name);
my $monitor_name_atom = $x->intern_atom_reply($atom_cookie->{sequence})->{atom};
# MONITORINFO is defined in A.1.1 in # MONITORINFO is defined in A.1.1 in
# https://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt # https://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt
my $monitor1 = pack('LccSssSSLLL', my $monitor1 = pack('LccSssSSLLL',
$DP3, # name (ATOM) $monitor_name_atom, # name (ATOM)
1, # primary 1, # primary
1, # automatic 1, # automatic
1, # ncrtcs 1, # ncrtcs
@ -89,15 +90,15 @@ my $pid = launch_with_config($config,
my $tree = i3->get_tree->recv; my $tree = i3->get_tree->recv;
my @outputs = map { $_->{name} } @{$tree->{nodes}}; my @outputs = map { $_->{name} } @{$tree->{nodes}};
is_deeply(\@outputs, [ '__i3', 'DP3' ], 'outputs are __i3 and DP3'); is_deeply(\@outputs, [ '__i3', $monitor_name ], 'outputs are __i3 and the fake monitor');
my ($dp3) = grep { $_->{name} eq 'DP3' } @{$tree->{nodes}}; my ($output_data) = grep { $_->{name} eq $monitor_name } @{$tree->{nodes}};
is_deeply($dp3->{rect}, { is_deeply($output_data->{rect}, {
width => 3840, width => 3840,
height => 2160, height => 2160,
x => 0, x => 0,
y => 0, y => 0,
}, 'Output DP3 at 3840x2160+0+0'); }, "Fake output at 3840x2160+0+0");
exit_gracefully($pid); exit_gracefully($pid);