Testcase for non-null-terminated WM_CLASS.
- fails most of the time
This commit is contained in:
parent
9718640622
commit
e6267a684c
|
@ -31,16 +31,17 @@ EOT
|
||||||
my $pid = launch_with_config($config);
|
my $pid = launch_with_config($config);
|
||||||
|
|
||||||
sub change_window_class {
|
sub change_window_class {
|
||||||
my ($window, $class) = @_;
|
my ($window, $class, $length) = @_;
|
||||||
my $atomname = $x->atom(name => 'WM_CLASS');
|
my $atomname = $x->atom(name => 'WM_CLASS');
|
||||||
my $atomtype = $x->atom(name => 'STRING');
|
my $atomtype = $x->atom(name => 'STRING');
|
||||||
|
$length ||= length($class) + 1;
|
||||||
$x->change_property(
|
$x->change_property(
|
||||||
PROP_MODE_REPLACE,
|
PROP_MODE_REPLACE,
|
||||||
$window->id,
|
$window->id,
|
||||||
$atomname->id,
|
$atomname->id,
|
||||||
$atomtype->id,
|
$atomtype->id,
|
||||||
8,
|
8,
|
||||||
length($class) + 1,
|
$length,
|
||||||
$class
|
$class
|
||||||
);
|
);
|
||||||
sync_with_i3;
|
sync_with_i3;
|
||||||
|
@ -65,6 +66,13 @@ is($con->{window_properties}->{instance}, 'special',
|
||||||
is($con->{mark}, 'special_class_mark',
|
is($con->{mark}, 'special_class_mark',
|
||||||
'A `for_window` assignment should run for a match when the window changes class');
|
'A `for_window` assignment should run for a match when the window changes class');
|
||||||
|
|
||||||
|
change_window_class($win, "abcdefghijklmnopqrstuv\0abcd", 24);
|
||||||
|
|
||||||
|
$con = @{get_ws_content($ws)}[0];
|
||||||
|
|
||||||
|
is($con->{window_properties}->{class}, 'a',
|
||||||
|
'Non-null-terminated strings should be handled correctly');
|
||||||
|
|
||||||
exit_gracefully($pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
|
Loading…
Reference in New Issue