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
|
#!/usr/bin/perl
# Based on Gtk2/t/GtkRadioToolButton.t
BEGIN { require './t/inc/setup.pl' }
use strict;
use warnings;
if (Gtk3::CHECK_VERSION (3, 4, 5)) {
plan tests => 12;
} else {
plan skip_all => 'GtkRadioToolButton was not properly annotated in gtk+ < 3.4.5';
}
my $item = Gtk3::RadioToolButton -> new();
isa_ok($item, "Gtk3::RadioToolButton");
my $item_two = Gtk3::RadioToolButton -> new(undef);
isa_ok($item_two, "Gtk3::RadioToolButton");
my $item_three = Gtk3::RadioToolButton -> new([$item, $item_two]);
isa_ok($item_three, "Gtk3::RadioToolButton");
$item_two = Gtk3::RadioToolButton -> new_from_stock(undef, "gtk-quit");
isa_ok($item_two, "Gtk3::RadioToolButton");
$item_three = Gtk3::RadioToolButton -> new_from_stock([$item, $item_two], "gtk-quit");
isa_ok($item_three, "Gtk3::RadioToolButton");
$item = Gtk3::RadioToolButton -> new_from_widget($item_two);
isa_ok($item, "Gtk3::RadioToolButton");
$item = Gtk3::RadioToolButton -> new_with_stock_from_widget($item_two, "gtk-quit");
isa_ok($item, "Gtk3::RadioToolButton");
$item = Gtk3::RadioToolButton -> new();
$item -> set_group([$item_two, $item_three]);
is_deeply($item -> get_group(), [$item_two, $item_three]);
{
# get_group() no memory leaks in arrayref return and array items
my $x = Gtk3::RadioToolButton->new;
my $y = Gtk3::RadioToolButton->new;
$y->set_group ($x);
my $aref = $x->get_group;
is_deeply ($aref, [$x,$y]);
require Scalar::Util;
Scalar::Util::weaken ($aref);
is ($aref, undef, 'get_group() array destroyed by weakening');
Scalar::Util::weaken ($x);
is ($x, undef, 'get_group() item x destroyed by weakening');
Scalar::Util::weaken ($y);
is ($y, undef, 'get_group() item y destroyed by weakening');
}
|