File: GnomeProgram.t

package info (click to toggle)
libgnome2-perl 1.045-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 608 kB
  • ctags: 12
  • sloc: perl: 1,145; ansic: 16; makefile: 4
file content (65 lines) | stat: -rw-r--r-- 2,227 bytes parent folder | download | duplicates (2)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/perl -w
use strict;
use Glib qw(:constants);
use Gnome2;

use constant TESTS => 9;
use Test::More tests => TESTS;

# $Id$

###############################################################################

SKIP: {
  skip("You don't appear to have the GNOME session manager running.", TESTS)
    unless (-d "$ENV{ HOME }/.gconfd" &&
            -d "$ENV{ HOME }/.gnome2");

  skip("Couldn't initialize Gtk2", TESTS)
    unless (Gtk2 -> init_check());

  skip("Couldn't connect to the session manager.", TESTS)
    unless (Gnome2::Client -> new() -> connected());

  #############################################################################

  Gnome2::Program -> module_register("libgnome");
  ok(Gnome2::Program -> module_registered("libgnome"));

  # FIXME
  # isa_ok(Gnome2::Program -> module_load("/usr/lib/libgnome-2.so"),
  #        "Gnome2::ModuleInfo");

  @ARGV = qw(--name bla --class blub --urgs);

  my $application;

  if (Gnome2 -> CHECK_VERSION (2, 8, 0)) {
    $application = Gnome2::Program -> init("Test",
                                           "0.1",
                                           "libgnomeui",
                                           app_prefix => "/gtk2perl",
                                           app_sysconfdir => "/gtk2perl/etc",
                                           human_readable_name => "Test",
                                           sm_connect => FALSE);
  }
  else {
    $application = Gnome2::Program -> init("Test",
                                           "0.1",
                                           "libgnomeui",
                                           app_prefix => "/gtk2perl",
                                           app_sysconfdir => "/gtk2perl/etc");
  }

  is_deeply([$application -> get(qw(app_prefix app_sysconfdir))], [qw(/gtk2perl /gtk2perl/etc)]);
  is_deeply(\@ARGV, [qw(--name bla --class blub --urgs)]);

  isa_ok($application, "Gnome2::Program");
  is($application -> get_program(), $application);

  is($application -> get_human_readable_name(), "Test");
  is($application -> get_app_id(), "Test");
  is($application -> get_app_version(), "0.1");

  ok(-e $application -> locate_file("libdir", "libgnome-2.so", 1));
}