Failed test at t/GtkButton.t line 70
I am on Ubuntu 21.04, perl version 5.32.0, Gtk2 version 2.24.33:
$ pkg-config --modversion gtk+-2.0
2.24.33
$ make test
"/home/hakon/perlbrew/perls/perl-5.32.0/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Gtk2.bs blib/arch/auto/Gtk2/Gtk2.bs 644
PERL_DL_NONLAZY=1 "/home/hakon/perlbrew/perls/perl-5.32.0/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00.Gtk2.t ........................ 1/30 # Testing Gtk2 1.24993
# Running against gtk+ 2.24.33
# Compiled against gtk+ 2.24.33
t/00.Gtk2.t ........................ ok
t/01.GtkWindow.t ................... ok
t/02.GtkContainer.t ................ ok
t/constants.t ...................... ok
t/Gdk.t ............................ ok
t/GdkCairo.t ....................... ok
t/GdkColor.t ....................... ok
t/GdkCursor.t ...................... ok
t/GdkDisplay.t ..................... ok
t/GdkDisplayManager.t .............. ok
t/GdkDrawable.t .................... ok
t/GdkEvent.t ....................... ok
t/GdkGC.t .......................... ok
t/GdkImage.t ....................... ok
t/GdkInput.t ....................... ok
t/GdkKeys.t ........................ ok
t/GdkPango.t ....................... ok
t/GdkPixbuf.t ...................... 1/112
# Failed test 'Don't crash on partial pixmap data'
# at t/GdkPixbuf.t line 126.
# Looks like you failed 1 test of 112.
t/GdkPixbuf.t ...................... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/112 subtests
t/GdkPixbufLoader.t ................ ok
t/GdkPixbufSimpleAnim.t ............ ok
t/GdkPixmap.t ...................... Gdk-WARNING **: XID collision, trouble ahead at t/GdkPixmap.t line 16.
t/GdkPixmap.t ...................... 1/6 Gdk-WARNING **: XID collision, trouble ahead at t/GdkPixmap.t line 25.
Gdk-WARNING **: XID collision, trouble ahead at t/GdkPixmap.t line 40.
t/GdkPixmap.t ...................... ok
t/GdkProperty.t .................... ok
t/GdkRegion.t ...................... ok
t/GdkRgb.t ......................... ok
t/GdkScreen.t ...................... ok
t/GdkSelection.t ................... ok
t/GdkVisual.t ...................... ok
t/GdkWindow.t ...................... ok
t/GdkX11.t ......................... ok
t/GtkAboutDialog.t ................. ok
t/GtkAccelGroup.t .................. ok
t/GtkAccelLabel.t .................. ok
t/GtkAccelMap.t .................... ok
t/GtkAction.t ...................... ok
t/GtkActionGroup.t ................. ok
t/GtkActivatable.t ................. ok
t/GtkAdjustment.t .................. ok
t/GtkAlignment.t ................... ok
t/GtkArrow.t ....................... ok
t/GtkAspectFrame.t ................. ok
t/GtkAssistant.t ................... ok
t/GtkBin.t ......................... ok
t/GtkBindings.t .................... ok
t/GtkBox.t ......................... ok
t/GtkBuildable.t ................... ok
t/GtkBuildableIface.t .............. ok
t/GtkBuilder.t ..................... ok
t/GtkButton.t ...................... 1/40
# Failed test at t/GtkButton.t line 69.
# Structures begin differing at:
# $got->[0] = '0,0'
# $expected->[0] = '0'
# Looks like you failed 1 test of 40.
t/GtkButton.t ...................... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/40 subtests
t/GtkButtonBox.t ................... ok
t/GtkCalendar.t .................... ok
t/GtkCellEditable.t ................ GLib-GObject-CRITICAL **: Object class EditableTest doesn't implement property 'editing-canceled' from interface 'GtkCellEditable' at /home/hakon/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/x86_64-linux/Glib/Object/Subclass.pm line 235.
t/GtkCellEditable.t ................ ok
t/GtkCellLayout.t .................. ok
t/GtkCellLayoutIface.t ............. ok
t/GtkCellRenderer.t ................ ok
t/GtkCellRendererAccel.t ........... ok
t/GtkCellRendererCombo.t ........... ok
[...]
I think the problem is that the stock buttons do not have any image by default. Therefore the call at line 65 in t/GtkButton.t
:
$button_stock->set_alignment(0.7, 0.3);
does not have any effect, and the call to $button_stock->get_alignment()
at line 69 returns the array (0, 0)
instead of (0.7, 0.3)
.
I created a simple C test program to show a stock button, and noted that also that button was missing the icon image (showed only the text), similar to this issue. So the problem is not specific to Perl.
In the C program, I was able to get the button icon back by changing the default settings before displaying the button:
GtkSettings *settings = gtk_settings_get_default();
g_object_set(settings, "gtk-button-images", TRUE, NULL);
I tried to do the same in Perl:
my $settings = Gtk2::Settings->get_default();
$settings->set("gtk-button-images", TRUE);
but it failed with the exception:
Can't locate object method "get_default" via package "Gtk2::Settings" at /home/hakon/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/x86_64-linux/Glib.pm line 222.