[perl-GStreamer-Interfaces] Make the GstPropertyProbe test more robust



commit 41f8afef4597f6d361b161247b0a69b7adb49684
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Sat Mar 6 20:47:36 2010 +0100

    Make the GstPropertyProbe test more robust

 t/GstPropertyProbe.t |   48 +++++++++++++++++++++++++++++-------------------
 1 files changed, 29 insertions(+), 19 deletions(-)
---
diff --git a/t/GstPropertyProbe.t b/t/GstPropertyProbe.t
index be9e603..a9f4f12 100644
--- a/t/GstPropertyProbe.t
+++ b/t/GstPropertyProbe.t
@@ -1,9 +1,7 @@
 #!/usr/bin/perl
 use strict;
 use warnings;
-use Test::More tests => 9;
-
-# $Id$
+use Test::More tests => 5;
 
 use Glib qw(TRUE FALSE);
 use GStreamer -init;
@@ -16,19 +14,31 @@ my $element = GStreamer::ElementFactory -> make($plugin => "element");
 isa_ok($element, "GStreamer::PropertyProbe");
 
 my @pspecs = $element -> get_probe_properties();
-isa_ok($pspecs[0], "Glib::ParamSpec");
-
-my $pspec = $element -> get_probe_property("device");
-isa_ok($pspec, "Glib::ParamSpec");
-
-is($element -> needs_probe($pspec), TRUE);
-$element -> probe_property($pspec);
-
-ok($element -> get_probe_values($pspec));
-ok($element -> probe_and_get_probe_values($pspec));
-
-ok(defined $element -> needs_probe_name($property));
-$element -> probe_property_name($property);
-
-ok($element -> get_probe_values_name($property));
-ok($element -> probe_and_get_probe_values_name($property));
+SKIP: {
+  skip 'got no probe properties', 8
+    unless @pspecs;
+  isa_ok($pspecs[0], "Glib::ParamSpec");
+}
+
+my $pspec = $element -> get_probe_property($property);
+SKIP: {
+  skip 'did not get desired property', 3
+    unless defined $pspec;
+
+  isa_ok($pspec, "Glib::ParamSpec");
+
+  ok(defined $element -> needs_probe($pspec));
+  $element -> probe_property($pspec);
+
+  my @values;
+  # these might return an empty list, apparently
+  @values = $element -> get_probe_values($pspec);
+  @values = $element -> probe_and_get_probe_values($pspec);
+
+  ok(defined $element -> needs_probe_name($property));
+  $element -> probe_property_name($property);
+
+  # these might return an empty list too, apparently
+  @values = $element -> get_probe_values_name($property);
+  @values = $element -> probe_and_get_probe_values_name($property);
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]