File: GtkToolButton.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 (70 lines) | stat: -rw-r--r-- 1,975 bytes parent folder | download | duplicates (2)
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
#
# $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/t/GtkToolButton.t,v 1.5 2005/09/18 15:07:22 kaffeetisch Exp $
#

use Gtk2::TestHelper
	at_least_version => [2, 4, 0, "Action-based menus are new in 2.4"],
	tests => 15;

my $tool_button = Gtk2::ToolButton->new (undef, undef);
isa_ok ($tool_button, 'Gtk2::ToolButton');

my $icon_widget = Gtk2::Image->new_from_stock ('gtk-ok', 'large-toolbar');
$tool_button = Gtk2::ToolButton->new ($icon_widget, 'some label string');
isa_ok ($tool_button, 'Gtk2::ToolButton');

$tool_button = Gtk2::ToolButton->new_from_stock ('gtk-cancel');
isa_ok ($tool_button, 'Gtk2::ToolButton');


$tool_button->set_label (undef);
is ($tool_button->get_label, undef);

$tool_button->set_label ('something');
is ($tool_button->get_label, 'something');


$tool_button->set_use_underline (TRUE);
ok ($tool_button->get_use_underline);

$tool_button->set_use_underline (FALSE);
ok (!$tool_button->get_use_underline);


$tool_button->set_stock_id (undef);
is ($tool_button->get_stock_id, undef);

$tool_button->set_stock_id ('gtk-open');
is ($tool_button->get_stock_id, 'gtk-open');


$icon_widget = Gtk2::Image->new_from_stock ('gtk-cancel', 'large-toolbar');
$tool_button->set_icon_widget ($icon_widget);
is ($tool_button->get_icon_widget, $icon_widget);

$tool_button->set_icon_widget (undef);
is ($tool_button->get_icon_widget, undef);


my $label_widget = Gtk2::Label->new ('foo');
$tool_button->set_label_widget ($label_widget);
is ($tool_button->get_label_widget, $label_widget);

$tool_button->set_label_widget (undef);
is ($tool_button->get_label_widget, undef);

SKIP: {
  skip("new 2.8 stuff", 2)
    unless Gtk2->CHECK_VERSION (2, 8, 0);

  $tool_button->set_icon_name ("gtk-ok");
  is ($tool_button->get_icon_name, "gtk-ok");

  $tool_button->set_icon_name (undef);
  is ($tool_button->get_icon_name, undef);
}

__END__

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