[pitivi] dogtail tests: Fix test_dialogs_clipmediaprops



commit 760c48859501074810bb350be686924ca693ed2a
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date:   Fri Oct 19 17:16:05 2012 -0400

    dogtail tests: Fix test_dialogs_clipmediaprops
    
    Make it use the new media library toolbar
    Update the expected properties to match the new default sample (tears of steel)

 .../dogtail_scripts/test_dialogs_clipmediaprops.py |   45 ++++++++++++-------
 1 files changed, 28 insertions(+), 17 deletions(-)
---
diff --git a/tests/dogtail_scripts/test_dialogs_clipmediaprops.py b/tests/dogtail_scripts/test_dialogs_clipmediaprops.py
index 3d2c2ef..5161382 100644
--- a/tests/dogtail_scripts/test_dialogs_clipmediaprops.py
+++ b/tests/dogtail_scripts/test_dialogs_clipmediaprops.py
@@ -7,36 +7,40 @@ from dogtail.predicate import GenericPredicate, IsATextEntryNamed
 class DialogsClipMediaPropsTest(HelpFunc):
     def test_clip_props_dialog(self):
         sample = self.import_media("flat_colour1_640x480.png")
-        sample.click(3)
-        buttons = self.pitivi.findChildren(GenericPredicate(name="Clip Properties..."))
-        buttons[1].click()
+        sample.click()
+        media_props_button = self.medialibrary.child(name="media_props_button")
+        media_props_button.click()
 
-        #Check if we have real info, can't check if in correct place.
+        # Now check that a dialog shows up with the clip's properties:
         dialog = self.pitivi.child(name="Clip Properties", roleName="dialog", recursive=False)
         labels = {"640", "480"}
         real_labels = set([])
         for label in dialog.findChildren(GenericPredicate(roleName="label")):
             real_labels.add(label.text)
-        self.assertEqual(len(labels.difference(real_labels)), 0, "Not all info is displayed")
+        self.assertEqual(len(labels.difference(real_labels)), 0,
+            "Info seems incorrect\n\tExpected: %s \n\tObtained: %s" % (labels, real_labels))
         self.assertFalse(dialog.child(name="Audio:", roleName="panel").showing)
         dialog.child(name="Cancel").click()
         sample.deselect()
 
+        # Do the same thing for "tears of steel.webm":
         sample = self.import_media()
         sample.select()
-        self.menubar.menu("Library").click()
-        self.menubar.menuItem("Clip Properties...").click()
+        media_props_button.click()
 
-        #Check if we have real info, can't check if in correct place.
+        # Check again for the presence of the dialog and its contents
         dialog = self.pitivi.child(name="Clip Properties", roleName="dialog", recursive=False)
-        labels = {"1280", "544", "23.976 fps", "Square", "Stereo", "48 KHz", "16 bit"}
+        # These are the properties of "tears of steel.webm":
+        labels = {"Video:", "960", "400", "25 fps", "Square",
+                "Audio:", "Mono", "44.1 KHz", "32 bit"}
         real_labels = set([])
         for label in dialog.findChildren(GenericPredicate(roleName="label")):
             real_labels.add(label.text)
-        self.assertEqual(len(labels.difference(real_labels)), 0, "Not all info is displayed")
+        self.assertEqual(len(labels.difference(real_labels)), 0,
+            "Info seems incorrect.\n\tExpected: %s \n\tObtained: %s" % (labels, real_labels))
 
-        #Uncheck frame rate
-        dialog.child(name="Frame rate:").click()
+        # Uncheck the "mono" channels, so the project should stay stereo
+        dialog.child(name="Channels:").click()
         dialog.child(name="Apply to project").click()
 
         #Check if correctly applied
@@ -47,13 +51,20 @@ class DialogsClipMediaPropsTest(HelpFunc):
         children = dialog.findChildren(IsATextEntryNamed(""))
         childtext = {}
         for child in children:
-                childtext[child.text] = child
-
+            childtext[child.text] = child
+        # Framerates and aspect ratio:
         self.assertIn("25:1", childtext)
         self.assertIn("1:1", childtext)
         children = dialog.findChildren(GenericPredicate(roleName="spin button"))
         spintext = {}
         for child in children:
-                spintext[child.text] = child
-        self.assertIn("1280", spintext)
-        self.assertIn("544", spintext)
+            spintext[child.text] = child
+        self.assertIn("960", spintext)
+        self.assertIn("400", spintext)
+
+        # Previously, we asked to not override the "stereo" setting with "mono"
+        # Search for a combobox that currently has the label "Stereo":
+        try:
+            dialog.child(name="Stereo", roleName="combo box")
+        except SearchError:
+            self.fail('"Mono" clip property was applied to project settings. Expected the "Stereo" setting to be preserved.')



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