Gtk2-Ex-ComboBoxBits

 view release on metacpan or  search on metacpan

t/Enum-display.t  view on Meta::CPAN

  }
  diag "enum-type paramspec class: ", ref($pspec);
  diag "enum-type get_default_value: ", $default;
}

#------------------------------------------------------------------------------
# active-nick

{
  my $combo = Gtk2::Ex::ComboBox::Enum->new;
  is ($combo->get ('active-nick'), undef,
      'active-nick default undef');
  is ($combo->get_active_nick, undef,
      'get_active_nick() default undef');

  $combo->set_active_nick (undef);

 SKIP: {
    eval{Glib->VERSION(1.240);1}
      or skip 'no Glib::ParamSpec->string default undef until glib 1.240', 1;

    my $pspec = $combo->find_property('active-nick');
    is ($pspec->get_default_value, undef,
        'active-nick pspec get_default_value');
  }
}

#-----------------------------------------------------------------------------
# notify

{
  my $combo = Gtk2::Ex::ComboBox::Enum->new (enum_type => 'My::Test1');
  my $saw_notify;
  $combo->signal_connect
    ('notify::active-nick' => sub {
       $saw_notify = $combo->get('active-nick');
     });

  undef $saw_notify;
  $combo->set (active_nick => 'quux');
  is ($combo->get('active-nick'), 'quux', 'get() after set()');
  is ($combo->get_active_nick, 'quux', 'get_active_nick() after set()');
  is ($saw_notify, 'quux', 'notify from set("active_nick")');

  undef $saw_notify;
  $combo->set_active (0);
  is ($combo->get('active-nick'), 'foo', 'get() after set_active()');
  is ($combo->get_active_nick, 'foo', 'get_active_nick() after set_active()');
  is ($saw_notify, 'foo', 'notify from set_active()');

  undef $saw_notify;
  $combo->set_active (0);
  is ($saw_notify, undef, 'no notify from set_active() unchanged');

  undef $saw_notify;
  $combo->set_active_nick ('foo');
  is ($saw_notify, undef, 'no notify from set_active_nick() unchanged');
}

#-----------------------------------------------------------------------------
# Scalar::Util::weaken

{
  my $combo = Gtk2::Ex::ComboBox::Enum->new;
  require Scalar::Util;
  Scalar::Util::weaken ($combo);
  is ($combo, undef,'garbage collect when weakened');
}

exit 0;



( run in 2.093 seconds using v1.01-cache-2.11-cpan-8f98c5d2c55 )