File: 00-init.t

package info (click to toggle)
libgtk3-perl 0.030-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 388 kB
  • ctags: 107
  • sloc: perl: 4,030; makefile: 11
file content (44 lines) | stat: -rw-r--r-- 1,044 bytes parent folder | download
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
#!/usr/bin/env perl

use strict;
use warnings;

use Test::More;

BEGIN { require Gtk3; }
unless (eval { Gtk3->import; 1 }) {
  my $error = $@;
  if (eval { $error->isa ('Glib::Error') &&
             $error->domain eq 'g-irepository-error-quark'})
  {
    BAIL_OUT ("OS unsupported: $error");
  } else {
    BAIL_OUT ("Cannot load Gtk3: $error");
  }
}

plan tests => 3;

diag (sprintf 'Testing against gtk+ %d.%d.%d',
      Gtk3::get_major_version (),
      Gtk3::get_minor_version (),
      Gtk3::get_micro_version ());

SKIP: {
  @ARGV = qw(--help --name gtk2perl --urgs tree);
  skip 'Gtk3::init_check failed, probably unable to open DISPLAY', 2
    unless Gtk3::init_check ();
  Gtk3::init ();
  is_deeply (\@ARGV, [qw(--help --urgs tree)]);

  # Ensure that version parsing still works after the setlocale() done by
  # Gtk3::init().
  ok (defined eval 'use 5.8.0; 1');
}

# Ensure that error messages are reported at the point in the program, not in
# Gtk3.pm.
{
  eval { my $b = Gtk3::LinkButton->new; };
  like ($@, qr/00-init\.t/);
}