summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Decina <alessandro.d@gmail.com>2010-07-26 19:41:43 +0200
committerAlessandro Decina <alessandro.d@gmail.com>2010-07-26 19:42:39 +0200
commit92a1c11ed3dc07b5c7022ce1fd440909ddab9949 (patch)
treefc0e4c65548e834e136fa1cbbb1d036b61f139e3
parente20157bda2efe24f0847d38dd5810428347169b2 (diff)
test_fraction: add a test for gobject property marshalling.
-rw-r--r--testsuite/test_fraction.py27
1 files changed, 25 insertions, 2 deletions
diff --git a/testsuite/test_fraction.py b/testsuite/test_fraction.py
index 6ec80c2..c67a0ef 100644
--- a/testsuite/test_fraction.py
+++ b/testsuite/test_fraction.py
@@ -18,6 +18,8 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+import gobject
+gobject.threads_init()
from common import gst, TestCase
F = gst.Fraction
@@ -73,5 +75,26 @@ class TestFraction(TestCase):
def testFloat(self):
self.assertEquals(float(F(1, 2)), 0.5)
-
-
+ def testPropertyMarshalling(self):
+ try:
+ obj = gst.element_factory_make("videoparse")
+ except gst.ElementNotFoundError:
+ # no videoparse and I don't know of any elements in core or -base using
+ # fraction properties. Skip this test.
+ return
+ value = obj.props.framerate
+ self.failUnlessEqual(value.num, 25)
+ self.failUnlessEqual(value.denom, 1)
+
+ obj.props.framerate = gst.Fraction(2, 1)
+ value = obj.props.framerate
+ self.failUnlessEqual(value.num, 2)
+ self.failUnlessEqual(value.denom, 1)
+
+ def bad():
+ obj.props.framerate = 1
+ self.failUnlessRaises(TypeError, bad)
+
+ value = obj.props.framerate
+ self.failUnlessEqual(value.num, 2)
+ self.failUnlessEqual(value.denom, 1)