6 use Tests_Helper qw(in_frame);
7 use Test::More 'tests' => 12;
8 use encoding qw(iso-8859-1);
9 use Encode qw(is_utf8);
14 my $unicode = "\x{1234}";
16 # needs to be upgraded to characters because wxPerl converts
17 # based upon the current locale, which might not be Latin-1
18 utf8::upgrade( $latin1 ); # safe beacuse it's latin1
24 my $label = Wx::StaticText->new( $self, -1, $ascii );
25 is( $label->GetLabel, $ascii );
27 $label->SetLabel( $ascii2 );
28 is( $label->GetLabel, $ascii2 );
31 skip "Only meaningful in ANSI mode", 4
34 # it would be better to use the latin1 label, but it might
35 # not round trip if the GUI locale is not latin1
36 $label->SetLabel( $ascii );
38 Wx::SetAlwaysUTF8( 1 );
39 is( $label->GetLabel, $ascii );
40 ok( is_utf8( $label->GetLabel ) );
42 Wx::SetAlwaysUTF8( 0 );
43 is( $label->GetLabel, $ascii );
44 ok( !is_utf8( $label->GetLabel ) );
48 skip "Unicode support needed for the tests", 6
50 skip "wrongly asserts under 2.5.x", 6
51 if Wx::wxVERSION < 2.006;
53 $label->SetLabel( $latin1 );
54 is( $label->GetLabel, $latin1 );
56 ok( is_utf8( $latin1 ) );
57 ok( is_utf8( $label->GetLabel ) );
59 $label->SetLabel( $unicode );
60 is( $label->GetLabel, $unicode );
62 ok( is_utf8( $unicode ) );
63 ok( is_utf8( $label->GetLabel ) );