Gtk2
view release on metacpan or search on metacpan
t/GtkWidget.t view on Meta::CPAN
isa_ok ($widget->create_pango_layout ("Bla"), "Gtk2::Pango::Layout");
isa_ok ($widget->create_pango_layout(), "Gtk2::Pango::Layout");
isa_ok ($widget->render_icon ("gtk-open", "menu", "detail"), "Gtk2::Gdk::Pixbuf");
Gtk2::Widget->push_composite_child;
Gtk2::Widget->pop_composite_child;
$win = Gtk2::Window->new;
my $box = Gtk2::VBox->new (TRUE, 0);
$box->add ($widget);
$win->add ($box);
$widget->realize;
$widget->queue_draw_area (0, 0, 10, 10);
$widget->reset_shapes;
$widget->set_app_paintable (1);
$widget->set_double_buffered (1);
$widget->set_redraw_on_allocate (1);
my $adjustment = Gtk2::Adjustment->new (0, 0, 100, 1, 5, 10);
$widget->set_scroll_adjustments ($adjustment, $adjustment);
$widget->mnemonic_activate (1);
SKIP: {
skip "can't implement style_get without gtk_widget_class_find_style_property, which wasn't available till gtk+ 2.2.0", 1
unless Gtk2->CHECK_VERSION (2, 2, 0);
my @style = $widget->style_get ("focus-line-width", "focus-padding");
is (@style, 2);
}
isa_ok ($widget->get_accessible, "Gtk2::Atk::Object");
ok (!$widget->child_focus ("down"));
$widget->child_notify ("expand");
$widget->freeze_child_notify;
$widget->thaw_child_notify;
$widget->set_child_visible (1);
is ($widget->get_child_visible, 1);
isa_ok ($widget->get_settings, "Gtk2::Settings");
$widget->set_size_request (100, 100);
is_deeply ([$widget->get_size_request], [100, 100]);
my $bitmap = Gtk2::Gdk::Bitmap->create_from_data ($win->window, "", 1, 1);
$win->realize;
$widget->shape_combine_mask ($bitmap, 5, 5);
$widget->shape_combine_mask (undef, 5, 5);
SKIP: {
skip "stuff that's new in 2.2", 10
unless Gtk2->CHECK_VERSION (2, 2, 0);
isa_ok ($widget->get_clipboard, "Gtk2::Clipboard");
isa_ok ($widget->get_display, "Gtk2::Gdk::Display");
isa_ok ($widget->get_root_window, "Gtk2::Gdk::Window");
isa_ok ($widget->get_screen, "Gtk2::Gdk::Screen");
is ($widget->has_screen, 1);
# not sure it's wise to enquire into what properties exist, but
# let's assume there's at least 1
{ my @pspecs = $widget->list_style_properties;
cmp_ok (scalar(@pspecs), '>', 0); }
{ my @pspecs = Gtk2::Widget->list_style_properties;
cmp_ok (scalar(@pspecs), '>', 0); }
is ($widget->find_style_property('no-such-style-property-of-this-name'),
undef,
"find_style_property() no such name, on object");
is (Gtk2::Widget->find_style_property('no-such-style-property-of-this-name'),
undef,
"find_style_property() no such name, on class");
is (Gtk2::Label->find_style_property('no-such-style-property-of-this-name'),
undef,
"find_style_property() no such name, on label class");
# not sure it's wise to depend on properties exist, but at least
# exercise the code on "interior-focus" which exists in 2.2 up
$widget->find_style_property('interior-focus');
Gtk2::Widget->find_style_property('interior-focus');
Gtk2::Label->find_style_property('interior-focus');
}
SKIP: {
skip "stuff that's new in 2.4", 3
unless Gtk2->CHECK_VERSION (2, 4, 0);
$widget->set_no_show_all (1);
is ($widget->get_no_show_all, 1);
$widget->queue_resize_no_redraw;
ok (!$widget->can_activate_accel (23));
my $label_one = Gtk2::Label->new ("_One");
my $label_two = Gtk2::Label->new ("_Two");
$widget->add_mnemonic_label ($label_one);
$widget->add_mnemonic_label ($label_two);
is_deeply ([$widget->list_mnemonic_labels], [$label_one, $label_two]);
$widget->remove_mnemonic_label ($label_one);
$widget->remove_mnemonic_label ($label_two);
}
SKIP: {
skip "stuff that's new in 2.10", 0
unless Gtk2->CHECK_VERSION (2, 10, 0);
$widget->input_shape_combine_mask ($bitmap, 23, 42);
$widget->input_shape_combine_mask (undef, 0, 0);
( run in 0.944 second using v1.01-cache-2.11-cpan-2398b32b56e )