File: GnomeVFSDrive

package info (click to toggle)
libgnome2-vfs-perl 1.081-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 680 kB
  • sloc: perl: 1,195; ansic: 457; makefile: 2
file content (63 lines) | stat: -rw-r--r-- 1,692 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/perl -w
use strict;
use Gnome2::VFS;

use Test::More;

# $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/Gnome2-VFS/t/GnomeVFSDrive,v 1.3 2007/07/08 17:49:20 kaffeetisch Exp $

unless (-d "$ENV{ HOME }/.gnome") {
  plan(skip_all => "You have no ~/.gnome");
}

unless (Gnome2::VFS -> CHECK_VERSION(2, 6, 0)) {
  plan(skip_all => "This is new in 2.6");
}

plan(tests => 13);

Gnome2::VFS -> init();

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

my $monitor = Gnome2::VFS -> get_volume_monitor();
my $drive = ($monitor -> get_connected_drives())[0];

like($drive -> get_id(), qr/^\d+$/);
ok(defined $drive -> get_device_type());
ok(defined $drive -> get_device_path());
ok(defined $drive -> get_activation_uri());
ok(defined $drive -> get_display_name());
ok(defined $drive -> get_icon());

my $boolean = qr/^(?:1|)$/;

like($drive -> is_user_visible(), $boolean);
like($drive -> is_connected(), $boolean);
like($drive -> is_mounted(), $boolean);

is($drive -> compare($drive), 0);

SKIP: {
  skip("get_mounted_volumes and get_hal_udi are new in 2.8", 2)
    unless (Gnome2::VFS -> CHECK_VERSION(2, 8, 0));

  isa_ok(($drive -> get_mounted_volumes())[0], "Gnome2::VFS::Volume");
  ok(defined $drive -> get_hal_udi());
}

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

# $drive -> mount(sub { warn @_; });
# $drive -> unmount(sub { warn @_; });
# $drive -> eject(sub { warn @_; });

# use Gtk2 -init;
# Glib::Timeout -> add(1000, sub { Gtk2 -> main_quit(); 0; });
# Gtk2 -> main();

ok(!$drive -> needs_eject());

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

Gnome2::VFS -> shutdown();