[pitivi] dogtail tests: Use the filechooser's path togglebutton instead of the "/" key
- From: Jean-François Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] dogtail tests: Use the filechooser's path togglebutton instead of the "/" key
- Date: Thu, 12 Dec 2013 20:01:28 +0000 (UTC)
commit 23b0f562ed276e2e8750aa99c3f8b70279e66340
Author: Jean-François Fortin Tam <nekohayo gmail com>
Date: Thu Dec 12 13:26:25 2013 -0500
dogtail tests: Use the filechooser's path togglebutton instead of the "/" key
This removes a trick where we simply typed the "/" character to force open
the path entry in GTK filechooser. We now check the path togglebutton's state
and click it if needed. This approach is potentially safer.
While theoretically slower, the actual performance impact is mostly negligible:
for example, the medialibrary test takes 20.8 seconds instead of 20.7.
tests/dogtail_scripts/helper_functions.py | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/tests/dogtail_scripts/helper_functions.py b/tests/dogtail_scripts/helper_functions.py
index b073da1..5b66cf8 100644
--- a/tests/dogtail_scripts/helper_functions.py
+++ b/tests/dogtail_scripts/helper_functions.py
@@ -43,8 +43,10 @@ class HelpFunc(BaseDogTail):
return
load = self.pitivi.child(name="Open File...", roleName="file chooser", recursive=False)
- # Same performance hack as in the import_media method
- dogtail.rawinput.pressKey("/")
+ path_toggle = load.child(name="Type a file name", roleName="toggle button")
+ if not path_toggle.checked:
+ path_toggle.click()
+
load.child(roleName='text').text = url
# Speed hack: don't search for the Open button
dogtail.rawinput.pressKey("Enter")
@@ -121,10 +123,10 @@ class HelpFunc(BaseDogTail):
# as it doesn't have to analyze the whole mainwindow.
import_dialog = self.pitivi.child(name="Select One or More Files",
roleName="file chooser", recursive=False)
- # Instead of checking for the presence of the path text field and then
- # searching for the toggle button to enable it, use the fact that GTK's
- # file chooser allows typing the path directly if it starts with "/".
- dogtail.rawinput.pressKey("/") # This text will be replaced later
+
+ path_toggle = import_dialog.child(name="Type a file name", roleName="toggle button")
+ if not path_toggle.checked:
+ path_toggle.click()
filepath = os.path.realpath(__file__).split("dogtail_scripts/")[0]
filepath += "samples/" + filename
@@ -158,10 +160,13 @@ class HelpFunc(BaseDogTail):
dogtail.rawinput.pressKey("Esc") # Ensure the welcome dialog is closed
self.import_button.click()
- # Same performance hack as in the import_media method
import_dialog = self.pitivi.child(name="Select One or More Files",
roleName="file chooser", recursive=False)
- dogtail.rawinput.pressKey("/")
+
+ path_toggle = import_dialog.child(name="Type a file name", roleName="toggle button")
+ if not path_toggle.checked:
+ path_toggle.click()
+
dir_path = os.path.realpath(__file__).split("dogtail_scripts/")[0] + "samples/"
import_dialog.child(roleName='text').text = dir_path
dogtail.rawinput.pressKey("Enter")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]