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
|
#!/usr/bin/perl -w
#
# Make sure the VT102 module can set its size OK.
#
# Copyright (C) Andrew Wood
# NO WARRANTY - see COPYING.
#
require Term::VT102;
@testsizes = (
1, 1,
80, 24,
0, 0,
-1000, -1000,
1000, 1000
);
$nt = ($#testsizes + 1) / 2; # number of sub-tests
foreach $i (1 .. $nt) {
print "$i..$nt\n";
$cols = shift @testsizes;
$rows = shift @testsizes;
my $vt = Term::VT102->new ('cols' => $cols, 'rows' => $rows);
($ncols, $nrows) = $vt->size ();
$cols = 80 if ($cols < 1);
$rows = 24 if ($rows < 1);
if (($cols != $ncols) or ($rows != $nrows)) {
print "not ok $i\n";
warn "returned size: $ncols x $nrows, wanted $cols x $rows\n";
} else {
print "ok $i\n";
}
}
# EOF
|