1# -*- perl -*- 2 3# 4# Author: Slaven Rezic 5# 6# Copyright (C) 1997,1998,2008,2016 Slaven Rezic. All rights reserved. 7# This program is free software; you can redistribute it and/or 8# modify it under the same terms as Perl itself. 9# 10# Mail: eserte@cs.tu-berlin.de 11# WWW: http://user.cs.tu-berlin.de/~eserte/ 12# 13 14use Tk; 15my $top; 16BEGIN { 17 if (!eval { $top = new MainWindow }) { 18 print "1..0 # skip cannot open DISPLAY\n"; 19 CORE::exit; 20 } 21 $top->geometry('+10+10'); # for twm 22} 23 24BEGIN { $^W = 1; $| = 1; $loaded = 0; $last = 3; print "1..$last\n"; } 25END {print "not ok 1\n" unless $loaded;} 26 27use Tk::HistEntry; 28use strict; 29use vars qw($loaded $last); 30 31package main; 32 33$loaded = 1; 34 35my $ok = 1; 36print "ok " . $ok++ . "\n"; 37 38use Tk; 39 40my $he = $top->HistEntry(-command => sub { }, 41 -limit => 1)->pack; 42$he->invoke("aaa"); 43my(@h) = $he->history; 44if (join(",", @h) ne "aaa") { 45 print "not "; 46} 47print "ok " . $ok++ . "\n"; 48 49$he->invoke("bbb"); 50@h = $he->history; 51if (join(",", @h) ne "bbb") { 52 print "not "; 53} 54print "ok " . $ok++ . "\n"; 55