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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
#!/usr/bin/perl
use strict;
use warnings;
use Gtk2::TestHelper tests => 10;
use FindBin;
use lib "$FindBin::Bin";
use my_helper;
use Glib qw(TRUE FALSE);
use Gtk2::SourceView2;
exit tests();
sub tests {
test_constructors();
test_properties();
return 0;
}
sub test_constructors {
my $manager;
$manager = Gtk2::SourceView2::StyleSchemeManager->new();
isa_ok($manager, 'Gtk2::SourceView2::StyleSchemeManager');
$manager = Gtk2::SourceView2::StyleSchemeManager->get_default();
isa_ok($manager, 'Gtk2::SourceView2::StyleSchemeManager');
}
sub test_properties {
my $manager = Gtk2::SourceView2::StyleSchemeManager->get_default();
ok(scalar($manager->get_scheme_ids), "get_scheme_ids");
my @path = $manager->get_search_path;
ok(scalar(@path), "get_search_path");
my ($scheme_id) = $manager->get_scheme_ids;
my $scheme = $manager->get_scheme($scheme_id);
isa_ok($scheme, 'Gtk2::SourceView2::StyleScheme');
# Clear the search path
$manager->set_search_path();
is_deeply(
[ $manager->get_search_path ],
[ ],
"set_search_path() clear"
);
$manager->set_search_path('a', 'b');
is_deeply(
[ $manager->get_search_path ],
[ 'a', 'b' ],
"set_search_path(a, b)"
);
$manager->append_search_path('c');
is_deeply(
[ $manager->get_search_path ],
[ 'a', 'b', 'c' ],
"append_search_path(c)"
);
$manager->prepend_search_path('0');
is_deeply(
[ $manager->get_search_path ],
[ 0, 'a', 'b', 'c' ],
"prepend_search_path(0)"
);
# Reset the search path
$manager->set_search_path(undef);
is_deeply(
[ $manager->get_search_path ],
[ @path ],
"set_search_path(undef) reset"
);
$manager->force_rescan();
}
|