File: test.pl

package info (click to toggle)
libx11-keyboard-perl 1.4-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 68 kB
  • sloc: perl: 58; makefile: 6
file content (28 lines) | stat: -rw-r--r-- 703 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/perl

#	test suite

use Test::Simple tests => 8;

use X11::Protocol;
$x = X11::Protocol->new();
ok(defined $x && $x->isa('X11::Protocol'), "connection established");

use X11::Keyboard;
ok(1, 'use X11::Keyboard');

$k = X11::Keyboard->new($x);
ok(defined $k && $k->isa('X11::Keyboard'), "component instantiated");

$keysym = $k->StringToKeysym("plus");
ok($keysym, "string converted");
$keycode = $k->KeysymToKeycode($keysym);
ok($keycode, "keycode generated");
@keycode = $k->KeysymToKeycode($keysym);
ok($keycode[1], "state generated");

# or, more simply
$keycode2 = $k->KeysymToKeycode("plus");

ok($keycode == $keycode2 && $keycode == $keycode[0], "keycode translation");
ok(1, "done");