~ubuntu-branches/ubuntu/natty/kdebindings/natty

« back to all changes in this revision

Viewing changes to perl/qttest/lib/QtTest4.pm

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-12-01 11:14:38 UTC
  • mfrom: (1.1.41 upstream)
  • Revision ID: james.westby@ubuntu.com-20101201111438-1q61cvs8zw118t3m
Tags: 4:4.5.80-0ubuntu1
* New upstream release
* Remove build-dep on libqimageblitz-dev, causes smoke to segfault

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#***************************************************************************
 
2
#                          QtTest4.pm  -  QtTest perl client lib
 
3
#                             -------------------
 
4
#    begin                : 07-12-2009
 
5
#    copyright            : (C) 2009 by Chris Burel
 
6
#    email                : chrisburel@gmail.com
 
7
# ***************************************************************************
 
8
 
 
9
#***************************************************************************
 
10
# *                                                                         *
 
11
# *   This program is free software; you can redistribute it and/or modify  *
 
12
# *   it under the terms of the GNU General Public License as published by  *
 
13
# *   the Free Software Foundation; either version 2 of the License, or     *
 
14
# *   (at your option) any later version.                                   *
 
15
# *                                                                         *
 
16
# ***************************************************************************
 
17
 
 
18
package QtTest4::_internal;
 
19
 
 
20
use strict;
 
21
use warnings;
 
22
use QtCore4;
 
23
use base qw(Qt::_internal);
 
24
 
 
25
sub init {
 
26
    @Qt::_internal::vectorTypes{qw(Qt::SignalSpy Qt::TestEventList)} = undef;
 
27
    foreach my $c ( @{getClassList()} ) {
 
28
        QtTest4::_internal->init_class($c);
 
29
    }
 
30
    foreach my $e ( @{getEnumList()} ) {
 
31
        QtTest4::_internal->init_enum($e);
 
32
    }
 
33
}
 
34
 
 
35
package QtTest4;
 
36
 
 
37
use strict;
 
38
use warnings;
 
39
use QtCore4;
 
40
 
 
41
require XSLoader;
 
42
 
 
43
our $VERSION = '0.01';
 
44
 
 
45
XSLoader::load('QtTest4', $VERSION);
 
46
 
 
47
QtTest4::_internal::init();
 
48
 
 
49
use Exporter;
 
50
use base qw(Exporter);
 
51
our @EXPORT_OK = qw( QCOMPARE QVERIFY QTEST_MAIN );
 
52
 
 
53
sub QCOMPARE {
 
54
}
 
55
 
 
56
sub QTEST_MAIN {
 
57
    my ($class) = @_;
 
58
    my $classPm = $class;
 
59
    $classPm =~ s/::/\//g;
 
60
    $classPm .= '.pm';
 
61
    require $classPm;
 
62
    $class->import();
 
63
    my $app = Qt::Application(\@ARGV);
 
64
    no strict 'refs';
 
65
    my $test = &$class();
 
66
    use strict;
 
67
    unshift @ARGV, $0;
 
68
    return Qt::Test::qExec($test, scalar @ARGV, \@ARGV);
 
69
}
 
70
 
 
71
sub QVERIFY {
 
72
    my ($statement, $description) = @_;
 
73
    return Qt::Test::qVerify(
 
74
        $statement,
 
75
        '',
 
76
        $description,
 
77
        (caller(1))[1],
 
78
        (caller(1))[2]
 
79
    );
 
80
}
 
81
 
 
82
package Qt::SignalSpy;
 
83
 
 
84
sub EXTEND {
 
85
}
 
86
 
 
87
package Qt::SignalSpy::_overload;
 
88
 
 
89
use overload
 
90
    '==' => \&op_equality;
 
91
 
 
92
package Qt::TestEventList;
 
93
 
 
94
sub EXTEND {
 
95
}
 
96
 
 
97
package Qt::TestEventList::_overload;
 
98
 
 
99
use overload
 
100
    '==' => \&op_equality;
 
101
 
 
102
1;