File: PangoContext.t

package info (click to toggle)
libgtk2-perl 1%3A1.190-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,132 kB
  • ctags: 516
  • sloc: perl: 16,575; sh: 149; ansic: 148; makefile: 76
file content (66 lines) | stat: -rw-r--r-- 1,974 bytes parent folder | download
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
#!/usr/bin/perl -w
use strict;
use Gtk2::TestHelper tests => 15;

# $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/t/PangoContext.t,v 1.9 2007/06/17 12:55:56 kaffeetisch Exp $

my $label = Gtk2::Label -> new("Bla");

my $context = $label -> create_pango_context();
isa_ok($context, "Gtk2::Pango::Context");

my @families = $context->list_families;
ok (@families > 0, 'got a list of somethings');
isa_ok ($families[0], 'Gtk2::Pango::FontFamily');

my $font = Gtk2::Pango::FontDescription -> from_string("Sans 12");
my $language = Gtk2 -> get_default_language();

$context -> set_font_description($font);
isa_ok($context -> get_font_description(), "Gtk2::Pango::FontDescription");

$context -> set_language($language);
isa_ok($context -> get_language(), "Gtk2::Pango::Language");

$context -> set_base_dir("ltr");
is($context -> get_base_dir(), "ltr");

isa_ok($context -> load_font($font), "Gtk2::Pango::Font");
isa_ok($context -> load_fontset($font, $language), "Gtk2::Pango::Fontset");
isa_ok($context -> get_metrics($font, $language), "Gtk2::Pango::FontMetrics");

SKIP: {
  skip("[sg]et_matrix are new in 1.6", 2)
    unless (Gtk2::Pango -> CHECK_VERSION(1, 6, 0));

  $context -> set_matrix(Gtk2::Pango::Matrix -> new());
  isa_ok($context -> get_matrix(), "Gtk2::Pango::Matrix");

  $context -> set_matrix(undef);
  is($context -> get_matrix(), undef);
}

SKIP: {
  skip("get_font_map is new in 1.6", 1)
    unless (Gtk2::Pango -> CHECK_VERSION(1, 6, 0));

  isa_ok($context -> get_font_map(), "Gtk2::Pango::FontMap");
}

SKIP: {
  skip("new 1.16 stuff", 3)
    unless (Gtk2::Pango -> CHECK_VERSION(1, 16, 0));

  ok(defined $context -> get_gravity());

  $context -> set_base_gravity("north");
  is($context -> get_base_gravity(), "north");

  $context -> set_gravity_hint("natural");
  is($context -> get_gravity_hint(), "natural");
}

__END__

Copyright (C) 2003-2004 by the gtk2-perl team (see the file AUTHORS for the
full list).  See LICENSE for more information.