File: vfuncs-destroy.t

package info (click to toggle)
libgtk3-perl 0.038-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 380 kB
  • sloc: perl: 4,228; makefile: 11
file content (47 lines) | stat: -rw-r--r-- 910 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env perl

BEGIN { require './t/inc/setup.pl' };

use strict;
use warnings;

plan tests => 2;

# Make sure that we can safely inherit from classes which have a "destroy"
# vfunc.
{
  my $label_destroy_called = 0;
  my $label_destroy_chain_called = 0;

  package MyLabel;
  use Glib::Object::Subclass
    Gtk3::Label::
    ;
  # no DESTROY_VFUNC override

  package MyLabelDestroy;
  use Glib::Object::Subclass
    Gtk3::Label::
    ;
  sub DESTROY_VFUNC {
    $label_destroy_called++;
  }

  package MyLabelDestroyChain;
  use Glib::Object::Subclass
    Gtk3::Label::
    ;
  sub DESTROY_VFUNC {
    $label_destroy_chain_called++;
    $_[0]->SUPER::DESTROY_VFUNC ();
  }

  package main;
  {
    my $label = MyLabel->new;
    my $label_destroy = MyLabelDestroy->new;
    my $label_destroy_chan = MyLabelDestroyChain->new;
  }
  is ($label_destroy_called, 1);
  is ($label_destroy_chain_called, 1);
}