NAME
Test::Without::Gtk2Things - disable selected Gtk2 methods for testing
SYNOPSIS
# perl -MTest::Without::Gtk2Things=insert_with_values foo.t
# or
use Test::Without::Gtk2Things 'insert_with_values';
DESCRIPTION
This module removes or disables selected features from Gtk2 in order to simulate an older version (or other restrictions). It can be used for development or testing to check code which adapts itself to available features or which is meant to run on older Gtk. There's only a couple of "without" things as yet.
Obviously the best way to test application code on older Gtk is to run it on an older Gtk, but making a full environment for that can be difficult.
Usage
From the command line use a -M module load (per perlrun) for a program or test script,
perl -MTest::Without::Gtk2Things=insert_with_values foo.t
Or the same through Test::Harness in a MakeMaker test run
HARNESS_PERL_SWITCHES="-MTest::Without::Gtk2Things=blank_cursor" \
make test
A test script can do the same with a use,
use Test::Without::Gtk2Things 'insert_with_values';
Or an equivalent explicit import,
require Test::Without::Gtk2Things;
Test::Without::Gtk2Things->import('insert_with_values');
In each case generally the "withouts" should be established before loading application code in case it checks features at BEGIN time.
Currently Test::Without::Gtk2Things loads Gtk2 if not already loaded, but don't rely on that. A mangle-after-load instead might be good, if it could be done reliably.
WITHOUT THINGS
verbose-
Have
Test::Without::Gtk2Thingsprint some diagnostic messages toSTDERR. For example,perl -MTest::Without::Gtk2Things=verbose,blank_cursor foo.t => Test::Without::Gtk2Things -- without CursorType blank-cursor, per Gtk before 2.16 ... blank_cursor-
Remove
blank-cursorfrom theGtk2::Gdk::CursorTypeenumeration. Currently this means removing fromGlib::Type->list_values, and makingGtk2::Gdk::Cursor->newandnew_for_displaythrow an error if asked for that type.Object properties of type
Gtk2::Gdk::CursorTypeare are not affected (they can still be set toblank-cursor), but perhaps that could be done in the future. Blank cursors within Gtk itself are unaffected.blank-cursoris new in Gtk 2.16. In earlier versions an invisible cursor can be made by applications with a no-pixels-set bitmap as described bygdk_cursor_newin such earlier versions. (See Gtk2::Ex::WidgetCursor for some help with that.) cell_layout_get_cells-
Remove the
get_cellsmethod from theGtk2::CellLayoutinterface. That interface method is new in Gtk 2.12 and removal affects all widget classes implementing that interface. In earlier Gtk versionsGtk2::CellViewandGtk2::TreeViewColumnhave individualget_cell_renderersmethods. Those methods are unaffected by this without. insert_with_values-
Remove the
insert_with_valuesmethod fromGtk2::ListStoreandGtk2::TreeStore. That method is new in Gtk 2.6. In earlier versions separateinsertandsetcalls are necessary. -
Remove from
Gtk2::MenuItemlabelanduse-underlineproperties and corresponding explicitget_label,set_use_underlineetc methods.labelanduse-underlineare new in Gtk 2.16. (For prior versionsnew_with_labelornew_with_mnemoniccreate and set a child label widget.) widget_tooltip-
Remove from
Gtk2::Widgetbase tooltip support new in Gtk 2.12. This means thetooltip-text,tooltip-markupandhas-tooltipproperties, their direct get/set methods such as$widget->set_tooltip_text, and thequery-tooltipsignal.For code supporting both earlier and later than 2.12 it may be enough to just skip the tooltip setups for the earlier versions. See
set_property_maybein Glib::Ex::ObjectBits for some help with that.
SEE ALSO
Gtk2, Test::Without::Module, Test::Weaken::Gtk2
COPYRIGHT
Copyright 2010 Kevin Ryde
Gtk2-Ex-WidgetBits is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Gtk2-Ex-WidgetBits is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Gtk2-Ex-WidgetBits. If not, see http://www.gnu.org/licenses/.