File: invoke.t

package info (click to toggle)
libtk-histentry-perl 0.45-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 120 kB
  • sloc: perl: 485; makefile: 4
file content (54 lines) | stat: -rw-r--r-- 1,043 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# -*- perl -*-

#
# Author: Slaven Rezic
#
# Copyright (C) 1997,1998,2008,2016 Slaven Rezic. All rights reserved.
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#
# Mail: eserte@cs.tu-berlin.de
# WWW:  http://user.cs.tu-berlin.de/~eserte/
#

use Tk;
my $top;
BEGIN {
    if (!eval { $top = new MainWindow }) {
	print "1..0 # skip cannot open DISPLAY\n";
	CORE::exit;
    }
    $top->geometry('+10+10'); # for twm
}

BEGIN { $^W = 1; $| = 1; $loaded = 0; $last = 3; print "1..$last\n"; }
END {print "not ok 1\n" unless $loaded;}

use Tk::HistEntry;
use strict;
use vars qw($loaded $last);

package main;

$loaded = 1;

my $ok = 1;
print "ok " . $ok++ . "\n";

use Tk;

my $he = $top->HistEntry(-command => sub { },
			 -limit => 1)->pack;
$he->invoke("aaa");
my(@h) = $he->history;
if (join(",", @h) ne "aaa") {
    print "not ";
}
print "ok " . $ok++ . "\n";

$he->invoke("bbb");
@h = $he->history;
if (join(",", @h) ne "bbb") {
    print "not ";
}
print "ok " . $ok++ . "\n";