File: GstBus.t

package info (click to toggle)
libgstreamer-perl 0.19-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 900 kB
  • ctags: 59
  • sloc: perl: 2,456; ansic: 32; makefile: 6
file content (51 lines) | stat: -rw-r--r-- 1,004 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
#!/usr/bin/perl
use strict;
use warnings;
use Glib qw(TRUE FALSE);
use Test::More tests => 14;

# $Id$

use GStreamer -init;

my $bus = GStreamer::Bus -> new();
isa_ok($bus, "GStreamer::Bus");

my $src = GStreamer::Bin -> new("urgs");
my $message = GStreamer::Message::EOS -> new($src);

ok($bus -> post($message));
ok($bus -> have_pending());

isa_ok($bus -> peek(), "GStreamer::Message");
isa_ok($bus -> pop(), "GStreamer::Message");

is($bus -> peek(), undef);
is($bus -> pop(), undef);

$bus -> set_flushing(FALSE);

is($bus -> poll("any", 0), undef);

$bus -> add_signal_watch();
$bus -> remove_signal_watch();

my $loop = Glib::MainLoop -> new();

Glib::Idle -> add(sub { $bus -> post($message); $bus -> post($message); FALSE; });
my $id = $bus -> add_watch(sub {
  my ($bussy, $messy, $data) = @_;
  my $i = 0 if 0;

  is($bussy, $bus);
  isa_ok($messy, "GStreamer::Message::EOS");
  is($data, "bla");

  $loop -> quit() if $i++;

  TRUE;
}, "bla");

$loop -> run();

Glib::Source -> remove($id);