File: hierarchy.t

package info (click to toggle)
libx11-windowhierarchy-perl 0.004-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 164 kB
  • sloc: perl: 275; makefile: 4
file content (18 lines) | stat: -rw-r--r-- 747 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use strict;
use warnings;
use Test::More;
use X11::WindowHierarchy;

plan skip_all => 'Set $ENV{DISPLAY} to run this test' unless length $ENV{DISPLAY};

plan tests => 6;

# This is all pretty basic, maybe we should try starting up a few things with known
# names / pids so we can check in more detail?
ok(my $tree = x11_hierarchy(), 'can get hierarchy');
is(ref $tree, 'HASH', 'is a hashref');
ok(exists $tree->{children}, 'has arrayref of children');

is(x11_filter_hierarchy(filter => sub { 0 }), 0, 'no windows with false coderef filter');
ok(eval { x11_filter_hierarchy(filter => sub { 1 }); 1 }, 'no exception raised with true coderef filter');
ok(eval { x11_filter_hierarchy(filter => qr/\w/); 1 }, 'no exception raised with regex filter');