Gtk2-Ex-ComboBoxBits
view release on metacpan or search on metacpan
t/ToolItem-EnumCombo.t view on Meta::CPAN
is ($toolitem, undef, 'toolitem - garbage collect when weakened');
is ($menuitem1, undef, 'menuitem1 - garbage collect when weakened');
is ($menuitem2, undef, 'menuitem2 - garbage collect when weakened');
}
{
my $toplevel = Gtk2::Window->new;
my $toolbar = Gtk2::Toolbar->new;
$toplevel->add($toolbar);
my $toolitem = Gtk2::Ex::ToolItem::ComboEnum->new (enum_type => 'My::Test1');
;
$toolbar->add ($toolitem);
$toplevel->show_all;
my $menuitem = $toolitem->retrieve_proxy_menu_item;
MyTestHelpers::main_iterations();
$toplevel->destroy;
require Scalar::Util;
Scalar::Util::weaken ($toolitem);
Scalar::Util::weaken ($menuitem);
is ($toolitem, undef, 'toolitem - garbage collect when weakened');
is ($menuitem, undef, 'menuitem - garbage collect when weakened');
}
#-----------------------------------------------------------------------------
# active-nick
{
my $toolitem = Gtk2::Ex::ToolItem::ComboEnum->new
(enum_type => 'My::Test1');
is ($toolitem->get('active-nick'), undef, 'get(active-nick) initial');
my $saw_notify;
$toolitem->signal_connect ('notify::active-nick' => sub {
$saw_notify++;
});
$saw_notify = 0;
$toolitem->set (active_nick => 'quux');
is ($saw_notify, 1, 'set_active_nick() notify');
is ($toolitem->get('active-nick'), 'quux', 'set(active-nick) get()');
$saw_notify = 0;
$toolitem->set ('active-nick', 'foo');
is ($saw_notify, 1, 'set(active-nick) notify');
is ($toolitem->get('active-nick'), 'foo', 'set(active-nick) get()');
$saw_notify = 0;
$toolitem->set (active_nick => 'foo');
is ($toolitem->get('active-nick'), 'foo', 'set(active-nick) get()');
}
#-----------------------------------------------------------------------------
# overflow menu
{
my $toolitem = Gtk2::Ex::ToolItem::ComboEnum->new
(enum_type => 'My::Test1');
my $combobox = $toolitem->get_child;
my $menuitem = $toolitem->retrieve_proxy_menu_item;
isa_ok ($menuitem, 'Gtk2::MenuItem');
{ my $m2 = $toolitem->retrieve_proxy_menu_item;
is ($m2, $menuitem);
}
{ my $m2 = $toolitem->retrieve_proxy_menu_item;
is ($m2, $menuitem);
}
my $menu = $menuitem->get_submenu;
isa_ok ($menu, 'Gtk2::Ex::Menu::EnumRadio');
is ($toolitem->get('active-nick'), undef);
is ($combobox->get('active-nick'), undef);
is ($menu->get('active-nick'), undef);
$menu->set(active_nick => 'foo');
is ($toolitem->get('active-nick'), 'foo');
is ($combobox->get('active-nick'), 'foo');
is ($menu->get('active-nick'), 'foo');
}
exit 0;
( run in 0.745 second using v1.01-cache-2.11-cpan-13bb782fe5a )