[perl-GStreamer] Fix a test failure in t/GstValue.t



commit 65de7f8f521e94d89ceb8308ba6a10565feb6a41
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Sat May 14 12:46:32 2011 +0200

    Fix a test failure in t/GstValue.t
    
    https://bugzilla.gnome.org/show_bug.cgi?id=649615
    https://rt.cpan.org/Public/Bug/Display.html?id=66736

 t/GstValue.t |   32 +++++++++++++++++++++++---------
 1 files changed, 23 insertions(+), 9 deletions(-)
---
diff --git a/t/GstValue.t b/t/GstValue.t
index a96db1c..511f5c3 100644
--- a/t/GstValue.t
+++ b/t/GstValue.t
@@ -1,18 +1,13 @@
 #!/usr/bin/perl
 use strict;
 use warnings;
-use Test::More tests => 2;
+use Test::More tests => 4;
 
 # $Id$
 
 use Glib qw(TRUE FALSE);
 use GStreamer -init;
 
-# Use UTC to make sure the timestamp means the same everywhere.  Hopefully,
-# this works on most systems.
-$ENV{TZ} = "UTC";
-my $time = 999993600; # 2001-09-09, 00:00
-
 my $structure = {
   name => "urgs",
   fields => [
@@ -25,7 +20,6 @@ my $structure = {
     [value_array_int_range => "GStreamer::ValueArray"    => [[[23, 42], "GStreamer::IntRange"]]],
     [fraction              => "GStreamer::Fraction"      => [23, 42]],
     [fraction_range        => "GStreamer::FractionRange" => [[23, 42], [42, 23]]],
-    [date                  => "GStreamer::Date"          => $time]
   ]
 };
 
@@ -44,8 +38,28 @@ my $exptected_string =
   . "value_array_int=(int)< 23, 42 >, "
   . "value_array_int_range=(int)< [ 23, 42 ] >, "
   . "fraction=(fraction)23/42, "
-  . "fraction_range=(fraction)[ 23/42, 42/23 ], "
-  . "date=(GstDate)2001-09-09";
+  . "fraction_range=(fraction)[ 23/42, 42/23 ]";
 
 is($string, $exptected_string);
 is_deeply(GStreamer::Structure::from_string($string), $structure);
+
+# The date handling changed slightly, so we test it separately.
+{
+  # Use UTC to make sure the timestamp means the same everywhere.  Hopefully,
+  # this works on most systems.
+  $ENV{TZ} = "UTC";
+  my $time = 999993600; # 2001-09-09, 00:00
+
+  my $structure = {
+    name => "urgs",
+    fields => [
+      [date => "GStreamer::Date" => $time]
+    ]
+  };
+
+  my $string = GStreamer::Structure::to_string($structure);
+  $string =~ s/;\Z//;
+
+  like($string, qr/date=\(GstDate|date\)2001-09-09/);
+  is_deeply(GStreamer::Structure::from_string($string), $structure);
+}



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