File: GstEvent.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 (117 lines) | stat: -rw-r--r-- 3,618 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 53;

# $Id$

use GStreamer -init;
use Glib qw(TRUE FALSE);

my $structure = {
  name => "urgs",
  fields => [
    [field_one => "Glib::String" => "urgs"],
    [field_two => "Glib::Int" => 23]
  ]
};

my $event = GStreamer::Event::Custom -> new("seek", $structure);
isa_ok($event, "GStreamer::Event::Seek");
isa_ok($event, "GStreamer::Event");
isa_ok($event, "GStreamer::MiniObject");

is_deeply($event -> get_structure(), $structure);

# --------------------------------------------------------------------------- #

$event = GStreamer::Event::FlushStart -> new();
isa_ok($event, "GStreamer::Event::FlushStart");
isa_ok($event, "GStreamer::Event");
isa_ok($event, "GStreamer::MiniObject");

# --------------------------------------------------------------------------- #

$event = GStreamer::Event::FlushStop -> new();
isa_ok($event, "GStreamer::Event::FlushStop");
isa_ok($event, "GStreamer::Event");
isa_ok($event, "GStreamer::MiniObject");

# --------------------------------------------------------------------------- #

$event = GStreamer::Event::EOS -> new();
isa_ok($event, "GStreamer::Event::EOS");
isa_ok($event, "GStreamer::Event");
isa_ok($event, "GStreamer::MiniObject");

# --------------------------------------------------------------------------- #

$event = GStreamer::Event::NewSegment -> new(TRUE, 1.0, "time", 1, 2, 3);
isa_ok($event, "GStreamer::Event::NewSegment");
isa_ok($event, "GStreamer::Event");
isa_ok($event, "GStreamer::MiniObject");

ok($event -> update());
is($event -> rate(), 1.0);
is($event -> format(), "time");
is($event -> start_value(), 1);
is($event -> stop_value(), 2);
is($event -> stream_time(), 3);

# --------------------------------------------------------------------------- #

my $tag = { title => ["Urgs"], artist => [qw(Screw You)] };

$event = GStreamer::Event::Tag -> new($tag);
isa_ok($event, "GStreamer::Event::Tag");
isa_ok($event, "GStreamer::Event");
isa_ok($event, "GStreamer::MiniObject");

is_deeply($event -> tag(), $tag);

# --------------------------------------------------------------------------- #

$event = GStreamer::Event::Navigation -> new($structure);
isa_ok($event, "GStreamer::Event::Navigation");
isa_ok($event, "GStreamer::Event");
isa_ok($event, "GStreamer::MiniObject");

is_deeply($event -> get_structure(), $structure);

# --------------------------------------------------------------------------- #

$event = GStreamer::Event::BufferSize -> new("time", 1, 2, TRUE);
isa_ok($event, "GStreamer::Event::BufferSize");
isa_ok($event, "GStreamer::Event");
isa_ok($event, "GStreamer::MiniObject");

is($event -> format(), "time");
is($event -> minsize(), 1);
is($event -> maxsize(), 2);
ok($event -> async());

# --------------------------------------------------------------------------- #

$event = GStreamer::Event::QOS -> new(1.0, 23, 42);
isa_ok($event, "GStreamer::Event::QOS");
isa_ok($event, "GStreamer::Event");
isa_ok($event, "GStreamer::MiniObject");

is($event -> proportion(), 1.0);
is($event -> diff(), 23);
is($event -> timestamp(), 42);

# --------------------------------------------------------------------------- #

$event = GStreamer::Event::Seek -> new(1.0, "time", [qw(flush accurate)], "cur", 23, "set", 42);
isa_ok($event, "GStreamer::Event::Seek");
isa_ok($event, "GStreamer::Event");
isa_ok($event, "GStreamer::MiniObject");

is($event -> rate(), 1.0);
is($event -> format(), "time");
ok($event -> flags() == [qw(flush accurate)]);
is($event -> cur_type(), "cur");
is($event -> cur(), 23);
is($event -> stop_type(), "set");
is($event -> stop(), 42);