| 1 |
use Tk; |
| 2 |
## Be optimistic, run the test everywhere. |
| 3 |
## It won't fail if fonts are missing, just |
| 4 |
## empty lines will be shown. |
| 5 |
# use Tk::Config (); |
| 6 |
# use Encode qw(FB_CROAK); |
| 7 |
# BEGIN |
| 8 |
# { |
| 9 |
# my $Xft = $Tk::Config::xlib =~ /-lXft\b/; |
| 10 |
# if (!$Xft) # assume we have CJK charsets with ttf fonts available |
| 11 |
# { |
| 12 |
# my $enc = Tk::SystemEncoding(); |
| 13 |
# eval { $enc->encode("\x{30C8}",FB_CROAK) }; |
| 14 |
# if ($@) |
| 15 |
# { |
| 16 |
# my $err = "$@"; |
| 17 |
# print "1..0 # Skipped: locale's '",$enc->name,"' cannot represent Japanese.\n"; |
| 18 |
# CORE::exit(0); |
| 19 |
# } |
| 20 |
# } |
| 21 |
# } |
| 22 |
use Test::More (tests => 294); |
| 23 |
use Tk::widgets qw(Text); |
| 24 |
my $mw = MainWindow->new; |
| 25 |
$mw->geometry("+10+10"); |
| 26 |
#my $font = 'Times'; |
| 27 |
my $font = 'fixed'; |
| 28 |
$font = shift(@ARGV) if @ARGV; |
| 29 |
my $t = $mw->Scrolled(Text => -font => [$font => 12, 'normal'])->pack( -fill => 'both', -expand => 1); |
| 30 |
my $file = __FILE__; |
| 31 |
$file =~ s/\.t$/.dat/; |
| 32 |
open(my $fh,"<:utf8",$file) || die "Cannot open $file:$!"; |
| 33 |
while (<$fh>) |
| 34 |
{ |
| 35 |
# s/[^ -~\s]/?/g; |
| 36 |
$t->insert('end',$_); |
| 37 |
$t->see('end'); |
| 38 |
$mw->update; |
| 39 |
ok(1); |
| 40 |
} |
| 41 |
close($fh); |
| 42 |
$mw->after(100,[ destroy => $mw ]); |
| 43 |
MainLoop; |