[pitivi] dogtail tests: Add a test for cancelling a project load



commit c012e680a314600d08e924794c3a473d1c86dc8e
Author: Jean-François Fortin Tam <nekohayo gmail com>
Date:   Sun Sep 29 14:58:15 2013 -0400

    dogtail tests: Add a test for cancelling a project load

 tests/dogtail_scripts/test_project.py |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/tests/dogtail_scripts/test_project.py b/tests/dogtail_scripts/test_project.py
index aca9762..f9c93dc 100644
--- a/tests/dogtail_scripts/test_project.py
+++ b/tests/dogtail_scripts/test_project.py
@@ -42,6 +42,33 @@ class ProjectPropertiesTest(HelpFunc):
 
     # The actual test cases
 
+    def test_cancelling_load_with_no_fallback(self):
+        """
+        Test the scenario where you have no unsaved changes, go to choose
+        a project to load but cancel the file chooser, then try to import clips
+        """
+        dogtail.rawinput.pressKey("Esc")  # Dismiss the welcome dialog
+        self.menubar.menu("Project").click()
+        self.menubar.menu("Project").menuItem("Open...").click()
+        # The file chooser shows up, dismiss it without choosing any project:
+        chooser = self.pitivi.child(name="Open File...", roleName="file chooser", recursive=False)
+        chooser.child(name="Cancel", roleName="push button").click()
+        # We should be able to import clips in the media library
+        # without failing due to a missing app project instance:
+        try:
+            the_clip = self.import_media()
+        except AssertionError:
+            self.fail("The clip import dialog didn't work, something is broken")
+        self.force_medialibrary_iconview_mode()
+        iconview = self.medialibrary.child(roleName="layered pane")
+        self.assertEqual(len(iconview.children), 1)
+        self.insert_clip(the_clip)
+        # Try to quit, it should warn us about unsaved changes.
+        self.menubar.menu("Project").click()
+        self.menubar.menu("Project").menuItem("Quit").click()
+        unsaved_changes = self.pitivi.child(name="unsaved changes dialog", roleName="dialog", 
recursive=False)
+        unsaved_changes.button("Close without saving").click()
+
     def test_settings_video(self):
         # TODO: test the audio and metadata tabs too
         welcome_dialog = self.pitivi.child(name="Welcome", roleName="frame", recursive=False)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]