Gtk2-Ex-ComboBoxBits

 view release on metacpan or  search on metacpan

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

  is ($Gtk2::Ex::ComboBox::Text::VERSION,
      $want_version,
      'VERSION variable');
  is (Gtk2::Ex::ComboBox::Text->VERSION,
      $want_version,
      'VERSION class method');

  ok (eval { Gtk2::Ex::ComboBox::Text->VERSION($want_version); 1 },
      "VERSION class check $want_version");
  my $check_version = $want_version + 1000;
  ok (! eval { Gtk2::Ex::ComboBox::Text->VERSION($check_version); 1 },
      "VERSION class check $check_version");

  my $combo = Gtk2::Ex::ComboBox::Text->new;
  is ($combo->VERSION,  $want_version, 'VERSION object method');

  ok (eval { $combo->VERSION($want_version); 1 },
      "VERSION object check $want_version");
  ok (! eval { $combo->VERSION($check_version); 1 },
      "VERSION object check $check_version");
}


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

{
  my $combo = Gtk2::Ex::ComboBox::Text->new (append_text => 'foo',
                                             append_text => 'bar-ski',
                                             append_text => 'quux');
  my $saw_notify;
  $combo->signal_connect
    ('notify::active-text' => sub {
       $saw_notify = $combo->get('active-text');
     });
  $combo->set (active_text => 'quux');
  is ($combo->get('active-text'), 'quux', 'get() after set()');
  is ($saw_notify, 'quux', 'notify from set("active_text")');

  $combo->set_active (0);
  is ($combo->get('active-text'), 'foo', 'get() after set_active()');
  is ($saw_notify, 'foo', 'notify from set_active()');
}


#-----------------------------------------------------------------------------
# append/prepend

{
  my $combo = Gtk2::Ex::ComboBox::Text->new;
  $combo->set (append_text => 'foo',
               prepend_text => 'bar');
  $combo->set_active (0);
  is ($combo->get_active_text, 'bar', 'prepended bar');
  $combo->set_active (1);
  is ($combo->get_active_text, 'foo', 'appended foo');
}


#-----------------------------------------------------------------------------
# weaken()

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

exit 0;



( run in 1.299 second using v1.01-cache-2.11-cpan-d8267643d1d )