[pitivi] dogtail tests: Fix the import_media_multiple helper function



commit e1be58c4d1b86c5294e4494957d34fe84a3c4d34
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date:   Tue Jul 24 17:36:19 2012 -0400

    dogtail tests: Fix the import_media_multiple helper function
    
    Select the first file to be selected before pressing the Ctrl key.

 tests/dogtail_scripts/helper_functions.py |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/tests/dogtail_scripts/helper_functions.py b/tests/dogtail_scripts/helper_functions.py
index 96f9025..936994c 100644
--- a/tests/dogtail_scripts/helper_functions.py
+++ b/tests/dogtail_scripts/helper_functions.py
@@ -124,13 +124,20 @@ class HelpFunc(BaseDogTail):
         import_dialog.child(roleName='text').text = dir_path
         dogtail.rawinput.pressKey("Enter")
 
-        # We are now in the samples directory, select various items
-        code = dogtail.rawinput.keyNameToKeyCode("Control_L")
-        registry.generateKeyboardEvent(code, None, KEY_PRESS)
+        # We are now in the samples directory, select various items.
+        # We use Ctrl click to select multiple items. However, since the first
+        # row of the filechooser is always selected by default, we must not use
+        # ctrl when selecting the first item of our list, in order to deselect.
+        ctrl_code = dogtail.rawinput.keyNameToKeyCode("Control_L")
+        file_list = import_dialog.child(name="Files", roleName="table")
+        first = True
         for f in files:
-            sleep(1)
-            import_dialog.child(name=f).click()
-        registry.generateKeyboardEvent(code, None, KEY_RELEASE)
+            sleep(0.5)
+            file_list.child(name=f).click()
+            if first:
+                registry.generateKeyboardEvent(ctrl_code, None, KEY_PRESS)
+                first = False
+        registry.generateKeyboardEvent(ctrl_code, None, KEY_RELEASE)
         import_dialog.button('Add').click()
 
         libtab = self.pitivi.tab("Media Library")



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