From 8b9edb951b38c017f86bd9cfd8557dcb0c15a60b Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Thu, 5 Aug 2004 14:25:58 +0000 Subject: [PATCH] add testsuite for struct Original commit message from CVS: add testsuite for struct --- ChangeLog | 5 +++++ testsuite/struct.py | 29 +++++++++++++++++++++++++++++ testsuite/test_struct.py | 29 +++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 testsuite/struct.py create mode 100644 testsuite/test_struct.py diff --git a/ChangeLog b/ChangeLog index 82f0e699ae..203f0c18e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-08-05 Thomas Vander Stichele + + * testsuite/struct.py: + add a testsuite for structs, not yet active + 2004-08-03 Johan Dahlin * configure.ac: Require python 2.3 diff --git a/testsuite/struct.py b/testsuite/struct.py new file mode 100644 index 0000000000..449cfe4c7b --- /dev/null +++ b/testsuite/struct.py @@ -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() diff --git a/testsuite/test_struct.py b/testsuite/test_struct.py new file mode 100644 index 0000000000..449cfe4c7b --- /dev/null +++ b/testsuite/test_struct.py @@ -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()