File: GtkCellLayout.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 (57 lines) | stat: -rw-r--r-- 1,791 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
#!/usr/bin/perl -w
use strict;
use Gtk2::TestHelper
  at_least_version => [2, 4, 0, "GtkCellLayout is new in 2.4"],
  tests => 5;

# $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/t/GtkCellLayout.t,v 1.9 2008/01/08 05:18:26 muppetman Exp $

my $column = Gtk2::TreeViewColumn -> new();
isa_ok($column, "Gtk2::CellLayout");

my $box = Gtk2::ComboBox -> new();
isa_ok($box, "Gtk2::CellLayout");

my $entry = Gtk2::ComboBoxEntry -> new();
isa_ok($entry, "Gtk2::CellLayout");

# make sure there is a model; early versions of 2.4.x do not check for NULL
# before unreffing the model.
my $model = Gtk2::ListStore->new ('Glib::Int');
$box->set_model ($model);
$entry->set_model ($model);

my $completion = Gtk2::EntryCompletion -> new();
isa_ok($completion, "Gtk2::CellLayout");

my $renderer = Gtk2::CellRendererText -> new();

$completion -> pack_start($renderer, 0);
$completion -> clear();
$completion -> pack_end($renderer, 1);

$completion -> set_attributes($renderer, stock_id => 0);
$completion -> set_attributes($renderer);  # like calling clear
$completion -> add_attribute($renderer, activatable => 1);
$completion -> clear_attributes($renderer);

$completion -> set_cell_data_func($renderer, sub { warn @_; }, 23);
$completion -> set_cell_data_func($renderer, undef);

SKIP: {
  skip "2.12 stuff", 1
    unless Gtk2 -> CHECK_VERSION (2, 12, 0);

  # GtkEntryCompletion doesn't seem to implement get_cells yet, so we use the
  # GtkTreeViewColumn.
  my $one = Gtk2::CellRendererText -> new();
  my $two = Gtk2::CellRendererText -> new();
  $column -> pack_start($one, 0);
  $column -> pack_start($two, 1);
  is_deeply([$column -> get_cells()], [$one, $two]);
}

__END__

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