Gtk2-Ex-ListModelConcat
view release on metacpan or search on metacpan
inc/my_pod2html
lib/Gtk2/Ex/ListModelConcat.pm
Makefile.PL
MANIFEST This list of files
MANIFEST.SKIP
README
SIGNATURE
t/ListModelConcat.t
t/MyTestHelpers.pm
t/overload.t
t/test-weaken.t
xt/0-examples-xrefs.t
xt/0-file-is-part-of.t
xt/0-META-read.t
xt/0-no-debug-left-on.t
xt/0-Test-ConsistentVersion.t
xt/0-Test-DistManifest.t
xt/0-Test-Pod.t
xt/0-Test-Synopsis.t
xt/0-Test-YAML-Meta.t
xtools/my-check-copyright-years.sh
SHA1 b5cd27eb336ee84d58e368b1cece3c279a4c97fd devel/reorder.pl
SHA1 319e3b80db2bd16abbd14621af293b4dc1ac2c8e devel/run.pl
SHA1 900f310bb0eac216d8c50c18441537dadcd4f75f examples/builder-append.pl
SHA1 0e045361167fbaaaab93ffa0242bc4f3655ed693 examples/builder-children.pl
SHA1 62d14d3f5d60569cca4bc38526bc180df982e2a4 examples/demo.pl
SHA1 2c31f38013695c85f0a75eb2c783989978aa298b inc/my_pod2html
SHA1 17139b494fda8e50deb4918ec9f463740d24b1ac lib/Gtk2/Ex/ListModelConcat.pm
SHA1 262158c2ed118a7dd761f7556a34e1c855b78fdb t/ListModelConcat.t
SHA1 47ebbf1d71ebdc462f51055161de9cd0838f45dc t/MyTestHelpers.pm
SHA1 259767d339c56da1a62571de9dfc6ecb34e494bd t/overload.t
SHA1 491ee63ac03f849199779889750e272b8ea53a29 t/test-weaken.t
SHA1 f2ceb7bb4bf68bd24728b90918e63d251fd06183 xt/0-META-read.t
SHA1 c9e7a47e1f397eb5f46d7e4ef21754d9df76e36e xt/0-Test-ConsistentVersion.t
SHA1 d9e7f38a8dcfdb76c56951e4214be8eeda2e2289 xt/0-Test-DistManifest.t
SHA1 9496e4a2a2734c7093ab6961900dd7a55800976e xt/0-Test-Pod.t
SHA1 083242d959c1a9242c874982e4585872a95bec93 xt/0-Test-Synopsis.t
SHA1 63abbc3297914cd38081e95588fd794f9d1f0306 xt/0-Test-YAML-Meta.t
SHA1 1cafa4e23b7a691e09161c0927e6920dd663e2ce xt/0-examples-xrefs.t
SHA1 4a897c9b09f37290f507d151e84b6a3c8defd496 xt/0-file-is-part-of.t
SHA1 aeb6f41dfae96d04459448f6c3e3dee44691e722 xt/0-no-debug-left-on.t
SHA1 51069b694ce78fde7d42ed539322fae579948d40 xtools/my-check-copyright-years.sh
lib/Gtk2/Ex/ListModelConcat.pm view on Meta::CPAN
@$models = @$newval; # copy input
require Glib::Ex::SignalIds;
my @signals;
$self->{'signals'} = \@signals;
my %done_reordered;
foreach my $i (0 .. $#$models) {
my $model = $models->[$i];
my $userdata = [ $self, $i ];
# weaken to avoid a circular reference which would prevent a Concat
# containing models from being garbage collected
Scalar::Util::weaken ($userdata->[0]);
# the reordered signal is only connected once if the model appears
# multiple times
my @reordered;
$done_reordered{Scalar::Util::refaddr($model)} ||= do {
push @reordered, $model->signal_connect
(rows_reordered => \&_do_rows_reordered, $userdata);
1;
};
push @signals, Glib::Ex::SignalIds->new
t/ListModelConcat.t view on Meta::CPAN
is ($concat->get_iter_first, undef);
is ($concat->iter_children(undef), undef);
is ($concat->get_iter(Gtk2::TreePath->new_from_indices(0)), undef);
is ($concat->get_iter(Gtk2::TreePath->new_from_indices(1)), undef);
is ($concat->get_iter(Gtk2::TreePath->new_from_indices(999)), undef);
ok (! $concat->iter_nth_child(undef,0));
ok (! $concat->iter_nth_child(undef,1));
ok (! $concat->iter_nth_child(undef,999));
require Scalar::Util;
Scalar::Util::weaken ($concat);
is ($concat, undef, 'empty garbage collected when weakened');
}
{ my $store = Gtk2::ListStore->new ('Glib::String');
my $concat = Gtk2::Ex::ListModelConcat->new;
$concat->set_property (models => [ $store ]);
is ($concat->get_n_columns, 1);
is ($concat->iter_n_children(undef), 0);
is ($concat->iter_children(undef), undef);
is ($concat->get_iter_first, undef);
Scalar::Util::weaken ($concat);
is ($concat, undef, 'garbage collected when weakened');
}
{ my $s1 = Gtk2::ListStore->new ('Glib::String');
my $s2 = Gtk2::ListStore->new ('Glib::String');
my $concat = Gtk2::Ex::ListModelConcat->new (models => [ $s1, $s2 ]);
is ($concat->get_n_columns, 1);
is ($concat->iter_n_children(undef), 0);
is ($concat->iter_children(undef), undef);
is ($concat->get_iter_first, undef);
Scalar::Util::weaken ($concat);
is ($concat, undef, 'garbage collected when weakened');
}
{ my $store = Gtk2::ListStore->new ('Glib::String');
$store->set_value ($store->insert(0), 0=>'zero');
my $concat = Gtk2::Ex::ListModelConcat->new (models => [ $store ]);
is ($concat->iter_n_children(undef), 1);
ok ($concat->iter_children(undef));
ok ($concat->get_iter(Gtk2::TreePath->new_from_indices(0)));
is ($concat->get_iter(Gtk2::TreePath->new_from_indices(1)), undef);
t/MyTestHelpers.pm view on Meta::CPAN
? "$obj->{$_}" : '[undef]')}
keys %$obj));
}
if (eval { require Devel::FindRef }) {
MyTestHelpers::diag (Devel::FindRef::track($obj, 8));
} else {
MyTestHelpers::diag ("Devel::FindRef not available -- ", $@);
}
}
sub test_weaken_show_leaks {
my ($leaks) = @_;
$leaks || return;
my $unfreed = $leaks->unfreed_proberefs;
my $unfreed_count = scalar(@$unfreed);
MyTestHelpers::diag ("Test-Weaken leaks $unfreed_count objects");
MyTestHelpers::dump ($leaks);
my $proberef;
foreach $proberef (@$unfreed) {
t/test-weaken.t view on Meta::CPAN
#
# You should have received a copy of the GNU General Public License along
# with Gtk2-Ex-ListModelConcat. If not, see <http://www.gnu.org/licenses/>.
use strict;
use warnings;
use Gtk2::Ex::ListModelConcat;
use Test::More;
my $have_test_weaken = eval "use Test::Weaken 2.000;
use Test::Weaken::Gtk2;
1";
if (! $have_test_weaken) {
plan skip_all => "due to Test::Weaken 2.000 and/or Test::Weaken::Gtk2 not available -- $@";
}
plan tests => 3;
diag ("Test::Weaken version ", Test::Weaken->VERSION);
require Gtk2;
#------------------------------------------------------------------------------
( run in 0.358 second using v1.01-cache-2.11-cpan-1f129e94a17 )