Gtk2-Ex-ComboBox

 view release on metacpan or  search on metacpan

t/test.3.t  view on Meta::CPAN

use strict;
use warnings;
use Glib qw(TRUE FALSE);
use Gtk2 qw/-init/;
use Gtk2::Ex::ComboBox;
use Gtk2::Ex::Simple::List;
use Data::Dumper;

use Gtk2::TestHelper tests => 7;

my $window = Gtk2::Window->new;
$window->signal_connect('destroy', sub {Gtk2->main_quit;});

my $label = Gtk2::Label->new('With-Buttons');
my $hbox = Gtk2::HBox->new (FALSE, 10);
$hbox->pack_start ($label, FALSE, TRUE, 0);    

my $combobox = Gtk2::Ex::ComboBox->new($label, 'no-checkbox');
isa_ok($combobox, "Gtk2::Ex::ComboBox");
ok(!$combobox->set_list(['this', 'that', 'what']));

my $slist = $combobox->get_treeview;
isa_ok($slist, "Gtk2::Ex::Simple::List");

my $selected_indices = $combobox->get_selected_indices;
is(Dumper($selected_indices->{'selected-indices'}), Dumper([]));
is(Dumper($selected_indices->{'unselected-indices'}), Dumper([0,1,2]));

my $selected_values = $combobox->get_selected_values;
is(Dumper($selected_values->{'selected-values'}), Dumper([]));
is(Dumper($selected_values->{'unselected-values'}), Dumper(['this', 'that', 'what']));

my $text = Gtk2::TextView->new;

my $vbox = Gtk2::VBox->new (FALSE, 0);
$vbox->pack_start ($hbox, FALSE, TRUE, 0);
$vbox->pack_start ($text, TRUE, TRUE, 0);
$window->add ($vbox);
$window->set_default_size(500, 200);
$window->show_all;

$combobox->show;



( run in 0.985 second using v1.01-cache-2.11-cpan-8dfa8b56332 )