2004-03-05 Johan Dahlin <johan@gnome.org>
+ * testsuite/element.py: Update to new api
+
* codegen/*: Copy PyGTK code generator here, to avoid depending on
latest version.
# testsuite for gstreamer.Element
import sys
-from gstreamer import *
+sys.path.insert(0, '..')
-def fail (message):
+import gst
+
+def fail(message):
'print reason for failing and leave'
print "FAILED: %s" % message
- sys.exit (-1)
+ sys.exit(-1)
# create an element we know exists
-src = Element ("fakesrc", "source")
-if not src: fail ("Can't create fakesrc Element")
+src = gst.Element("fakesrc", "source")
+if not src:
+ fail("Can't create fakesrc Element")
# create an element we know doesn't exist
nope = None
result = 0
try:
- nope = Element ("idontexist", "none")
+ nope = gst.Element("idontexist", "none")
except RuntimeError: result = 1
-if result == 0: fail ("creating an unexistant element didn't generate a RuntimeError")
+if result == 0:
+ fail("creating an unexistant element didn't generate a RuntimeError")
# create a sink
-sink = Element ("fakesink", "sink")
+sink = gst.Element("fakesink", "sink")
# link
-src.link (sink)
+if not src.link(sink):
+ fail("could not link")
-sys.exit (0)
+sys.exit(0)
# testsuite for gstreamer.Element
import sys
-from gstreamer import *
+sys.path.insert(0, '..')
-def fail (message):
+import gst
+
+def fail(message):
'print reason for failing and leave'
print "FAILED: %s" % message
- sys.exit (-1)
+ sys.exit(-1)
# create an element we know exists
-src = Element ("fakesrc", "source")
-if not src: fail ("Can't create fakesrc Element")
+src = gst.Element("fakesrc", "source")
+if not src:
+ fail("Can't create fakesrc Element")
# create an element we know doesn't exist
nope = None
result = 0
try:
- nope = Element ("idontexist", "none")
+ nope = gst.Element("idontexist", "none")
except RuntimeError: result = 1
-if result == 0: fail ("creating an unexistant element didn't generate a RuntimeError")
+if result == 0:
+ fail("creating an unexistant element didn't generate a RuntimeError")
# create a sink
-sink = Element ("fakesink", "sink")
+sink = gst.Element("fakesink", "sink")
# link
-src.link (sink)
+if not src.link(sink):
+ fail("could not link")
-sys.exit (0)
+sys.exit(0)