[pitivi] test_integration.py: add scrubContext() method
- From: Edward Hervey <edwardrv src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [pitivi] test_integration.py: add scrubContext() method
- Date: Fri, 20 Nov 2009 07:47:48 +0000 (UTC)
commit f1ed6894c2743f95b710bffa3ed6573ff3a3e6db
Author: Brandon Lewis <brandon_lewis alum berkeley edu>
Date: Wed Oct 28 14:19:47 2009 -0700
test_integration.py: add scrubContext() method
tests/test_integration.py | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/tests/test_integration.py b/tests/test_integration.py
index 8f96a18..1bacdd2 100644
--- a/tests/test_integration.py
+++ b/tests/test_integration.py
@@ -264,5 +264,36 @@ class TestTimeline(Base):
if not getattr(timelineObject, prop) == value:
raise Exception("'%s'.%s != %r" % (uri, prop, value))
+ def scrubContext(self, context, finalTime, finalPriority, callback=None,
+ delay=100, maxtime = 7200 * gst.SECOND, maxpriority =10, steps = 10):
+ """ Scrubs an editing context as if a user were frantically dragging a
+ clips with the mouse """
+
+ self._scrubContext = context
+ self._scrubTime = finalTime
+ self._scrubPriority = finalPriority
+ self._scrubMaxPriority = maxpriority
+ self._scrubMaxTime = maxtime
+ self._scrubCount = 0
+ self._scrubSteps = steps
+ self._scrubCallback = callback
+
+ self.watchdog.keepAlive()
+ gobject.timeout_add(delay, self._scrubTimeoutCb)
+
+ def _scrubTimeoutCb(self):
+ time_ = random.randint(0, self._scrubMaxTime)
+ priority = random.randint(0, self._scrubMaxPriority)
+ self._scrubContext.editTo(time_, priority)
+ self._scrubCount += 1
+ self.watchdog.keepAlive()
+
+ if self._scrubCount < self._scrubSteps:
+ return True
+ else:
+ self._scrubContext.editTo(self._scrubTime, self._scrubPriority)
+ self._scrubCallback()
+ return False
+
if __name__ == "__main__":
unittest.main()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]