| 1 |
use strict; |
| 2 |
use Test::More; |
| 3 |
use Tk; |
| 4 |
plan tests => 7; |
| 5 |
my $var = 'One'; |
| 6 |
my $mw = MainWindow->new; |
| 7 |
my $e = $mw->Entry(-textvariable => \$var)->pack; |
| 8 |
is($e->get,$var,"Entry initialized from variable"); |
| 9 |
$e->delete(0,'end'); |
| 10 |
is($var,'',"Delete changes variable"); |
| 11 |
$e->insert(0,'Two'); |
| 12 |
is($var,'Two',"Insert changes variable"); |
| 13 |
$var = 'Three'; |
| 14 |
is($e->get,$var,"Entry tracks variable assignment"); |
| 15 |
chop($var); |
| 16 |
is($e->get,'Thre',"Entry tracks chop-ing variable"); |
| 17 |
|
| 18 |
my $nv; |
| 19 |
$mw->Entry(-textvariable => \$nv); |
| 20 |
$nv = 3/2; |
| 21 |
is($nv, 3/2, "IV does not override NV"); |
| 22 |
|
| 23 |
my $pv_chop = 421; |
| 24 |
chop($pv_chop); |
| 25 |
$mw->Entry(-textvariable => \$pv_chop); |
| 26 |
is($pv_chop, "42", "PV flag set"); |
| 27 |
|
| 28 |
__END__ |