[pitivi] dogtail tests: Fix the project saving helper function
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] dogtail tests: Fix the project saving helper function
- Date: Wed, 25 Jul 2012 11:56:23 +0000 (UTC)
commit 062bdb975a8654e8b6a5163f90dc811c62446843
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date: Sat Jul 21 00:27:07 2012 -0400
dogtail tests: Fix the project saving helper function
tests/dogtail_scripts/helper_functions.py | 13 ++++++++++---
tests/dogtail_scripts/test_project.py | 9 +++++----
2 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/tests/dogtail_scripts/helper_functions.py b/tests/dogtail_scripts/helper_functions.py
index c211b68..a9832b2 100644
--- a/tests/dogtail_scripts/helper_functions.py
+++ b/tests/dogtail_scripts/helper_functions.py
@@ -12,17 +12,24 @@ from pyatspi import (KEY_SYM, KEY_PRESS, KEY_PRESSRELEASE, KEY_RELEASE)
class HelpFunc(BaseDogTail):
- def saveProject(self, url=None, saveAs=True):
+ def saveProject(self, path=None, saveAs=True):
proj_menu = self.menubar.menu("Project")
proj_menu.click()
if saveAs:
+ self.assertIsNotNone(path)
saveas_menu_item = proj_menu.child("Save As...")
saveas_menu_item.click()
saveas = self.pitivi.child(roleName='dialog')
- saveas.child(roleName='text').text = url
+ # In GTK3's file chooser, you can enter /tmp/foo.xptv directly
+ # In GTK2 however, you must do it in two steps:
+ path_dir, filename = os.path.split(path)
+ saveas.child(roleName="text").text = path_dir
+ saveas.button('Save').click()
+ sleep(0.05)
+ saveas.child(roleName='text').text = filename
saveas.button('Save').click()
# Save to the list of items to cleanup afterwards
- self.unlink.append(url)
+ self.unlink.append(path)
else:
# Just save
self.menubar.menu("Project").menuItem("Save").click()
diff --git a/tests/dogtail_scripts/test_project.py b/tests/dogtail_scripts/test_project.py
index 33960f7..17388dc 100644
--- a/tests/dogtail_scripts/test_project.py
+++ b/tests/dogtail_scripts/test_project.py
@@ -95,10 +95,11 @@ class ProjectPropertiesTest(HelpFunc):
spin[0].click()
self.assertEqual(spin[0].text, "500")
- #Create project, test saving without any object
+ # A blank project was created, test saving without any clips/objects
self.pitivi.child(name="OK", roleName="push button").click()
self.saveProject("/tmp/settings.xptv")
- #Load project and test settings
+ self.assertTrue(os.path.exists("/tmp/settings.xptv"))
+ # Load project and test settings
self.loadProject("/tmp/settings.xptv")
self.pitivi.menu("Edit").click()
self.pitivi.child(name="Project Settings", roleName="menu item").click()
@@ -169,7 +170,7 @@ class ProjectPropertiesTest(HelpFunc):
#If finds button, means it warned
self.pitivi.child("Cancel").click()
- self.saveProject(url=None, saveAs=False)
+ self.saveProject(saveAs=False)
#Backup should be deleted, and no warning displayed
self.menubar.menu("Project").click()
self.menubar.menu("Project").menuItem("Quit").click()
@@ -209,7 +210,7 @@ class ProjectPropertiesTest(HelpFunc):
#If finds button, means it warned
self.pitivi.child("Cancel").click()
- self.saveProject(url=None, saveAs=False)
+ self.saveProject(saveAs=False)
#Backup should be deleted, and no warning displayed
self.menubar.menu("Project").click()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]