[pitivi] dogtail tests: Use the Tears of Steel sample clip and cleanup test_timeline
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] dogtail tests: Use the Tears of Steel sample clip and cleanup test_timeline
- Date: Sat, 20 Oct 2012 20:25:25 +0000 (UTC)
commit 4d7886dee9ac41436037bf1b86b224ddb7bf8871
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date: Fri Oct 19 13:49:33 2012 -0400
dogtail tests: Use the Tears of Steel sample clip and cleanup test_timeline
There were two helper methods ensuring that inserting clips was also tested with
the media library's popup menu. However, this popup menu does not exist anymore.
tests/dogtail_scripts/helper_functions.py | 2 +-
tests/dogtail_scripts/test_project.py | 11 ++++--
tests/dogtail_scripts/test_timeline.py | 53 ++++++++++------------------
3 files changed, 28 insertions(+), 38 deletions(-)
---
diff --git a/tests/dogtail_scripts/helper_functions.py b/tests/dogtail_scripts/helper_functions.py
index 4e09c6a..5bc2dba 100644
--- a/tests/dogtail_scripts/helper_functions.py
+++ b/tests/dogtail_scripts/helper_functions.py
@@ -75,7 +75,7 @@ class HelpFunc(BaseDogTail):
self.insert_button.click()
icon.deselect()
- def import_media(self, filename="1sec_simpsons_trailer.mp4"):
+ def import_media(self, filename="tears of steel.webm"):
dogtail.rawinput.pressKey("Esc") # Ensure the welcome dialog is closed
self.import_button.click()
diff --git a/tests/dogtail_scripts/test_project.py b/tests/dogtail_scripts/test_project.py
index d96cf3f..6561a79 100644
--- a/tests/dogtail_scripts/test_project.py
+++ b/tests/dogtail_scripts/test_project.py
@@ -4,6 +4,11 @@ from dogtail.predicate import IsATextEntryNamed, GenericPredicate
from time import time, sleep
import os
+# These are the timecodes we expect for "tears of steel.webm", depending on
+# if we insert it once in a blank timeline or twice in a blank timeline.
+DURATION_OF_ONE_CLIP = "0:00:01.999"
+DURATION_OF_TWO_CLIPS = "0:00:03.999"
+
class ProjectPropertiesTest(HelpFunc):
def test_settings_video(self):
@@ -160,7 +165,7 @@ class ProjectPropertiesTest(HelpFunc):
self.insert_clip(sample)
self.goToEnd_button = self.viewer.child(name="goToEnd_button")
self.goToEnd_button.click()
- self.assertEqual(seektime.text, "0:00:01.227")
+ self.assertEqual(seektime.text, DURATION_OF_ONE_CLIP)
#It should save after 10 seconds if no changes made
self.assertTrue(self.wait_for_file(backup_path), "Backup not created")
@@ -261,7 +266,7 @@ class ProjectPropertiesTest(HelpFunc):
icons = self.medialibrary.findChildren(GenericPredicate(roleName="icon"))
self.goToEnd_button.click()
self.assertEqual(len(icons), 1)
- self.assertEqual(seektime.text, "0:00:01.227")
+ self.assertEqual(seektime.text, DURATION_OF_ONE_CLIP)
self.assertFalse(infobar_media.showing)
#Load second, check if populated
@@ -269,5 +274,5 @@ class ProjectPropertiesTest(HelpFunc):
icons = self.medialibrary.findChildren(GenericPredicate(roleName="icon"))
self.goToEnd_button.click()
self.assertEqual(len(icons), 2)
- self.assertEqual(seektime.text, "0:00:02.455")
+ self.assertEqual(seektime.text, DURATION_OF_TWO_CLIPS)
self.assertFalse(infobar_media.showing)
diff --git a/tests/dogtail_scripts/test_timeline.py b/tests/dogtail_scripts/test_timeline.py
index f3d794e..9db4d41 100644
--- a/tests/dogtail_scripts/test_timeline.py
+++ b/tests/dogtail_scripts/test_timeline.py
@@ -6,34 +6,19 @@ from time import sleep
from pyatspi import Registry as registry
from pyatspi import (KEY_SYM, KEY_PRESS, KEY_PRESSRELEASE, KEY_RELEASE)
+# These are the timecodes we expect for "tears of steel.webm", depending on
+# if we insert it once in a blank timeline or twice in a blank timeline.
+DURATION_OF_ONE_CLIP = "0:00:01.999"
+DURATION_OF_TWO_CLIPS = "0:00:03.999"
+
class TimelineTest(HelpFunc):
def setUp(self):
super(TimelineTest, self).setUp()
self.goToEnd_button = self.viewer.child(name="goToEnd_button")
- def help_test_insertEnd(self):
- # Test insertion with the right-click popup menu
- sample = self.import_media()
- seektime = self.viewer.child(name="timecode_entry").child(roleName="text")
- self.assertIsNotNone(seektime)
- # TODO: remove the help_test_insertEnd* methods, the menu is deprecated
- sample.click(3)
- buttons = self.pitivi.findChildren(
- GenericPredicate(name="Insert at End of Timeline"))
- buttons[1].click()
- self.goToEnd_button.click()
- self.assertEqual(seektime.text, "0:00:01.227")
-
- #Add one more
- sample.click(3)
- buttons = self.pitivi.findChildren(
- GenericPredicate(name="Insert at End of Timeline"))
- buttons[1].click()
- self.goToEnd_button.click()
- self.assertEqual(seektime.text, "0:00:02.455")
-
- def help_test_insertEndFast(self):
+ def insertTwoClipsAndSeekToEnd(self):
+ # Just a small helper method to facilitate timeline setup
sample = self.import_media()
self.insert_clip(sample, 2)
self.goToEnd_button.click()
@@ -73,9 +58,9 @@ class TimelineTest(HelpFunc):
oldseek = seektime.text
def test_split(self):
- self.help_test_insertEnd()
+ self.insertTwoClipsAndSeekToEnd()
seektime = self.viewer.child(name="timecode_entry").child(roleName="text")
- self.assertEqual(seektime.text, "0:00:02.455")
+ self.assertEqual(seektime.text, DURATION_OF_TWO_CLIPS)
timeline = self.timeline
#Adjust to different screen sizes
adj = (float)(timeline.size[0]) / 883
@@ -86,19 +71,19 @@ class TimelineTest(HelpFunc):
self.timeline_toolbar.child(name="Delete", roleName="push button").click()
self.goToEnd_button.click()
- self.assertEqual(seektime.text, "0:00:02.455")
+ self.assertEqual(seektime.text, DURATION_OF_TWO_CLIPS)
dogtail.rawinput.click(timeline.position[0] + 550 * adj, timeline.position[1] + 50)
dogtail.rawinput.pressKey("Del")
#self.timeline_toolbar.child(name="Delete", roleName="push button").click()
self.goToEnd_button.click()
- self.assertEqual(seektime.text, "0:00:01.227")
+ self.assertEqual(seektime.text, DURATION_OF_ONE_CLIP)
def test_multiple_split(self):
- self.help_test_insertEndFast()
+ self.insertTwoClipsAndSeekToEnd()
seektime = self.viewer.child(name="timecode_entry").child(roleName="text")
- self.assertEqual(seektime.text, "0:00:02.455")
+ self.assertEqual(seektime.text, DURATION_OF_TWO_CLIPS)
#Adjust to different screen sizes
adj = (float)(self.timeline.size[0]) / 883
tpos = self.timeline.position
@@ -113,9 +98,9 @@ class TimelineTest(HelpFunc):
self.pitivi.child(roleName="icon")
def test_transition(self):
- self.help_test_insertEndFast()
+ self.insertTwoClipsAndSeekToEnd()
seektime = self.viewer.child(name="timecode_entry").child(roleName="text")
- self.assertEqual(seektime.text, "0:00:02.455")
+ self.assertEqual(seektime.text, DURATION_OF_TWO_CLIPS)
tpos = self.timeline.position
#Adjust to different screen sizes
@@ -159,9 +144,9 @@ class TimelineTest(HelpFunc):
return maxx - timeline.position[0] + 5
def test_riple_roll(self):
- self.help_test_insertEndFast()
+ self.insertTwoClipsAndSeekToEnd()
seektime = self.viewer.child(name="timecode_entry").child(roleName="text")
- self.assertEqual(seektime.text, "0:00:02.455")
+ self.assertEqual(seektime.text, DURATION_OF_TWO_CLIPS)
tpos = self.timeline.position
end = self.search_clip_end(30, seektime, self.timeline)
@@ -174,7 +159,7 @@ class TimelineTest(HelpFunc):
dogtail.rawinput.release(tpos[0] + end / 2 - 100, tpos[1] + 30)
registry.generateKeyboardEvent(dogtail.rawinput.keyNameToKeyCode("Control_L"), None, KEY_RELEASE)
self.goToEnd_button.click()
- self.assertNotEqual(seektime.text, "0:00:02.455", "Not ripled, but trimed")
+ self.assertNotEqual(seektime.text, DURATION_OF_TWO_CLIPS, "Not rippled, but trimmed")
#Regresion test of adding effect
#Add effect
@@ -199,7 +184,7 @@ class TimelineTest(HelpFunc):
self.assertNotEqual(seektime.text, seekbefore, "Not ripled affter adding effect")
def test_image_video_mix(self):
- files = ["1sec_simpsons_trailer.mp4", "flat_colour2_640x480.png",
+ files = ["tears of steel.webm", "flat_colour2_640x480.png",
"flat_colour4_1600x1200.jpg", "flat_colour1_640x480.png",
"flat_colour3_320x180.png", "flat_colour5_1600x1200.jpg"]
samples = self.import_media_multiple(files)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]