1use 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# } 22use Test::More (tests => 294); 23use Tk::widgets qw(Text); 24my $mw = MainWindow->new; 25$mw->geometry("+10+10"); 26#my $font = 'Times'; 27my $font = 'fixed'; 28$font = shift(@ARGV) if @ARGV; 29my $t = $mw->Scrolled(Text => -font => [$font => 12, 'normal'])->pack( -fill => 'both', -expand => 1); 30my $file = __FILE__; 31$file =~ s/\.t$/.dat/; 32open(my $fh,"<:utf8",$file) || die "Cannot open $file:$!"; 33while (<$fh>) 34 { 35 # s/[^ -~\s]/?/g; 36 $t->insert('end',$_); 37 $t->see('end'); 38 $mw->update; 39 ok(1); 40 } 41close($fh); 42$mw->after(100,[ destroy => $mw ]); 43MainLoop; 44