File: GtkTreeModelSort.t

package info (click to toggle)
libgtk2-perl 1%3A1.140-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,808 kB
  • ctags: 609
  • sloc: perl: 14,245; ansic: 118; makefile: 70
file content (45 lines) | stat: -rw-r--r-- 1,473 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
#!/usr/bin/perl -w
use strict;
use Gtk2::TestHelper tests => 11, noinit => 1;

# $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/t/GtkTreeModelSort.t,v 1.7 2006/01/18 19:04:10 kaffeetisch Exp $

my $list = Gtk2::ListStore -> new("Glib::Int");

$list -> set($list -> append(), 0 => 42);
$list -> set($list -> append(), 0 => 23);

my $sort = Gtk2::TreeModelSort -> new_with_model($list);
isa_ok($sort, "Gtk2::TreeModelSort");
ginterfaces_ok($sort);
is($sort -> get_model(), $list);

my $path = Gtk2::TreePath -> new_from_string("1");
my $iter = $sort -> get_iter($path);

isa_ok($sort -> convert_child_path_to_path($path), "Gtk2::TreePath");
isa_ok($sort -> convert_child_iter_to_iter($iter), "Gtk2::TreeIter");
isa_ok($sort -> convert_path_to_child_path($path), "Gtk2::TreePath");
isa_ok($sort -> convert_iter_to_child_iter($iter), "Gtk2::TreeIter");

$sort -> reset_default_sort_func();
$sort -> clear_cache();

SKIP: {
  skip("iter_is_valid is new in 2.2", 1)
    unless Gtk2->CHECK_VERSION (2, 2, 0);

  is($sort -> iter_is_valid($sort -> get_iter($path)), 1);
}

# other ways to construct
ok (Gtk2::TreeModelSort->new ($list), 'new with one arg');
ok (Gtk2::TreeModelSort->new (model => $list), 'new with two args');
# this should die with a usage message.
eval { $sort = Gtk2::TreeModelSort->new(); };
ok ($@, 'new with no args is an error');

__END__

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