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

# $Id$

use GStreamer -init;

my $bin = GStreamer::Bin -> new("urgs");
my $factory = GStreamer::ElementFactory -> find("alsasink");

SKIP: {
  skip 'failed to create an alsasink factory', 32
    unless defined $factory;

  my $element_one = $factory -> create("sink one");
  my $element_two = $factory -> create("sink two");
  my $element_three = $factory -> create("sink three");
  my $element_four = $factory -> create("sink four");

  $bin -> add($element_one, $element_two, $element_three, $element_four);

  foreach ($bin -> iterate_elements(),
           $bin -> iterate_sorted(),
           $bin -> iterate_recurse(),
           $bin -> iterate_sinks()) {
    isa_ok($_, "GStreamer::Iterator");
    isa_ok($_, "ARRAY");
    is($#$_, 3);
    is($_ -> [0], $element_four);
    is($_ -> [1], $element_three);
    is($_ -> [2], $element_two);
    is($_ -> [3], $element_one);
  }

  my $iter = $bin -> iterate_elements();
  while ($_ = $iter -> next()) {
    isa_ok($_, "GStreamer::Element");
  }
}