view release on metacpan or search on metacpan
devel/DownloadDialog.t view on Meta::CPAN
my $have_display = Gtk2->init_check;
SKIP: {
$have_display or skip 'due to no DISPLAY available', 1;
{
my $dialog = App::Chart::Gtk2::DownloadDialog->new;
require Scalar::Util;
Scalar::Util::weaken ($dialog);
$dialog->destroy;
MyTestHelpers::main_iterations();
is ($dialog, undef, 'garbage collect after destroy');
}
}
#------------------------------------------------------------------------------
# Test::Weaken 3 for "contents"
my $have_test_weaken = eval "use Test::Weaken 3; 1";
if (! $have_test_weaken) { diag "Test::Weaken 3 not available -- $@"; }
devel/Main.t view on Meta::CPAN
'Daily', 'Weekly', 'Monthly') {
diag "action $name";
my $action = $actiongroup->get_action ($name);
ok ($action, "action $name");
$action->activate;
}
$main->destroy;
foreach my $toplevel (Gtk2::Window->list_toplevels) {
$toplevel->destroy;
}
MyTestHelpers::main_iterations();
}
#-----------------------------------------------------------------------------
# weakening
require Scalar::Util;
sub my_ignore {
my ($ref) = @_;
return (Scalar::Util::blessed($ref)
&& $ref->isa('Glib::Flags'));
devel/Main.t view on Meta::CPAN
# my $main = App::Chart::Gtk2::Main->new;
# # print "main $main\n";
# $main->goto_next;
# $main->destroy;
#
# # my $c = Glib::Object::all_closures();
# # diag $c, scalar @$c;
# # my $d = $c->[0];
# # diag $d, scalar @$d;
#
# MyTestHelpers::main_iterations();
# Scalar::Util::weaken ($main);
# is ($main, undef,
# 'garbage collect after destroy -- after goto_next');
# MyTestHelpers::findrefs($main);
# }
# {
# my $leaks = Test::Weaken::leaks
# ({ constructor => sub {
# my $main = App::Chart::Gtk2::Main->new;
devel/VacuumDialog.t view on Meta::CPAN
#------------------------------------------------------------------------------
SKIP: {
$have_display or skip 'due to no DISPLAY available', 2;
{
my $dialog = App::Chart::Gtk2::VacuumDialog->new;
$dialog->destroy;
require Scalar::Util;
Scalar::Util::weaken ($dialog);
MyTestHelpers::main_iterations();
is ($dialog, undef, 'garbage collect after destroy');
}
{
my $dialog = App::Chart::Gtk2::VacuumDialog->new;
$dialog->realize;
$dialog->destroy;
require Scalar::Util;
Scalar::Util::weaken ($dialog);
MyTestHelpers::main_iterations();
is ($dialog, undef, 'garbage collect after realize and destroy');
}
}
#------------------------------------------------------------------------------
# Test::Weaken 3 for "contents"
my $have_test_weaken = eval "use Test::Weaken 3; 1";
if (! $have_test_weaken) { diag "Test::Weaken 3 not available -- $@"; }
t/AnnotationsDialog.t view on Meta::CPAN
#------------------------------------------------------------------------------
SKIP: {
$have_display or skip 'due to no DISPLAY available', 2;
{
my $dialog = App::Chart::Gtk2::AnnotationsDialog->new;
$dialog->destroy;
require Scalar::Util;
Scalar::Util::weaken ($dialog);
MyTestHelpers::main_iterations();
is ($dialog, undef, 'garbage collect after destroy');
}
{
my $dialog = App::Chart::Gtk2::AnnotationsDialog->new;
$dialog->realize;
$dialog->destroy;
require Scalar::Util;
Scalar::Util::weaken ($dialog);
MyTestHelpers::main_iterations();
is ($dialog, undef, 'garbage collect after realize and destroy');
}
}
#------------------------------------------------------------------------------
# Test::Weaken 3 for "contents"
my $have_test_weaken = eval "use Test::Weaken 3; 1";
if (! $have_test_weaken) { diag "Test::Weaken 3 not available -- $@"; }
t/DeleteDialog.t view on Meta::CPAN
#------------------------------------------------------------------------------
SKIP: {
$have_display or skip 'due to no DISPLAY available', 2;
{
my $dialog = App::Chart::Gtk2::DeleteDialog->new;
$dialog->destroy;
require Scalar::Util;
Scalar::Util::weaken ($dialog);
MyTestHelpers::main_iterations();
is ($dialog, undef, 'garbage collect after destroy');
}
{
my $dialog = App::Chart::Gtk2::DeleteDialog->new;
$dialog->realize;
$dialog->destroy;
require Scalar::Util;
Scalar::Util::weaken ($dialog);
MyTestHelpers::main_iterations();
is ($dialog, undef, 'garbage collect after realize and destroy');
}
}
#------------------------------------------------------------------------------
# Test::Weaken 3 for "contents"
my $have_test_weaken = eval "use Test::Weaken 3; 1";
if (! $have_test_weaken) { diag "Test::Weaken 3 not available -- $@"; }
t/DeleteSymlistDialog.t view on Meta::CPAN
#------------------------------------------------------------------------------
SKIP: {
$have_display or skip 'due to no DISPLAY available', 2;
{
my $dialog = App::Chart::Gtk2::DeleteSymlistDialog->new;
$dialog->destroy;
require Scalar::Util;
Scalar::Util::weaken ($dialog);
MyTestHelpers::main_iterations();
is ($dialog, undef, 'garbage collect after destroy');
}
{
my $dialog = App::Chart::Gtk2::DeleteSymlistDialog->new;
$dialog->realize;
$dialog->destroy;
require Scalar::Util;
Scalar::Util::weaken ($dialog);
MyTestHelpers::main_iterations();
is ($dialog, undef, 'garbage collect after realize and destroy');
}
}
#------------------------------------------------------------------------------
# Test::Weaken 3 for "contents"
my $have_test_weaken = eval "use Test::Weaken 3; 1";
if (! $have_test_weaken) { diag "Test::Weaken 3 not available -- $@"; }
t/Diagnostics.t view on Meta::CPAN
my $have_display = Gtk2->init_check;
SKIP: {
$have_display or skip 'due to no DISPLAY available', 4;
{
my $dialog = App::Chart::Gtk2::Diagnostics->new;
require Scalar::Util;
Scalar::Util::weaken ($dialog);
$dialog->destroy;
MyTestHelpers::main_iterations();
is ($dialog, undef,
'garbage collect by weaken after destroy');
}
{
my $dialog = App::Chart::Gtk2::Diagnostics->new;
$dialog->show;
Scalar::Util::weaken ($dialog);
$dialog->destroy;
MyTestHelpers::main_iterations();
is ($dialog, undef,
'garbage collect by weaken after show and destroy');
}
{
my $dialog = App::Chart::Gtk2::Diagnostics->popup;
{
my $d2 = App::Chart::Gtk2::Diagnostics->popup;
ok ($dialog == $d2);
}
Scalar::Util::weaken ($dialog);
$dialog->destroy;
MyTestHelpers::main_iterations();
is ($dialog, undef,
'garbage collect popup by destroy and weaken');
}
}
exit 0;
t/IntradayDialog.t view on Meta::CPAN
require Gtk2;
Gtk2->disable_setlocale; # leave LC_NUMERIC alone for version nums
my $have_display = Gtk2->init_check;
SKIP: {
$have_display or skip 'due to no DISPLAY available', 2;
{
my $intraday = App::Chart::Gtk2::IntradayDialog->new;
$intraday->destroy;
MyTestHelpers::main_iterations();
require Scalar::Util;
Scalar::Util::weaken ($intraday);
is ($intraday, undef,
'garbage collect after destroy');
}
{
my $intraday = App::Chart::Gtk2::IntradayDialog->new;
$intraday->show;
$intraday->destroy;
MyTestHelpers::main_iterations();
Scalar::Util::weaken ($intraday);
is ($intraday, undef,
'garbage collect after show and destroy');
}
}
#------------------------------------------------------------------------------
# Test::Weaken 3 for "contents"
my $have_test_weaken = eval "use Test::Weaken 3; 1";
t/JobStopMenu.t view on Meta::CPAN
my $have_display = Gtk2->init_check;
SKIP: {
$have_display or skip 'due to no DISPLAY available', 2;
# destroyed when weakened with no job
{
my $menu = App::Chart::Gtk2::JobStopMenu->new;
require Scalar::Util;
Scalar::Util::weaken ($menu);
MyTestHelpers::main_iterations();
is ($menu, undef);
}
# destroyed when weakened with job
{
require App::Chart::Gtk2::Job;
my $job = App::Chart::Gtk2::Job->new;
my $menu = App::Chart::Gtk2::JobStopMenu->new (job => $job);
require Scalar::Util;
Scalar::Util::weaken ($menu);
MyTestHelpers::main_iterations();
is ($menu, undef);
}
}
exit 0;
t/MyTestHelpers.pm view on Meta::CPAN
# Don't want to load Exporter here since that could hide a problem of a
# module missing a "use Exporter". Though Test.pm and Test::More (via
# Test::Builder::Module) both use it anyway.
#
# use Exporter;
# use vars qw(@ISA @EXPORT_OK %EXPORT_TAGS);
# @ISA = ('Exporter');
# @EXPORT_OK = qw(findrefs
# main_iterations
# warn_suppress_gtk_icon
# glib_gtk_versions
# any_signal_connections
# nowarnings);
# %EXPORT_TAGS = (all => \@EXPORT_OK);
sub DEBUG { 0 }
#-----------------------------------------------------------------------------
t/MyTestHelpers.pm view on Meta::CPAN
MyTestHelpers::diag ("search ", $proberef);
MyTestHelpers::findrefs($proberef);
}
}
#-----------------------------------------------------------------------------
# Gtk/Glib helpers
# Gtk 2.16 can go into a hard loop on events_pending() / main_iteration_do()
# if dbus is not running, or something like that. In any case limiting the
# iterations is good for test safety.
#
sub main_iterations {
my $count = 0;
if (DEBUG) { MyTestHelpers::diag ("main_iterations() ..."); }
while (Gtk2->events_pending) {
$count++;
Gtk2->main_iteration_do (0);
if ($count >= 500) {
MyTestHelpers::diag ("main_iterations(): oops, bailed out after $count events/iterations");
return;
}
}
MyTestHelpers::diag ("main_iterations(): ran $count events/iterations");
}
# warn_suppress_gtk_icon() is a $SIG{__WARN__} handler which suppresses spam
# from Gtk trying to make you buy the hi-colour icon theme. Eg,
#
# {
# local $SIG{'__WARN__'} = \&MyTestHelpers::warn_suppress_gtk_icon;
# $something = SomeThing->new;
# }
#
t/MyTestHelpers.pm view on Meta::CPAN
# in Gtk 2.0 gdk_flush() is a sync actually
Gtk2::Gdk->flush;
}
my $count = 0;
while (! $done) {
if (DEBUG >= 2) { MyTestHelpers::diag ("wait_for_event() iteration $count"); }
Gtk2->main_iteration;
$count++;
}
MyTestHelpers::diag ("wait_for_event(): '$signame' ran $count events/iterations\n");
$widget->signal_handler_disconnect ($sig_id);
Glib::Source->remove ($timer_id);
}
#-----------------------------------------------------------------------------
# X11::Protocol helpers
sub X11_chosen_screen_number {
t/OpenDialog.t view on Meta::CPAN
require Gtk2;
Gtk2->disable_setlocale; # leave LC_NUMERIC alone for version nums
my $have_display = Gtk2->init_check;
SKIP: {
$have_display or skip 'due to no DISPLAY available', 2;
{
my $open = App::Chart::Gtk2::OpenDialog->new;
$open->destroy;
MyTestHelpers::main_iterations();
require Scalar::Util;
Scalar::Util::weaken ($open);
is ($open, undef,
'garbage collect after destroy');
}
{
my $open = App::Chart::Gtk2::OpenDialog->new;
$open->show;
$open->destroy;
MyTestHelpers::main_iterations();
Scalar::Util::weaken ($open);
is ($open, undef,
'garbage collect after show and destroy');
}
}
exit 0;
t/RawDialog.t view on Meta::CPAN
MyTestHelpers::glib_gtk_versions();
#------------------------------------------------------------------------------
{
my $dialog = App::Chart::Gtk2::RawDialog->new;
$dialog->destroy;
require Scalar::Util;
Scalar::Util::weaken ($dialog);
MyTestHelpers::main_iterations();
is ($dialog, undef, 'garbage collect after destroy');
}
{
my $dialog = App::Chart::Gtk2::RawDialog->new;
$dialog->realize;
$dialog->destroy;
require Scalar::Util;
Scalar::Util::weaken ($dialog);
MyTestHelpers::main_iterations();
is ($dialog, undef, 'garbage collect after realize and destroy');
}
#------------------------------------------------------------------------------
# Test::Weaken 3 for "contents"
my $have_test_weaken = eval "use Test::Weaken 3; 1";
if (! $have_test_weaken) { diag "Test::Weaken 3 not available -- $@"; }
t/TickerMain.t view on Meta::CPAN
SKIP: {
$have_display or skip 'due to no DISPLAY available', 3;
{
my $main = App::Chart::Gtk2::TickerMain->new;
$main->show;
my $ticker = $main->get('ticker') or die;
my $tickermodel = $ticker->get('model') or die;
$main->destroy;
MyTestHelpers::main_iterations();
require Scalar::Util;
Scalar::Util::weaken ($main);
is ($main, undef, 'garbage collect after destroy');
Scalar::Util::weaken ($ticker);
is ($ticker, undef, 'garbage collect Ticker after destroy');
Scalar::Util::weaken ($tickermodel);
is ($tickermodel, undef, 'garbage collect TickerModel after destroy');
}
t/WatchlistDialog.t view on Meta::CPAN
use App::Chart::Gtk2::WatchlistDialog;
require Gtk2;
Gtk2->init_check
or plan skip_all => 'due to no DISPLAY available';
plan tests => 2;
{
my $watchlist = App::Chart::Gtk2::WatchlistDialog->new;
$watchlist->destroy;
MyTestHelpers::main_iterations();
require Scalar::Util;
Scalar::Util::weaken ($watchlist);
is ($watchlist, undef, 'garbage collect after destroy');
}
{
my $watchlist = App::Chart::Gtk2::WatchlistDialog->new;
$watchlist->show;
$watchlist->destroy;
MyTestHelpers::main_iterations();
Scalar::Util::weaken ($watchlist);
is ($watchlist, undef, 'garbage collect after show and destroy');
}
# {
# my $watchlist = App::Chart::Gtk2::WatchlistDialog->popup;
# $watchlist->destroy;
# MyTestHelpers::main_iterations();
# Scalar::Util::weaken ($watchlist);
# is ($watchlist, undef, 'garbage collect popup');
# }
exit 0;