File: GstIndex.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 (66 lines) | stat: -rw-r--r-- 1,701 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
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 15;

# $Id$

use GStreamer -init;

my $index = GStreamer::Index -> new();
isa_ok($index, "GStreamer::Index");

$index -> commit(23);

is($index -> new_group(), 1);
ok($index -> set_group(1));
is($index -> get_group(), 1);

$index -> set_certainty("fuzzy");
is($index -> get_certainty(), "fuzzy");

$index -> set_filter(sub { warn @_; 1; }, "bla");

my $object = GStreamer::ElementFactory -> make("alsasink", "sink");
SKIP: {
  skip 'index entry tests: failed to create an alsasink', 10
    unless defined $object;

  # Called by get_writer_id()
  $index -> set_resolver(sub {
    my ($index, $element, $data) = @_;

    isa_ok($index, "GStreamer::Index");
    isa_ok($element, "GStreamer::Element");
    is($data, "blub");

    return "urgs";
  }, "blub");

  my $id = $index -> get_writer_id($object);
  skip 'index entry tests: failed to obtain a writer id', 7
    unless defined $id;

  my $entry = $index -> add_format($id, "bytes");
  isa_ok($entry, "GStreamer::IndexEntry");

  $entry = $index -> add_association($id, "key-unit", bytes => 12, time => 13);
  isa_ok($entry, "GStreamer::IndexEntry");
  is($entry -> assoc_map("bytes"), 12);
  is($entry -> assoc_map("time"), 13);

  $entry = $index -> add_object($id, "urgs", $object);
  TODO: {
    local $TODO = 'add_object always returns undef';
    isa_ok($entry, "GStreamer::IndexEntry");
  }

  $entry = $index -> add_id($id, "sgru");
  isa_ok($entry, "GStreamer::IndexEntry");

  $entry = $index -> get_assoc_entry($id, "exact", "key-unit", bytes => 12);
  TODO: {
    local $TODO = 'get_assoc_entry always returns undef';
    isa_ok($entry, "GStreamer::IndexEntry");
  }
}