~ubuntu-branches/ubuntu/quantal/libglib-perl/quantal

« back to all changes in this revision

Viewing changes to t/tied_set_property.t

  • Committer: Bazaar Package Importer
  • Author(s): Jeffrey Ratcliffe
  • Date: 2010-07-28 07:36:48 UTC
  • mfrom: (0.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100728073648-aiohmszaldj3bio4
Tags: 2:1.223-1
* New upstream release
* Bumped epoch to replace previous (unstable) release with this stable one.
* Standards-Version 3.9.1 (no changes)
* Add myself to Uploaders
* Update patched file paths, refresh all patches
* Updated watchfile to only report stable releases

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl
2
 
 
3
 
package main;
4
 
use strict;
5
 
use warnings;
6
 
use Test::More tests => 1;
7
 
 
8
 
#------------------------------------------------------------------------------
9
 
 
10
 
package MaiTai;
11
 
use strict;
12
 
use warnings;
13
 
 
14
 
sub TIESCALAR {
15
 
  my ($class) = @_;
16
 
  return bless {}, $class;
17
 
}
18
 
 
19
 
my $mai_tai_store_called;
20
 
 
21
 
sub STORE {
22
 
  my ($self) = @_;
23
 
  $mai_tai_store_called = 1;
24
 
}
25
 
 
26
 
#------------------------------------------------------------------------------
27
 
 
28
 
package MyObject;
29
 
use strict;
30
 
use warnings;
31
 
use Glib;
32
 
 
33
 
use Glib::Object::Subclass
34
 
  Glib::Object::,
35
 
  properties => [ Glib::ParamSpec->int ('myprop',
36
 
                                        'myprop',
37
 
                                        'Blurb',
38
 
                                        0, 100,
39
 
                                        0,
40
 
                                        [qw/writable readable/]),
41
 
                ];
42
 
 
43
 
sub INIT_INSTANCE {
44
 
  my $self = shift;
45
 
  tie $self->{'myprop'}, 'MaiTai';
46
 
}
47
 
 
48
 
#------------------------------------------------------------------------------
49
 
 
50
 
package main;
51
 
my $obj = MyObject->new;
52
 
 
53
 
$mai_tai_store_called = 0;
54
 
$obj->set (myprop => 50);
55
 
is ($mai_tai_store_called, 1,
56
 
    'MaiTai tied store function called');
57
 
 
58
 
exit 0;