add testsuite for struct

Original commit message from CVS:
add testsuite for struct
This commit is contained in:
Thomas Vander Stichele 2004-08-05 14:25:58 +00:00
parent 169626bb24
commit 8b9edb951b
3 changed files with 63 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2004-08-05 Thomas Vander Stichele <thomas at apestaart dot org>
* testsuite/struct.py:
add a testsuite for structs, not yet active
2004-08-03 Johan Dahlin <johan@gnome.org>
* configure.ac: Require python 2.3

29
testsuite/struct.py Normal file
View file

@ -0,0 +1,29 @@
import sys
from common import gst, unittest
class StructureTest(unittest.TestCase):
def fixmetestStructureChange(self):
caps = gst.caps_from_string('video/x-raw-yuv,width=10,pixel-aspect-ratio=1/2,framerate=5.0')
structure = caps.get_structure(0)
assert structure['width'] == 10
structure['width'] = 5
assert structure['width'] == 5
#assert structure['pixel-aspect-ratio'].numerator == 1
#assert structure['pixel-aspect-ratio'].denominator == 2
#assert float(structure['pixel-aspect-ratio']) == 0.5
#structure['pixel-aspect-ratio'] = gst.Fraction(3, 4)
#assert structure['pixel-aspect-ratio'].numerator == 3
#assert structure['pixel-aspect-ratio'].denominator == 4
#assert float(structure['pixel-aspect-ratio']) == 0.75
assert structure['framerate'] == 5.0
structure['framerate'] = 10.0
assert structure['framerate'] == 10.0
# a list of heights
structure['height'] = (20, 40, 60)
assert structure['width'] == (20, 40, 60)
# FIXME: add ranges
if __name__ == "__main__":
unittest.main()

29
testsuite/test_struct.py Normal file
View file

@ -0,0 +1,29 @@
import sys
from common import gst, unittest
class StructureTest(unittest.TestCase):
def fixmetestStructureChange(self):
caps = gst.caps_from_string('video/x-raw-yuv,width=10,pixel-aspect-ratio=1/2,framerate=5.0')
structure = caps.get_structure(0)
assert structure['width'] == 10
structure['width'] = 5
assert structure['width'] == 5
#assert structure['pixel-aspect-ratio'].numerator == 1
#assert structure['pixel-aspect-ratio'].denominator == 2
#assert float(structure['pixel-aspect-ratio']) == 0.5
#structure['pixel-aspect-ratio'] = gst.Fraction(3, 4)
#assert structure['pixel-aspect-ratio'].numerator == 3
#assert structure['pixel-aspect-ratio'].denominator == 4
#assert float(structure['pixel-aspect-ratio']) == 0.75
assert structure['framerate'] == 5.0
structure['framerate'] = 10.0
assert structure['framerate'] == 10.0
# a list of heights
structure['height'] = (20, 40, 60)
assert structure['width'] == (20, 40, 60)
# FIXME: add ranges
if __name__ == "__main__":
unittest.main()