mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
pyges : Improve the test suite
This commit is contained in:
parent
f43d26e319
commit
fc21eb395a
11 changed files with 229 additions and 60 deletions
11
bindings/python/testsuite/test_global_functions.py
Normal file
11
bindings/python/testsuite/test_global_functions.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
import glib
|
||||
import gst
|
||||
|
||||
from common import TestCase
|
||||
from gst import ges
|
||||
|
||||
class GlobalFunctions(TestCase):
|
||||
|
||||
def testGlobalFunctions(self):
|
||||
tl = ges.timeline_new_audio_video()
|
||||
tr = ges.timeline_standard_transition_new_for_nick("crossfade")
|
21
bindings/python/testsuite/test_layer.py
Normal file
21
bindings/python/testsuite/test_layer.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
import glib
|
||||
import gst
|
||||
|
||||
from common import TestCase
|
||||
from gst import ges
|
||||
|
||||
class Layer(TestCase):
|
||||
|
||||
def testLayer(self):
|
||||
lyr = ges.TimelineLayer()
|
||||
tl = ges.Timeline()
|
||||
src = ges.TimelineTestSource()
|
||||
|
||||
lyr.set_timeline(tl)
|
||||
|
||||
assert (lyr.add_object(src) == True)
|
||||
self.failIf(len (lyr.get_objects()) != 1)
|
||||
assert (lyr.remove_object(src) == True)
|
||||
|
||||
lyr.set_priority(1)
|
||||
self.failIf(lyr.get_priority() != 1)
|
22
bindings/python/testsuite/test_simple_layer.py
Normal file
22
bindings/python/testsuite/test_simple_layer.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
import glib
|
||||
import gst
|
||||
|
||||
from common import TestCase
|
||||
from gst import ges
|
||||
|
||||
class SimpleLayer(TestCase):
|
||||
|
||||
def testSimpleLayer(self):
|
||||
lyr = ges.SimpleTimelineLayer()
|
||||
tl = ges.Timeline()
|
||||
src = ges.TimelineTestSource()
|
||||
src2 = ges.TimelineTestSource()
|
||||
|
||||
lyr.set_timeline(tl)
|
||||
|
||||
assert (lyr.add_object(src, 0) == True)
|
||||
assert (lyr.add_object(src2, 1) == True)
|
||||
assert (lyr.nth(0) == src)
|
||||
assert (lyr.move_object (src, 1) == True)
|
||||
self.failIf(lyr.index(src) != 1)
|
||||
assert (lyr.is_valid() == True)
|
|
@ -2,44 +2,59 @@ import gst
|
|||
|
||||
from common import TestCase
|
||||
from gst import ges
|
||||
from time import sleep
|
||||
|
||||
class Timeline(TestCase):
|
||||
class TextOverlay(TestCase):
|
||||
|
||||
def testTimeline(self):
|
||||
def testTextOverlay(self):
|
||||
|
||||
tl = ges.timeline_new_audio_video()
|
||||
lyr = ges.SimpleTimelineLayer()
|
||||
src = ges.TimelineTestSource()
|
||||
pip = ges.TimelinePipeline()
|
||||
ovrl = ges.TimelineTextOverlay()
|
||||
bus = pip.get_bus()
|
||||
lyr = ges.TimelineLayer()
|
||||
tl = ges.timeline_new_audio_video()
|
||||
tck = tl.get_tracks()[0]
|
||||
|
||||
# Let's add the layer to the timeline, and the sources to the layer.
|
||||
|
||||
tl.add_layer(lyr)
|
||||
src.set_duration(long(gst.SECOND * 10))
|
||||
ovrl.set_duration(long(gst.SECOND * 5))
|
||||
ovrl.set_start(long(gst.SECOND * 5))
|
||||
ovrl.set_text("Foo")
|
||||
self.failIf (ovrl.get_text() != "Foo")
|
||||
ovrl.set_font_desc ("Arial")
|
||||
self.failIf (ovrl.get_font_desc() != "Arial")
|
||||
ovrl.set_valign("top")
|
||||
self.failIf (ovrl.get_valignment().value_name != "top")
|
||||
ovrl.set_halign("left")
|
||||
self.failIf (ovrl.get_halignment().value_name != "left")
|
||||
|
||||
lyr.add_object(src, -1)
|
||||
lyr.add_object(ovrl, -1)
|
||||
#We will test Timeline Object class functions here
|
||||
|
||||
pip.add_timeline(tl)
|
||||
bus.set_sync_handler(self.bus_handler)
|
||||
ovrl.set_start(long(100))
|
||||
ovrl.set_inpoint(long(50))
|
||||
ovrl.set_duration(long(500))
|
||||
ovrl.set_priority(2)
|
||||
ovrl.set_layer(lyr)
|
||||
tck_obj = ovrl.create_track_object(tck)
|
||||
self.failIf (ovrl.release_track_object(tck_obj) != True)
|
||||
self.failIf (ovrl.add_track_object(tck_obj) != True)
|
||||
self.failIf (len(ovrl.get_track_objects()) != 1)
|
||||
self.failIf (ovrl.get_layer() != lyr)
|
||||
ovrl.release_track_object(tck_obj)
|
||||
|
||||
self.pipeline = pip
|
||||
self.layer = lyr
|
||||
#We test TrackTextOverlay and TrackObject here
|
||||
tck_obj.set_text("Bar")
|
||||
self.failIf (tck_obj.get_text() != "Bar")
|
||||
tck_obj.set_font_desc ("Arial")
|
||||
self.failIf (tck_obj.get_font_desc() != "Arial")
|
||||
tck_obj.set_valignment("top")
|
||||
self.failIf (tck_obj.get_valignment().value_name != "top")
|
||||
tck_obj.set_halignment("left")
|
||||
self.failIf (tck_obj.get_halignment().value_name != "left")
|
||||
|
||||
#Mainloop is finished, tear down.
|
||||
self.pipeline = None
|
||||
|
||||
|
||||
def bus_handler(self, unused_bus, message):
|
||||
if message.type == gst.MESSAGE_ERROR:
|
||||
print "ERROR"
|
||||
self.mainloop.quit()
|
||||
elif message.type == gst.MESSAGE_EOS:
|
||||
print "Done"
|
||||
self.mainloop.quit()
|
||||
return gst.BUS_PASS
|
||||
tck_obj.set_locked(False)
|
||||
self.failIf (tck_obj.is_locked() != False)
|
||||
tck_obj.set_start(long(100))
|
||||
tck_obj.set_inpoint(long(50))
|
||||
tck_obj.set_duration(long(500))
|
||||
tck_obj.set_priority(2)
|
||||
self.failIf (tck_obj.get_start() != 100)
|
||||
self.failIf (tck_obj.get_inpoint() != 50)
|
||||
self.failIf (tck_obj.get_duration() != 500)
|
||||
self.failIf (tck_obj.get_priority() != 2)
|
||||
tck_obj.set_timeline_object(ovrl)
|
||||
self.failIf(tck_obj.get_timeline_object() != ovrl)
|
||||
|
|
|
@ -10,35 +10,13 @@ class Timeline(TestCase):
|
|||
|
||||
tl = ges.timeline_new_audio_video()
|
||||
lyr = ges.SimpleTimelineLayer()
|
||||
src = ges.TimelineTestSource()
|
||||
pip = ges.TimelinePipeline()
|
||||
bus = pip.get_bus()
|
||||
tck_src = ges.TrackAudioTestSource()
|
||||
self.mainloop = glib.MainLoop()
|
||||
tck = ges.track_audio_raw_new()
|
||||
|
||||
a = tck_src.list_children_properties()
|
||||
|
||||
#Let's add the layer to the timeline, and the source to the layer.
|
||||
src.set_duration(long(gst.SECOND * 10))
|
||||
src.set_vpattern("Random (television snow)")
|
||||
assert (tl.add_track(tck) == True)
|
||||
#We should have two tracks from the timeline_new_audio_video() function + 1
|
||||
self.failIf(len(tl.get_tracks()) != 3)
|
||||
assert (tl.remove_track(tck) == True)
|
||||
|
||||
assert (tl.add_layer(lyr) == True)
|
||||
assert (lyr.add_object(src, -1) == True)
|
||||
self.failIf(len(src.get_track_objects()) != 2)
|
||||
assert (pip.add_timeline(tl) == True)
|
||||
|
||||
bus.set_sync_handler(self.bus_handler)
|
||||
|
||||
self.pipeline = pip
|
||||
self.layer = lyr
|
||||
|
||||
#Mainloop is finished, tear down.
|
||||
self.pipeline = None
|
||||
|
||||
|
||||
def bus_handler(self, unused_bus, message):
|
||||
if message.type == gst.MESSAGE_ERROR:
|
||||
print "ERROR"
|
||||
elif message.type == gst.MESSAGE_EOS:
|
||||
print "Done"
|
||||
return gst.BUS_PASS
|
||||
self.failIf(len(tl.get_layers()) != 1)
|
||||
assert (tl.remove_layer(lyr) == True)
|
||||
|
|
18
bindings/python/testsuite/test_timeline_file_source.py
Normal file
18
bindings/python/testsuite/test_timeline_file_source.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
import gst
|
||||
|
||||
from common import TestCase
|
||||
from gst import ges
|
||||
|
||||
class TimelineFileSource(TestCase):
|
||||
|
||||
def testTimelineFileSource(self):
|
||||
src = ges.TimelineFileSource("blahblahblah")
|
||||
|
||||
src.set_mute(True)
|
||||
src.set_max_duration(long(100))
|
||||
src.set_supported_formats("video")
|
||||
assert (src.get_supported_formats().value_nicks[0] == "video")
|
||||
src.set_is_image(True)
|
||||
assert (src.get_max_duration() == 100)
|
||||
assert (src.is_image() == True)
|
||||
assert (src.get_uri() == "blahblahblah")
|
|
@ -0,0 +1,24 @@
|
|||
import gst
|
||||
|
||||
from common import TestCase
|
||||
from gst import ges
|
||||
from time import sleep
|
||||
|
||||
class ParseLaunchEffect(TestCase):
|
||||
|
||||
def testParseLaunchEffect(self):
|
||||
tl = ges.Timeline()
|
||||
tck = ges.track_video_raw_new()
|
||||
lyr = ges.TimelineLayer()
|
||||
efct = ges.TimelineParseLaunchEffect("agingtv", None)
|
||||
tck_efct = ges.TrackParseLaunchEffect("agingtv")
|
||||
|
||||
tl.add_layer(lyr)
|
||||
efct.add_track_object(tck_efct)
|
||||
lyr.add_object(efct)
|
||||
tck.set_timeline(tl)
|
||||
tck.add_object(tck_efct)
|
||||
tck_efct.set_child_property("GstAgingTV::scratch-lines", 17)
|
||||
self.failIf(tck_efct.get_child_property("GstAgingTV::scratch-lines") != 17)
|
||||
self.failIf(len(tck_efct.list_children_properties()) != 6)
|
||||
self.failIf (tck_efct.lookup_child ("scratch-lines") == None)
|
14
bindings/python/testsuite/test_timeline_pipeline.py
Normal file
14
bindings/python/testsuite/test_timeline_pipeline.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
import glib
|
||||
import gst
|
||||
|
||||
from common import TestCase
|
||||
from gst import ges
|
||||
|
||||
class TimelinePipeline(TestCase):
|
||||
|
||||
def testTimelinePipeline(self):
|
||||
stgs = gst.pbutils.EncodingAudioProfile(gst.Caps("video/x-dirac"), "test", gst.caps_new_any(), 0)
|
||||
ppln = ges.TimelinePipeline()
|
||||
tl = ges.Timeline()
|
||||
assert (ppln.add_timeline (tl) == True)
|
||||
assert (ppln.set_mode("TIMELINE_MODE_PREVIEW_AUDIO") == True)
|
19
bindings/python/testsuite/test_timeline_test_source.py
Normal file
19
bindings/python/testsuite/test_timeline_test_source.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
import glib
|
||||
import gst
|
||||
|
||||
from common import TestCase
|
||||
from gst import ges
|
||||
|
||||
class TimelineTestSource(TestCase):
|
||||
|
||||
def testTimelineTestSource(self):
|
||||
src = ges.TimelineTestSource()
|
||||
tck_src = ges.TrackAudioTestSource()
|
||||
src.set_mute(True)
|
||||
src.set_vpattern("snow")
|
||||
src.set_frequency(880)
|
||||
src.set_volume (1)
|
||||
assert (src.get_vpattern() != None)
|
||||
assert (src.is_muted() == True)
|
||||
assert (src.get_frequency() == 880)
|
||||
assert (src.get_volume() == 1)
|
23
bindings/python/testsuite/test_timeline_title_source.py
Normal file
23
bindings/python/testsuite/test_timeline_title_source.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
import gst
|
||||
|
||||
from common import TestCase
|
||||
from gst import ges
|
||||
|
||||
class TimelineTitleSource(TestCase):
|
||||
|
||||
def testTimelineTitleSource(self):
|
||||
src = ges.TimelineTitleSource()
|
||||
lyr = ges.TimelineLayer()
|
||||
tck = ges.track_video_raw_new()
|
||||
|
||||
src.set_text("Foo")
|
||||
self.failIf (src.get_text() != "Foo")
|
||||
src.set_font_desc ("Arial")
|
||||
self.failIf (src.get_font_desc() != "Arial")
|
||||
src.set_valignment("top")
|
||||
assert (src.get_valignment().value_name == "top")
|
||||
src.set_halignment("left")
|
||||
assert (src.get_halignment().value_name == "left")
|
||||
src.set_mute(True)
|
||||
assert (src.is_muted() == True)
|
||||
|
24
bindings/python/testsuite/test_track.py
Normal file
24
bindings/python/testsuite/test_track.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
import gst
|
||||
|
||||
from common import TestCase
|
||||
from gst import ges
|
||||
|
||||
class Track(TestCase):
|
||||
|
||||
def testTrack(self):
|
||||
tck = ges.track_video_raw_new()
|
||||
tl = ges.Timeline()
|
||||
lyr = ges.TimelineLayer()
|
||||
src = ges.TimelineTestSource()
|
||||
caps = gst.caps_from_string("image/jpeg")
|
||||
obj = ges.TrackParseLaunchEffect ("agingtv")
|
||||
|
||||
tl.add_layer(lyr)
|
||||
src.add_track_object(obj)
|
||||
lyr.add_object(src)
|
||||
tck.set_timeline(tl)
|
||||
|
||||
assert (tck.add_object(obj) == True)
|
||||
assert (tck.get_timeline() == tl)
|
||||
tck.set_caps(caps)
|
||||
assert (tck.get_caps().to_string() == "image/jpeg")
|
Loading…
Reference in a new issue