MCPcopy Create free account
hub / github.com/GStreamer/gst-python / testFake

Method testFake

testsuite/old/test_bin.py:148–179  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

146 TestCase.tearDown(self)
147
148 def testFake(self):
149 src = gst.element_factory_make('fakesrc')
150 sink = gst.element_factory_make('fakesink')
151 self.bin.add(src)
152
153 # bin will go to paused, src pad task will start and error out
154 self.bin.set_state(gst.STATE_PAUSED)
155 ret = self.bin.get_state()
156 self.assertEquals(ret[0], gst.STATE_CHANGE_SUCCESS)
157 self.assertEquals(ret[1], gst.STATE_PAUSED)
158 self.assertEquals(ret[2], gst.STATE_VOID_PENDING)
159
160 # adding the sink will cause the bin to go in preroll mode
161 gst.debug('adding sink and setting to PAUSED, should cause preroll')
162 self.bin.add(sink)
163 sink.set_state(gst.STATE_PAUSED)
164 ret = self.bin.get_state(timeout=0)
165 self.assertEquals(ret[0], gst.STATE_CHANGE_ASYNC)
166 self.assertEquals(ret[1], gst.STATE_PAUSED)
167 self.assertEquals(ret[2], gst.STATE_PAUSED)
168
169 # to actually complete preroll, we need to link and re-enable fakesrc
170 src.set_state(gst.STATE_READY)
171 src.link(sink)
172 src.set_state(gst.STATE_PAUSED)
173 ret = self.bin.get_state()
174 self.assertEquals(ret[0], gst.STATE_CHANGE_SUCCESS)
175 self.assertEquals(ret[1], gst.STATE_PAUSED)
176 self.assertEquals(ret[2], gst.STATE_VOID_PENDING)
177
178 self.bin.set_state(gst.STATE_NULL)
179 self.bin.get_state()
180
181class ConstructorTest(TestCase):
182 def testGood(self):

Callers

nothing calls this directly

Calls 3

addMethod · 0.80
linkMethod · 0.80
get_stateMethod · 0.45

Tested by

no test coverage detected