Hi! On Mon, Mar 30, 2009 at 11:06:08AM +1100, Kevin Ryde wrote: > Ryan Niebur <ryanryan52 gmail com> writes: > > > > * add a patch to skip a few bindings tests that rely on a keymap > > I think I introduced those bindings tests. Can it happen there's no > keymap, or the keymap having nothing mapping to 'Return'? > yep, there's no keymap under xvfb, which we run the tests under. and my patch only skips it if there's no keymap. > The key stuff there is a bit nasty so feel free to offer better (on > gtk-perl mailing list or bugzilla). > I should at least forward my patch, which I haven't done yet... but be warned that it's a bit of a mess, and, well, ya... probably the person who will commit it will just redo it ;) Thanks, Ryan -- _________________________ Ryan Niebur ryanryan52 gmail com
in xvfb there is no keymap, so that parts of the tests that rely on it fail.
--- a/t/GtkBindings.t
+++ b/t/GtkBindings.t
@@ -35,6 +35,12 @@
flags => ['run-last','action'],
class_closure => \&do_mysig_with_float },
};
+
+use Gtk2::Gdk::Keysyms;
+my $display = Gtk2::Gdk::Display -> get_default();
+my $keymap = Gtk2::Gdk::Keymap -> get_for_display ($display);
+my(@other_keys) = $keymap -> get_entries_for_keyval($Gtk2::Gdk::Keysyms{ Escape });
+
my $mysig_seen;
sub do_mysig {
#Test::More::diag ("mysig runs");
@@ -154,7 +160,10 @@
# As of Gtk 2.12 $gtkobj->bindings_activate() only actually works on a
# Gtk2::Widget, not a Gtk2::Object, hence using My::Widget to exercise
# add_path() instead of My::Object.
-{
+SKIP: {
+ if (scalar(@other_keys) == 0) {
+ skip "Needs a keymap", 5;
+ }
my $my_widget_bindings = Gtk2::BindingSet->find('my_widget_bindings');
ok ($my_widget_bindings, 'find() of RC parsed bindings');
@@ -374,12 +383,16 @@
#
my $mywidget = My::Widget->new;
+ SKIP: {
+ if (scalar(@other_keys) == 0) {
+ skip "Needs a keymap", 2;
+ }
$mywidgetsig_seen = 0;
- ok ($mywidget->bindings_activate (Gtk2::Gdk->keyval_from_name('Return'),[]),
- 'before entry_skip(), bindings_activate return true on mywidget');
- is ($mywidgetsig_seen, 1,
- 'before entry_skip(), bindings_activate runs mywidgetsig on mywidget');
-
+ ok ($mywidget->bindings_activate (Gtk2::Gdk->keyval_from_name('Return'),[]),
+ 'before entry_skip(), bindings_activate return true on mywidget');
+ is ($mywidgetsig_seen, 1,
+ 'before entry_skip(), bindings_activate runs mywidgetsig on mywidget');
+ }
$skip_bindings->add_path ('widget-class', 'My__Widget',
Gtk2::GTK_PATH_PRIO_HIGHEST);
Attachment:
signature.asc
Description: Digital signature