add Element () constructor add testsuite

Original commit message from CVS:
add Element () constructor
add testsuite
This commit is contained in:
Thomas Vander Stichele 2003-10-04 13:37:45 +00:00
parent 7a7a6d1ca9
commit a21c60b089
6 changed files with 80 additions and 3 deletions

View file

@ -1,3 +1,12 @@
2003-10-04 Thomas Vander Stichele <thomas at apestaart dot org>
* Makefile.am: add testsuite dir
* configure.ac: bump to cvs version nano, add testsuite Makefile
* testsuite/Makefile.am: testsuite
* testsuite/element.py: test for Element class
* gstreamer/gstreamer.overrides: add a wrapper for Element ()
* gstreamer/gstreamer-extra.defs: add a constructor for Element
2003-07-10 David I. Lehn <dlehn@users.sourceforge.net>
* AUTHORS, NEWS, README, TODO, README-docs, Makefile.am, configure.ac,

View file

@ -4,9 +4,9 @@ else
SUBDIRS_DOCS =
endif
SUBDIRS = gstreamer pkgconfig examples $(SUBDIRS_DOCS)
SUBDIRS = gstreamer pkgconfig examples $(SUBDIRS_DOCS) testsuite
DIST_SUBDIRS = gstreamer pkgconfig examples docs
DIST_SUBDIRS = gstreamer pkgconfig examples docs testsuite
EXTRA_DIST = \
gst-python.spec.in gst-python.spec README-docs

View file

@ -3,7 +3,7 @@ AC_PREREQ(2.54)
AC_INIT
AC_CANONICAL_TARGET
AS_VERSION(gst-python, GST_PYTHON_VERSION, 0, 1, 0, 0)
AS_VERSION(gst-python, GST_PYTHON_VERSION, 0, 1, 0, 1)
AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
AC_CONFIG_SRCDIR([gstreamer/gstreamermodule.c])
@ -153,5 +153,6 @@ AC_OUTPUT([
examples/gstreamer/Makefile
docs/Makefile
docs/gst-python.ent
testsuite/Makefile
gst-python.spec
])

5
testsuite/Makefile.am Normal file
View file

@ -0,0 +1,5 @@
testprogs = element.py
TESTS = $(testprogs)
check_SCRIPTS = $(testprogs)

31
testsuite/element.py Normal file
View file

@ -0,0 +1,31 @@
#!/usr/bin/python
#
# testsuite for gstreamer.Element
import sys
from gstreamer import *
def fail (message):
'print reason for failing and leave'
print "FAILED: %s" % message
sys.exit (-1)
# create an element we know exists
src = 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")
except RuntimeError: result = 1
if result == 0: fail ("creating an unexistant element didn't generate a RuntimeError")
# create a sink
sink = Element ("fakesink", "sink")
# link
src.link (sink)
sys.exit (0)

31
testsuite/test_element.py Normal file
View file

@ -0,0 +1,31 @@
#!/usr/bin/python
#
# testsuite for gstreamer.Element
import sys
from gstreamer import *
def fail (message):
'print reason for failing and leave'
print "FAILED: %s" % message
sys.exit (-1)
# create an element we know exists
src = 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")
except RuntimeError: result = 1
if result == 0: fail ("creating an unexistant element didn't generate a RuntimeError")
# create a sink
sink = Element ("fakesink", "sink")
# link
src.link (sink)
sys.exit (0)