summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas (at) apestaart (dot) org>2009-06-01 22:02:47 +0200
committerThomas Vander Stichele <thomas (at) apestaart (dot) org>2009-06-01 22:02:47 +0200
commit26fa6dd184a8d6d103eaddf5f12bd7e5144413fb (patch)
treefefbf938926ac36dbbb7f69be7f45d1deb8a41bd /testsuite
parent88f3323bfe15ae6aee762ba64588980b6036d4ea (diff)
wrap gst_tag_to_vorbis_comment; fix uint tag setting
Setting gst.TAG_TRACK_NUMBER was failing because GStreamer expects a uint while Python object -> GValue conversion was giving an int. gst_tag_to_vorbis_comment was wrapped so this conversion could be tested and failed on properly.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/common.py11
-rw-r--r--testsuite/test_pipeline.py32
-rw-r--r--testsuite/test_taglist.py6
3 files changed, 48 insertions, 1 deletions
diff --git a/testsuite/common.py b/testsuite/common.py
index 5ec46f4..cc81745 100644
--- a/testsuite/common.py
+++ b/testsuite/common.py
@@ -78,6 +78,17 @@ except ImportError:
file = gst.interfaces.__file__
assert file.startswith(path), 'bad gst.interfaces path: %s' % file
+# gst's tags is in topbuilddir/gst
+path = os.path.abspath(os.path.join(topbuilddir, 'gst'))
+try:
+ import gst.tag
+except ImportError:
+ # hack: we import it from our builddir/gst/.libs instead; ugly
+ import tag
+ gst.tag = tag
+file = gst.tag.__file__
+assert file.startswith(path), 'bad gst.tag path: %s' % file
+
# gst's pbutils is in topbuilddir/gst
path = os.path.abspath(os.path.join(topbuilddir, 'gst'))
try:
diff --git a/testsuite/test_pipeline.py b/testsuite/test_pipeline.py
index a84b988..a57c7f9 100644
--- a/testsuite/test_pipeline.py
+++ b/testsuite/test_pipeline.py
@@ -73,6 +73,38 @@ class Pipeline(TestCase):
self.pipeline.set_state(gst.STATE_NULL)
self.assertEqual(self.pipeline.get_state()[1], gst.STATE_NULL)
+class PipelineTags(TestCase):
+ def setUp(self):
+ self.gctrack()
+ self.pipeline = gst.parse_launch('audiotestsrc num-buffers=100 ! vorbisenc name=encoder ! oggmux name=muxer ! fakesink')
+
+ def tearDown(self):
+ del self.pipeline
+ self.gccollect()
+ self.gcverify()
+
+ def testRun(self):
+ # in 0.10.15.1, this triggers
+ # sys:1: gobject.Warning: g_value_get_uint: assertion `G_VALUE_HOLDS_UINT (value)' failed
+ # during pipeline playing
+
+ l = gst.TagList()
+ l[gst.TAG_ARTIST] = 'artist'
+ l[gst.TAG_TRACK_NUMBER] = 1
+ encoder = self.pipeline.get_by_name('encoder')
+ encoder.merge_tags(l, gst.TAG_MERGE_APPEND)
+
+ self.assertEqual(self.pipeline.get_state()[1], gst.STATE_NULL)
+ self.pipeline.set_state(gst.STATE_PLAYING)
+ self.assertEqual(self.pipeline.get_state()[1], gst.STATE_PLAYING)
+
+ time.sleep(1)
+
+ self.assertEqual(self.pipeline.get_state()[1], gst.STATE_PLAYING)
+ self.pipeline.set_state(gst.STATE_NULL)
+ self.assertEqual(self.pipeline.get_state()[1], gst.STATE_NULL)
+
+
class Bus(TestCase):
def testGet(self):
pipeline = gst.Pipeline('test')
diff --git a/testsuite/test_taglist.py b/testsuite/test_taglist.py
index 227a812..2b94918 100644
--- a/testsuite/test_taglist.py
+++ b/testsuite/test_taglist.py
@@ -64,4 +64,8 @@ class TestTagList(TestCase):
self.failUnless(isinstance(taglist[gst.TAG_ARTIST], unicode))
self.assertEquals(taglist[gst.TAG_ARTIST], u'S\xc3\xadgur R\xc3\xb3s')
-
+ def testUnsignedInt(self):
+ taglist = gst.TagList()
+ taglist[gst.TAG_TRACK_NUMBER] = 1
+ vorbis = gst.tag.to_vorbis_comments(taglist, gst.TAG_TRACK_NUMBER)
+ self.assertEquals(vorbis, ['TRACKNUMBER=1'])