@@ -130,7 +130,6 @@ t/GdkColor.t
t/GdkCursor.t
t/GdkDisplay.t
t/GdkDisplayManager.t
-t/GdkDnd.t
t/GdkDrawable.t
t/GdkEvent.t
t/GdkGC.t
@@ -196,7 +195,6 @@ t/GtkComboBox.t
t/GtkComboBoxEntry.t
t/GtkCurve.t
t/GtkDialog.t
-t/GtkDnd.t
t/GtkDrawingArea.t
t/GtkEditable.t
t/GtkEntry.t
@@ -283,7 +281,6 @@ t/GtkShow.t
t/GtkSimpleList.t
t/GtkSimpleMenu.t
t/GtkSizeGroup.t
-t/GtkSocket-GtkPlug.t
t/GtkSpinButton.t
t/GtkSpinner.t
t/GtkStatusbar.t
@@ -580,5 +577,8 @@ xs_files-2.20
xs_files-2.4
xs_files-2.6
xs_files-2.8
+xt/GdkDnd.t
+xt/GtkDnd.t
+xt/GtkSocket-GtkPlug.t
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
@@ -4,7 +4,7 @@
"gtk2-perl Team <gtk-perl-list at gnome dot org>"
],
"dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 6.86, CPAN::Meta::Converter version 2.133380",
+ "generated_by" : "ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.133380",
"license" : [
"lgpl_2_1"
],
@@ -26,25 +26,10 @@
]
},
"prereqs" : {
- "build" : {
- "requires" : {
- "ExtUtils::MakeMaker" : "0"
- }
- },
"configure" : {
"requires" : {
"Cairo" : "1.000",
"ExtUtils::Depends" : "0.300",
- "ExtUtils::MakeMaker" : "0",
- "ExtUtils::PkgConfig" : "1.030",
- "Glib" : "1.280",
- "Pango" : "1.220"
- }
- },
- "runtime" : {
- "requires" : {
- "Cairo" : "1.000",
- "ExtUtils::Depends" : "0.300",
"ExtUtils::PkgConfig" : "1.030",
"Glib" : "1.280",
"Pango" : "1.220"
@@ -68,5 +53,5 @@
},
"x_MailingList" : "https://mail.gnome.org/mailman/listinfo/gtk-perl-list"
},
- "version" : "1.2491"
+ "version" : "1.2493"
}
@@ -2,17 +2,15 @@
abstract: 'Perl interface to the 2.x series of the Gimp Toolkit library'
author:
- 'gtk2-perl Team <gtk-perl-list at gnome dot org>'
-build_requires:
- ExtUtils::MakeMaker: 0
+build_requires: {}
configure_requires:
Cairo: 1.000
ExtUtils::Depends: 0.300
- ExtUtils::MakeMaker: 0
ExtUtils::PkgConfig: 1.030
Glib: 1.280
Pango: 1.220
dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 6.86, CPAN::Meta::Converter version 2.133380'
+generated_by: 'ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.133380'
license: lgpl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -27,16 +25,10 @@ no_index:
file:
- Makefile.PL
- gtk-demo/main.pl
-requires:
- Cairo: 1.000
- ExtUtils::Depends: 0.300
- ExtUtils::PkgConfig: 1.030
- Glib: 1.280
- Pango: 1.220
resources:
MailingList: https://mail.gnome.org/mailman/listinfo/gtk-perl-list
bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=Gtk2
homepage: http://gtk2-perl.sourceforge.net
license: http://www.gnu.org/licenses/lgpl-2.1.html
repository: git://git.gnome.org/perl-Gtk2
-version: 1.2491
+version: 1.2493
@@ -1,3 +1,17 @@
+Overview of changes in Gtk2 1.2493
+==================================
+
+* Make t/GtkCellRenderer.t more robust
+∗ Add a FIXME comment about a slight API problem
+
+Overview of changes in Gtk2 1.2492
+==================================
+
+* Fix compatibility with perl 5.20 and non-dot locales.
+* Disable some tests that are known to behave erratically in certain
+ environments. They are still available in the "xt" directory, but they will
+ not be run by default.
+
Overview of changes in Gtk2 1.2491
==================================
@@ -73,7 +73,7 @@ eval "use Cairo;";
use Exporter;
require DynaLoader;
-our $VERSION = '1.2491';
+our $VERSION = '1.2493';
our @ISA = qw(DynaLoader Exporter);
@@ -98,6 +98,36 @@ Gtk2->bootstrap ($VERSION);
our @EXPORT_OK = map { @$_ } values %Gtk2::EXPORT_TAGS;
$Gtk2::EXPORT_TAGS{all} = \@EXPORT_OK;
+# Compatibility with perl 5.20 and non-dot locales. Wrap all functions that
+# might end up calling setlocale() such that POSIX::setlocale() is also called
+# to ensure perl knows about the current locale. See the discussion in
+# <https://rt.perl.org//Public/Bug/Display.html?id=121930>,
+# <https://rt.perl.org/Public/Bug/Display.html?id=121317>,
+# <https://rt.perl.org/Public/Bug/Display.html?id=120723>.
+if ($^V ge v5.20.0) {
+ require POSIX;
+ no strict 'refs';
+ no warnings 'redefine';
+
+ my $disable_setlocale = 0;
+ my $orig = \&Gtk2::disable_setlocale;
+ *{Gtk2::disable_setlocale} = sub {
+ $disable_setlocale = 1;
+ $orig->(@_);
+ };
+
+ # gtk_init_with_args is not wrapped.
+ foreach my $function (qw/Gtk2::init Gtk2::init_check Gtk2::parse_args/) {
+ my $orig = \&{$function};
+ *{$function} = sub {
+ if (!$disable_setlocale) {
+ POSIX::setlocale (POSIX::LC_ALL (), '');
+ }
+ $orig->(@_);
+ };
+ }
+}
+
# Names "STOP" and "PROPAGATE" here are per the GtkWidget event signal
# descriptions. In some other flavours of signals the jargon is "handled"
# instead of "stop". "Handled" matches g_signal_accumulator_true_handled(),
@@ -50,7 +50,7 @@ SKIP:
Gtk2->disable_setlocale;
skip 'Gtk2->init_check failed, probably unable to open DISPLAY',
- 18, unless( Gtk2->init_check );
+ 17, unless( Gtk2->init_check );
ok( Gtk2->init );
ok( Gtk2->set_locale );
@@ -1,121 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-use Gtk2::TestHelper tests => 26;
-
-# $Id$
-
-my $window = Gtk2::Window -> new();
-$window -> realize();
-$window -> show_now;
-
-###############################################################################
-
-my $context = Gtk2::Gdk::DragContext -> new();
-isa_ok($context, "Gtk2::Gdk::DragContext");
-
-my @targets = (Gtk2::Gdk::Atom -> new("target-string"),
- Gtk2::Gdk::Atom -> new("target-bitmap"));
-
-$context = Gtk2::Gdk::DragContext -> begin($window -> window(), @targets);
-isa_ok($context, "Gtk2::Gdk::DragContext");
-
-my ($destination, $protocol);
-
-SKIP: {
- skip("GdkScreen is new in 2.2", 2)
- unless Gtk2 -> CHECK_VERSION(2, 2, 0);
-
- ($destination, $protocol) = $context -> find_window_for_screen($window -> window(), Gtk2::Gdk::Screen -> get_default(), 0, 0);
-
- ok(not defined $destination or ref $destination eq "Gtk2::Gdk::Window");
- ok(not defined $destination or $protocol);
-}
-
-$context -> abort(0);
-
-###############################################################################
-
-$context = Gtk2::Gdk::DragContext -> begin($window -> window(), @targets);
-isa_ok($context, "Gtk2::Gdk::DragContext");
-
-ok($context -> protocol());
-is($context -> is_source(), 1);
-is($context -> source_window(), $window -> window());
-is_deeply([map { $_ -> name() } $context -> targets()],
- [map { $_ -> name() } @targets]);
-isa_ok(($context -> targets())[0], "Gtk2::Gdk::Atom");
-
-($destination, $protocol) = $context -> find_window($window -> window(), 0, 0);
-
-ok(not defined $destination or ref $destination eq "Gtk2::Gdk::Window");
-ok(not defined $destination or $protocol);
-
-SKIP: {
- skip "find_window returned no destination window, skipping the tests that need one", 9
- unless defined $destination;
-
- # FIXME: what about the return value?
- $context -> motion($destination, $protocol, 100, 100, [qw(copy)], [qw(copy move)], 0);
-
- ok($context -> actions() == [qw(copy move)]);
- ok($context -> suggested_action() == qw(copy));
- is($context -> start_time(), 0);
-
- SKIP: {
- skip "can't do x11 stuff on this platform", 2
- if $^O eq 'MSWin32';
-
- is_deeply([Gtk2::Gdk::DragContext -> get_protocol($destination -> get_xid())],
- [$destination -> get_xid(), $protocol]);
-
- skip("get_protocol_for_display is new in 2.2", 1)
- unless Gtk2->CHECK_VERSION (2, 2, 0);
-
- is_deeply([Gtk2::Gdk::DragContext -> get_protocol_for_display(Gtk2::Gdk::Display -> get_default(), $destination -> get_xid())],
- [$destination -> get_xid(), $protocol]);
- }
-
- is($context -> dest_window(), $destination);
- my $selection = $context -> get_selection();
- SKIP: {
- skip "selection test: get_selection returned undef", 1
- unless defined $selection;
- isa_ok($selection, "Gtk2::Gdk::Atom");
- }
-
- $context -> status(qw(move), 0);
- ok($context -> action() == qw(move));
-
- $context -> status([], 0);
-
- $context -> drop_reply(1, 0);
- $context -> drop_finish(1, 0);
-
- SKIP: {
- skip "new 2.6 stuff", 1
- unless Gtk2 -> CHECK_VERSION(2, 6, 0);
-
- like($context -> drag_drop_succeeded(), qr/^(?:1|)$/);
- }
-
- $context -> drop(0);
- $context -> abort(0);
-}
-
-SKIP: {
- skip 'new 2.22 stuff', 5
- unless Gtk2->CHECK_VERSION(2, 22, 0);
-
- my $context = Gtk2::Gdk::DragContext -> begin($window -> window(), @targets);
- ok(defined $context -> get_actions());
- ok(defined $context -> get_selected_action());
- ok(defined $context -> get_suggested_action());
- is($context -> get_source_window(), $window -> window());
- is_deeply([map { $_ -> name() } $context -> list_targets()],
- [map { $_ -> name() } @targets]);
-}
-
-__END__
-
-Copyright (C) 2003 by the gtk2-perl team (see the file AUTHORS for the
-full list). See LICENSE for more information.
@@ -2,9 +2,11 @@
# $Id$
-use Gtk2::TestHelper tests => 26;
+use Gtk2::TestHelper tests => 46;
use strict;
+##########################################################################
+# custom cell renderer
package Mup::CellRendererPopup;
use Test::More;
@@ -22,8 +24,8 @@ sub RENDER { $hits{render}++; shift->SUPER::RENDER (@_) }
sub ACTIVATE { $hits{activate}++; shift->SUPER::ACTIVATE (@_) }
sub START_EDITING { $hits{edit}++; shift->SUPER::START_EDITING (@_) }
-
-# do that again, in the style of 1.02x, to check for regressions of
+##########################################################################
+# custom cell renderer in the style of 1.02x, to check for regressions of
# backward compatibility.
package Mup::CellRendererPopupCompat;
@@ -44,6 +46,8 @@ sub on_render { $hits_compat{render}++; shift->parent_render (@_) }
sub on_activate { $hits_compat{activate}++; shift->parent_activate (@_) }
sub on_start_editing { $hits_compat{edit}++; shift->parent_start_editing (@_) }
+##########################################################################
+# custom cell renderer with newly created entry in START_EDITING
package My::CellRendererNewEntry;
use strict;
use warnings;
@@ -59,7 +63,6 @@ sub START_EDITING { $hits_newentry{edit}++;
return $entry;
}
sub _editable_destroy { $hits_newentry{editable_destroy}++ }
-
##########################################################################
# driver code
@@ -83,7 +86,6 @@ foreach (qw/foo fluffy flurble frob frobnitz ftang fire truck/) {
$model->set ($iter, 0, $_);
}
-
# now a view
my $treeview = Gtk2::TreeView->new ($model);
@@ -92,8 +94,9 @@ my $treeview = Gtk2::TreeView->new ($model);
#
ok (my $renderer = Mup::CellRendererPopup->new, 'Mup::CellRendererPopup->new');
$renderer->set (mode => 'editable');
+$renderer->set (editable => 1);
my $column = Gtk2::TreeViewColumn->new_with_attributes ('selector', $renderer,
- text => 0,);
+ text => 0,);
# this handler commits the user's selection to the model. compare with
# the one for the typical text renderer -- the only difference is a var name.
$renderer->signal_connect (edited => sub {
@@ -104,18 +107,17 @@ $renderer->signal_connect (edited => sub {
}, $model);
$treeview->append_column ($column);
-
#
-# custom cell renderer
+# custom cell renderer, compat mode
#
-ok ($renderer = Mup::CellRendererPopupCompat->new, 'Mup::CellRendererPopupCompat->new');
-$renderer->set (mode => 'editable');
-$renderer->set (editable => 1);
-my $column_compat = Gtk2::TreeViewColumn->new_with_attributes ('selector', $renderer,
- text => 0,);
+ok (my $renderer_compat = Mup::CellRendererPopupCompat->new, 'Mup::CellRendererPopupCompat->new');
+$renderer_compat->set (mode => 'editable');
+$renderer_compat->set (editable => 1);
+my $column_compat = Gtk2::TreeViewColumn->new_with_attributes ('selector', $renderer_compat,
+ text => 0,);
# this handler commits the user's selection to the model. compare with
# the one for the typical text renderer -- the only difference is a var name.
-$renderer->signal_connect (edited => sub {
+$renderer_compat->signal_connect (edited => sub {
my ($cell, $text_path, $new_text, $model) = @_;
my $path = Gtk2::TreePath->new_from_string ($text_path);
my $iter = $model->get_iter ($path);
@@ -141,7 +143,6 @@ my $column_text = Gtk2::TreeViewColumn->new_with_attributes
('core-text', $renderer_text, text => 0,);
$treeview->append_column ($column_text);
-
##########################################################################
$vbox->pack_start ($treeview, 1, 1, 0);
@@ -150,48 +151,38 @@ $window->show_all;
##########################################################################
-isa_ok ($renderer, "Gtk2::CellRenderer");
-
+#
+# test the vfunc-involving stuff for all renderers
+#
my $rect = Gtk2::Gdk::Rectangle->new (5, 5, 10, 10);
-my @size = $renderer->get_size ($treeview, $rect);
-is (@size, 4);
-like($size[0], qr/^\d+$/);
-like($size[1], qr/^\d+$/);
-like($size[2], qr/^\d+$/);
-like($size[3], qr/^\d+$/);
-
my $event = Gtk2::Gdk::Event->new ("button-press");
-
-$renderer->render ($window->window, $treeview, $rect, $rect, $rect, [qw(sorted prelit)]);
-ok(!$renderer->activate ($event, $treeview, "0", $rect, $rect, qw(selected)));
-{
- my $editable = $renderer->start_editing ($event, $treeview, "0", $rect, $rect, qw(selected));
- isa_ok ($editable, "Gtk2::Entry");
- my $destroyed = 0;
- $editable->signal_connect (destroy => sub { $destroyed = 1 });
- undef $editable;
- is ($destroyed, 1,
- 'editable from start_editing using SUPER::START_EDITING destroyed when forgotten');
-}
-{
- my $editable = $renderer_newentry->start_editing ($event, $treeview, "0", $rect, $rect, qw(selected));
- isa_ok ($editable, "Gtk2::Entry");
- my $destroyed = 0;
- $editable->signal_connect (destroy => sub { $destroyed = 1 });
- undef $editable;
- is ($destroyed, 1,
- 'editable from start_editing using Gtk2::Entry->new destroyed when forgotten');
-}
-{
- my $editable = $renderer_text->start_editing ($event, $treeview, "0", $rect, $rect, qw(selected));
- isa_ok ($editable, "Gtk2::Entry");
- my $destroyed = 0;
- $editable->signal_connect (destroy => sub { $destroyed = 1 });
- undef $editable;
- is ($destroyed, 1,
- 'editable from start_editing on core GtkCellRendererText destroyed when forgotten');
+foreach my $r ($renderer, $renderer_compat, $renderer_newentry, $renderer_text) {
+ my @size = $r->get_size ($treeview, $rect);
+ is (@size, 4);
+ like($size[0], qr/^\d+$/);
+ like($size[1], qr/^\d+$/);
+ like($size[2], qr/^\d+$/);
+ like($size[3], qr/^\d+$/);
+
+ $r->render ($window->window, $treeview, $rect, $rect, $rect, [qw(sorted prelit)]);
+ ok(!$r->activate ($event, $treeview, "0", $rect, $rect, qw(selected)));
+
+ {
+ my $editable = $r->start_editing ($event, $treeview, "0", $rect, $rect, qw(selected));
+ isa_ok ($editable, "Gtk2::Entry");
+ my $destroyed = 0;
+ $editable->signal_connect (destroy => sub { $destroyed = 1 });
+ undef $editable;
+ is ($destroyed, 1,
+ "editable from start_editing using $r destroyed when forgotten");
+ }
}
+#
+# test the normal stuff just for one renderer
+#
+isa_ok ($renderer, "Gtk2::CellRenderer");
+
$renderer->set_fixed_size (23, 42);
is_deeply([$renderer->get_fixed_size], [23, 42]);
@@ -237,6 +228,8 @@ SKIP: {
##########################################################################
run_main sub {
+ # set the cursor on the various columns, with editing mode on, to
+ # trigger the vfuncs
$treeview->set_cursor (Gtk2::TreePath->new_from_string ('0'),
$column, 1);
$treeview->set_cursor (Gtk2::TreePath->new_from_string ('0'),
@@ -1,136 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-use Gtk2::TestHelper tests => 6;
-
-# $Id$
-
-my $button = Gtk2::Button -> new("Bla");
-my $window = Gtk2::Window -> new();
-
-$window -> add($button);
-$window -> realize();
-$button -> realize();
-
-# Dest ########################################################################
-
-$button -> drag_dest_set("all", "copy",
- { target => "BITMAP", info => 23 },
- { target => "STRING", flags => ["same-app", "same-widget"], info => 42 }
-);
-
-my $list = $button -> drag_dest_get_target_list();
-$button -> drag_dest_set_target_list(undef);
-$button -> drag_dest_set_target_list($list);
-
-is($list -> find(Gtk2::Gdk -> TARGET_BITMAP), 23);
-is($list -> find(Gtk2::Gdk -> TARGET_STRING), 42);
-
-my $pixbuf = Gtk2::Gdk::Pixbuf -> new("rgb", 0, 8, 10, 10);
-
-my $event = Gtk2::Gdk::Event -> new("button-press");
-
-my $context = Gtk2::Drag -> begin($button, $list, "default", 1, $event);
-SKIP: {
- skip "context test", 1 unless defined $context;
- isa_ok($context, "Gtk2::Gdk::DragContext");
-}
-
-$context = $button -> drag_begin($list, "default", 1, $event);
-SKIP: {
- skip "context test", 1 unless defined $context;
- isa_ok($context, "Gtk2::Gdk::DragContext");
-}
-
-if (defined($context)) {
- # warn $button -> drag_dest_find_target($context, $list);
- # $context -> finish(1, 0, 0);
- # $button -> drag_get_data($context, Gtk2::Gdk -> TARGET_STRING, 0);
- # warn $context -> get_source_widget();
-
- $context -> set_icon_widget($window, 5, 5);
-
- my $pixmap = Gtk2::Gdk::Pixmap->new ($window->window, 16, 16, -1);
- $context -> set_icon_pixmap($pixmap->get_colormap, $pixmap, undef, 5, 5);
- my $mask = Gtk2::Gdk::Pixmap->new ($window->window, 16, 16, 1);
- $context -> set_icon_pixmap($pixmap->get_colormap, $pixmap, $mask, 5, 5);
-
- $context -> set_icon_pixbuf($pixbuf, 5, 5);
- $context -> set_icon_stock("gtk-add", 5, 5);
- $context -> set_icon_default();
-
- SKIP: {
- skip "new 2.8 stuff", 0
- unless Gtk2 -> CHECK_VERSION(2, 8, 0);
-
- $context -> set_icon_name("gtk-add", 5, 5);
- }
-}
-
-is($button -> drag_check_threshold(5, 5, 100, 100), 1);
-
-$button -> drag_highlight();
-$button -> drag_unhighlight();
-
-$button -> drag_dest_set_proxy($window -> window(), "xdnd", 0);
-
-SKIP: {
- skip("2.6 stuff", 0)
- unless Gtk2 -> CHECK_VERSION(2, 6, 0);
-
- $button -> drag_dest_add_text_targets();
- $button -> drag_dest_add_image_targets();
- $button -> drag_dest_add_uri_targets();
-}
-
-SKIP: {
- skip("2.10 stuff", 1)
- unless Gtk2 -> CHECK_VERSION(2, 10, 0);
-
- $button -> drag_dest_set_track_motion(FALSE);
- ok(!$button -> drag_dest_get_track_motion());
-}
-
-$button -> drag_dest_unset();
-
-# Source ######################################################################
-
-$button -> drag_source_set("shift-mask", "copy",
- { target => "BITMAP", info => 23 },
- { target => "STRING", flags => ["same-app", "same-widget"], info => 42 }
-);
-
-# $button -> drag_source_set_icon(...);
-$button -> drag_source_set_icon_pixbuf($pixbuf);
-$button -> drag_source_set_icon_stock("gtk-quit");
-
-SKIP: {
- skip("drag_source_[sg]et_target_list is new in 2.4", 0)
- unless Gtk2->CHECK_VERSION (2, 4, 0);
-
- $list = $button -> drag_source_get_target_list();
- $button -> drag_source_set_target_list(undef);
- $button -> drag_source_set_target_list($list);
-}
-
-SKIP: {
- skip("2.6 stuff", 0)
- unless Gtk2 -> CHECK_VERSION(2, 6, 0);
-
- $button -> drag_source_add_text_targets();
- $button -> drag_source_add_image_targets();
- $button -> drag_source_add_uri_targets();
-}
-
-SKIP: {
- skip("2.8 stuff", 0)
- unless Gtk2 -> CHECK_VERSION(2, 8, 0);
-
- $button -> drag_source_set_icon_name("gtk-ok");
-}
-
-$button -> drag_source_unset();
-
-__END__
-
-Copyright (C) 2003-2006 by the gtk2-perl team (see the file AUTHORS for
-the full list). See LICENSE for more information.
@@ -1,105 +0,0 @@
-#!/usr/bin/perl
-#
-# $Id$
-#
-
-# ...despite patches that have been around for a long time, no win32
-use Gtk2::TestHelper tests => 12, nowin32 => 1;
-
-SKIP: {
-
-skip "blib can't be found", 6
- unless -d "blib";
-
-ok( my $win = Gtk2::Window->new );
-
-ok( my $socket = Gtk2::Socket->new );
-$win->add($socket);
-
-ok( my $id = $socket->get_id );
-
-SKIP: {
- skip 'new 2.14 stuff', 2
- unless Gtk2->CHECK_VERSION(2, 14, 0);
-
- is( $socket->get_plug_window, undef );
- $socket->signal_connect (plug_added => sub {
- isa_ok( $socket->get_plug_window, 'Gtk2::Gdk::Window' );
- });
-}
-
-my $pid = fork;
-
-skip 'fork failed', 2 unless defined $pid && $pid >= 0;
-
-if( $pid == 0 )
-{
- exec("$^X -Mblib -e 'my \$id = $id;\n\n" . <<EOL);
-use Gtk2;
-
-Gtk2->init;
-
-my \$plug = Gtk2::Plug->new($id);
-
-my \$btn = Gtk2::Button->new("gtk-quit");
-\$btn->signal_connect("clicked" => sub { Gtk2->main_quit; 1; });
-\$plug->add(\$btn);
-
-\$plug->show_all;
-
-Glib::Idle->add(sub { \$btn->clicked; 0; });
-
-Gtk2->main;'
-EOL
- exit 0;
-}
-else
-{
- $socket->signal_connect('plug-removed' => sub {
- Gtk2->main_quit;
- 1;
- });
- $win->show_all;
- Gtk2->main;
- ok( waitpid($pid, 0) );
-}
-
-}
-
-# Standalone GtkPlug tests.
-SKIP: {
- my $id = 23;
- my $display = Gtk2::Gdk::Display->get_default;
-
- # Backwards compatibility tests
- my $plug = Gtk2::Plug->new($id);
- isa_ok( $plug, 'Gtk2::Plug' );
-
- $plug->construct($id);
- $plug->construct_for_display($display, $id);
-
- ok( defined $plug->get_id );
-
- skip 'new 2.14 stuff', 2
- unless Gtk2->CHECK_VERSION(2, 14, 0);
-
- is( $plug->get_embedded, FALSE );
- is( $plug->get_socket_window, undef );
-}
-
-# Backwards compatibility tests.
-{
- my $id = 23;
- my $display = Gtk2::Gdk::Display->get_default;
-
- isa_ok( Gtk2::Plug::new_for_display($display, $id),
- 'Gtk2::Plug' );
-
- isa_ok( Gtk2::Plug->new_for_display($display, $id),
- 'Gtk2::Plug' );
-}
-
-__END__
-
-Copyright (C) 2003 by the gtk2-perl team (see the file AUTHORS for the
-full list). See LICENSE for more information.
@@ -24,8 +24,8 @@ $view->append_column (Gtk2::TreeViewColumn->new_with_attributes (
#my $pixmap = $view->create_row_drag_icon (Gtk2::TreePath->new ("0:0"));
#isa_ok ($pixmap, '', 'create_row_drag_icon');
-$view->enable_model_drag_source (['button1-mask'], ['copy'], ['example', 0, 0]);
-$view->enable_model_drag_dest (['copy'], ['example', 0, 0]);
+$view->enable_model_drag_source (['button1-mask'], ['copy'], ['example', ['same-app'], 0]);
+$view->enable_model_drag_dest (['copy'], ['example', ['same-app'], 0]);
$view->signal_connect (drag_data_received => sub {
print Dumper (@_);
@@ -381,6 +381,7 @@ gtk_tree_view_column_cell_is_visible (tree_column)
#if GTK_CHECK_VERSION(2,2,0)
+# FIXME: The boolean return value should not be ignored.
#### gboolean gtk_tree_view_column_cell_get_position (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell_renderer, gint *start_pos, gint *width)
void
gtk_tree_view_column_cell_get_position (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell_renderer, OUTLIST gint start_pos, OUTLIST gint width)
@@ -0,0 +1,121 @@
+#!/usr/bin/perl -w
+use strict;
+use Gtk2::TestHelper tests => 26;
+
+# $Id$
+
+my $window = Gtk2::Window -> new();
+$window -> realize();
+$window -> show_now;
+
+###############################################################################
+
+my $context = Gtk2::Gdk::DragContext -> new();
+isa_ok($context, "Gtk2::Gdk::DragContext");
+
+my @targets = (Gtk2::Gdk::Atom -> new("target-string"),
+ Gtk2::Gdk::Atom -> new("target-bitmap"));
+
+$context = Gtk2::Gdk::DragContext -> begin($window -> window(), @targets);
+isa_ok($context, "Gtk2::Gdk::DragContext");
+
+my ($destination, $protocol);
+
+SKIP: {
+ skip("GdkScreen is new in 2.2", 2)
+ unless Gtk2 -> CHECK_VERSION(2, 2, 0);
+
+ ($destination, $protocol) = $context -> find_window_for_screen($window -> window(), Gtk2::Gdk::Screen -> get_default(), 0, 0);
+
+ ok(not defined $destination or ref $destination eq "Gtk2::Gdk::Window");
+ ok(not defined $destination or $protocol);
+}
+
+$context -> abort(0);
+
+###############################################################################
+
+$context = Gtk2::Gdk::DragContext -> begin($window -> window(), @targets);
+isa_ok($context, "Gtk2::Gdk::DragContext");
+
+ok($context -> protocol());
+is($context -> is_source(), 1);
+is($context -> source_window(), $window -> window());
+is_deeply([map { $_ -> name() } $context -> targets()],
+ [map { $_ -> name() } @targets]);
+isa_ok(($context -> targets())[0], "Gtk2::Gdk::Atom");
+
+($destination, $protocol) = $context -> find_window($window -> window(), 0, 0);
+
+ok(not defined $destination or ref $destination eq "Gtk2::Gdk::Window");
+ok(not defined $destination or $protocol);
+
+SKIP: {
+ skip "find_window returned no destination window, skipping the tests that need one", 9
+ unless defined $destination;
+
+ # FIXME: what about the return value?
+ $context -> motion($destination, $protocol, 100, 100, [qw(copy)], [qw(copy move)], 0);
+
+ ok($context -> actions() == [qw(copy move)]);
+ ok($context -> suggested_action() == qw(copy));
+ is($context -> start_time(), 0);
+
+ SKIP: {
+ skip "can't do x11 stuff on this platform", 2
+ if $^O eq 'MSWin32';
+
+ is_deeply([Gtk2::Gdk::DragContext -> get_protocol($destination -> get_xid())],
+ [$destination -> get_xid(), $protocol]);
+
+ skip("get_protocol_for_display is new in 2.2", 1)
+ unless Gtk2->CHECK_VERSION (2, 2, 0);
+
+ is_deeply([Gtk2::Gdk::DragContext -> get_protocol_for_display(Gtk2::Gdk::Display -> get_default(), $destination -> get_xid())],
+ [$destination -> get_xid(), $protocol]);
+ }
+
+ is($context -> dest_window(), $destination);
+ my $selection = $context -> get_selection();
+ SKIP: {
+ skip "selection test: get_selection returned undef", 1
+ unless defined $selection;
+ isa_ok($selection, "Gtk2::Gdk::Atom");
+ }
+
+ $context -> status(qw(move), 0);
+ ok($context -> action() == qw(move));
+
+ $context -> status([], 0);
+
+ $context -> drop_reply(1, 0);
+ $context -> drop_finish(1, 0);
+
+ SKIP: {
+ skip "new 2.6 stuff", 1
+ unless Gtk2 -> CHECK_VERSION(2, 6, 0);
+
+ like($context -> drag_drop_succeeded(), qr/^(?:1|)$/);
+ }
+
+ $context -> drop(0);
+ $context -> abort(0);
+}
+
+SKIP: {
+ skip 'new 2.22 stuff', 5
+ unless Gtk2->CHECK_VERSION(2, 22, 0);
+
+ my $context = Gtk2::Gdk::DragContext -> begin($window -> window(), @targets);
+ ok(defined $context -> get_actions());
+ ok(defined $context -> get_selected_action());
+ ok(defined $context -> get_suggested_action());
+ is($context -> get_source_window(), $window -> window());
+ is_deeply([map { $_ -> name() } $context -> list_targets()],
+ [map { $_ -> name() } @targets]);
+}
+
+__END__
+
+Copyright (C) 2003 by the gtk2-perl team (see the file AUTHORS for the
+full list). See LICENSE for more information.
@@ -0,0 +1,136 @@
+#!/usr/bin/perl -w
+use strict;
+use Gtk2::TestHelper tests => 6;
+
+# $Id$
+
+my $button = Gtk2::Button -> new("Bla");
+my $window = Gtk2::Window -> new();
+
+$window -> add($button);
+$window -> realize();
+$button -> realize();
+
+# Dest ########################################################################
+
+$button -> drag_dest_set("all", "copy",
+ { target => "BITMAP", info => 23 },
+ { target => "STRING", flags => ["same-app", "same-widget"], info => 42 }
+);
+
+my $list = $button -> drag_dest_get_target_list();
+$button -> drag_dest_set_target_list(undef);
+$button -> drag_dest_set_target_list($list);
+
+is($list -> find(Gtk2::Gdk -> TARGET_BITMAP), 23);
+is($list -> find(Gtk2::Gdk -> TARGET_STRING), 42);
+
+my $pixbuf = Gtk2::Gdk::Pixbuf -> new("rgb", 0, 8, 10, 10);
+
+my $event = Gtk2::Gdk::Event -> new("button-press");
+
+my $context = Gtk2::Drag -> begin($button, $list, "default", 1, $event);
+SKIP: {
+ skip "context test", 1 unless defined $context;
+ isa_ok($context, "Gtk2::Gdk::DragContext");
+}
+
+$context = $button -> drag_begin($list, "default", 1, $event);
+SKIP: {
+ skip "context test", 1 unless defined $context;
+ isa_ok($context, "Gtk2::Gdk::DragContext");
+}
+
+if (defined($context)) {
+ # warn $button -> drag_dest_find_target($context, $list);
+ # $context -> finish(1, 0, 0);
+ # $button -> drag_get_data($context, Gtk2::Gdk -> TARGET_STRING, 0);
+ # warn $context -> get_source_widget();
+
+ $context -> set_icon_widget($window, 5, 5);
+
+ my $pixmap = Gtk2::Gdk::Pixmap->new ($window->window, 16, 16, -1);
+ $context -> set_icon_pixmap($pixmap->get_colormap, $pixmap, undef, 5, 5);
+ my $mask = Gtk2::Gdk::Pixmap->new ($window->window, 16, 16, 1);
+ $context -> set_icon_pixmap($pixmap->get_colormap, $pixmap, $mask, 5, 5);
+
+ $context -> set_icon_pixbuf($pixbuf, 5, 5);
+ $context -> set_icon_stock("gtk-add", 5, 5);
+ $context -> set_icon_default();
+
+ SKIP: {
+ skip "new 2.8 stuff", 0
+ unless Gtk2 -> CHECK_VERSION(2, 8, 0);
+
+ $context -> set_icon_name("gtk-add", 5, 5);
+ }
+}
+
+is($button -> drag_check_threshold(5, 5, 100, 100), 1);
+
+$button -> drag_highlight();
+$button -> drag_unhighlight();
+
+$button -> drag_dest_set_proxy($window -> window(), "xdnd", 0);
+
+SKIP: {
+ skip("2.6 stuff", 0)
+ unless Gtk2 -> CHECK_VERSION(2, 6, 0);
+
+ $button -> drag_dest_add_text_targets();
+ $button -> drag_dest_add_image_targets();
+ $button -> drag_dest_add_uri_targets();
+}
+
+SKIP: {
+ skip("2.10 stuff", 1)
+ unless Gtk2 -> CHECK_VERSION(2, 10, 0);
+
+ $button -> drag_dest_set_track_motion(FALSE);
+ ok(!$button -> drag_dest_get_track_motion());
+}
+
+$button -> drag_dest_unset();
+
+# Source ######################################################################
+
+$button -> drag_source_set("shift-mask", "copy",
+ { target => "BITMAP", info => 23 },
+ { target => "STRING", flags => ["same-app", "same-widget"], info => 42 }
+);
+
+# $button -> drag_source_set_icon(...);
+$button -> drag_source_set_icon_pixbuf($pixbuf);
+$button -> drag_source_set_icon_stock("gtk-quit");
+
+SKIP: {
+ skip("drag_source_[sg]et_target_list is new in 2.4", 0)
+ unless Gtk2->CHECK_VERSION (2, 4, 0);
+
+ $list = $button -> drag_source_get_target_list();
+ $button -> drag_source_set_target_list(undef);
+ $button -> drag_source_set_target_list($list);
+}
+
+SKIP: {
+ skip("2.6 stuff", 0)
+ unless Gtk2 -> CHECK_VERSION(2, 6, 0);
+
+ $button -> drag_source_add_text_targets();
+ $button -> drag_source_add_image_targets();
+ $button -> drag_source_add_uri_targets();
+}
+
+SKIP: {
+ skip("2.8 stuff", 0)
+ unless Gtk2 -> CHECK_VERSION(2, 8, 0);
+
+ $button -> drag_source_set_icon_name("gtk-ok");
+}
+
+$button -> drag_source_unset();
+
+__END__
+
+Copyright (C) 2003-2006 by the gtk2-perl team (see the file AUTHORS for
+the full list). See LICENSE for more information.
@@ -0,0 +1,105 @@
+#!/usr/bin/perl
+#
+# $Id$
+#
+
+# ...despite patches that have been around for a long time, no win32
+use Gtk2::TestHelper tests => 12, nowin32 => 1;
+
+SKIP: {
+
+skip "blib can't be found", 6
+ unless -d "blib";
+
+ok( my $win = Gtk2::Window->new );
+
+ok( my $socket = Gtk2::Socket->new );
+$win->add($socket);
+
+ok( my $id = $socket->get_id );
+
+SKIP: {
+ skip 'new 2.14 stuff', 2
+ unless Gtk2->CHECK_VERSION(2, 14, 0);
+
+ is( $socket->get_plug_window, undef );
+ $socket->signal_connect (plug_added => sub {
+ isa_ok( $socket->get_plug_window, 'Gtk2::Gdk::Window' );
+ });
+}
+
+my $pid = fork;
+
+skip 'fork failed', 2 unless defined $pid && $pid >= 0;
+
+if( $pid == 0 )
+{
+ exec("$^X -Mblib -e 'my \$id = $id;\n\n" . <<EOL);
+use Gtk2;
+
+Gtk2->init;
+
+my \$plug = Gtk2::Plug->new($id);
+
+my \$btn = Gtk2::Button->new("gtk-quit");
+\$btn->signal_connect("clicked" => sub { Gtk2->main_quit; 1; });
+\$plug->add(\$btn);
+
+\$plug->show_all;
+
+Glib::Idle->add(sub { \$btn->clicked; 0; });
+
+Gtk2->main;'
+EOL
+ exit 0;
+}
+else
+{
+ $socket->signal_connect('plug-removed' => sub {
+ Gtk2->main_quit;
+ 1;
+ });
+ $win->show_all;
+ Gtk2->main;
+ ok( waitpid($pid, 0) );
+}
+
+}
+
+# Standalone GtkPlug tests.
+SKIP: {
+ my $id = 23;
+ my $display = Gtk2::Gdk::Display->get_default;
+
+ # Backwards compatibility tests
+ my $plug = Gtk2::Plug->new($id);
+ isa_ok( $plug, 'Gtk2::Plug' );
+
+ $plug->construct($id);
+ $plug->construct_for_display($display, $id);
+
+ ok( defined $plug->get_id );
+
+ skip 'new 2.14 stuff', 2
+ unless Gtk2->CHECK_VERSION(2, 14, 0);
+
+ is( $plug->get_embedded, FALSE );
+ is( $plug->get_socket_window, undef );
+}
+
+# Backwards compatibility tests.
+{
+ my $id = 23;
+ my $display = Gtk2::Gdk::Display->get_default;
+
+ isa_ok( Gtk2::Plug::new_for_display($display, $id),
+ 'Gtk2::Plug' );
+
+ isa_ok( Gtk2::Plug->new_for_display($display, $id),
+ 'Gtk2::Plug' );
+}
+
+__END__
+
+Copyright (C) 2003 by the gtk2-perl team (see the file AUTHORS for the
+full list). See LICENSE for more information.