[pitivi] dogtail tests: Make test_dialogs_prefs work with the new GTK font chooser
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] dogtail tests: Make test_dialogs_prefs work with the new GTK font chooser
- Date: Sat, 20 Oct 2012 20:25:40 +0000 (UTC)
commit 8505ceff76444ce69c5f18c660b9cbfe1711c154
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date: Fri Oct 19 17:07:41 2012 -0400
dogtail tests: Make test_dialogs_prefs work with the new GTK font chooser
tests/dogtail_scripts/test_dialogs_prefs.py | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/tests/dogtail_scripts/test_dialogs_prefs.py b/tests/dogtail_scripts/test_dialogs_prefs.py
index dd1db81..42cc6d8 100644
--- a/tests/dogtail_scripts/test_dialogs_prefs.py
+++ b/tests/dogtail_scripts/test_dialogs_prefs.py
@@ -14,10 +14,22 @@ class DialogsPreferencesTest(HelpFunc):
dialog.child("Reset to Factory Settings", roleName="push button").click()
# Set a different font
- dialog.child(name="Sans", roleName="label").click()
- fontchooser = self.pitivi.child(name="Pick a Font", roleName="fontchooser")
- fontchooser.child(name="Serif").click()
- fontchooser.child(name="OK", roleName="push button").click()
+ dialog.child(name="Sans", roleName="push button").click()
+ fontchooser = self.pitivi.child(name="Pick a Font", roleName="dialog")
+ # Perf hack: do a search to reduce the amount of table cells displayed,
+ # otherwise dogtail will take ages to search for it.
+ # But even if the search entry is focused by default, you can't do
+ # dogtail.rawinput.typeText("cantarell bold")
+ # Because it types randomized letters (in dogtail 0.8.1).
+ # So here's a positional hack:
+ search_entry = fontchooser.children[0].children[0].children[0].children[4]
+ # Search for a very specific font, to avoid scrolling, which would
+ # make it impossible to click the first item in the search results
+ search_entry.text = "cantarell bold"
+ # Ideally I'd search the child table cells, but this is way too slow,
+ # so let's just pick the first item in the search results:
+ fontchooser.child(roleName="table cell").click()
+ fontchooser.child(name="Select", roleName="push button").click()
# Set the thumbnail gap setting (or whatever the first spinbutton is)
foo = dialog.child(roleName="spin button")
@@ -40,7 +52,7 @@ class DialogsPreferencesTest(HelpFunc):
# Check if the previous values were correctly saved
# In the case of the font, just search if such an item exists:
try:
- dialog.child(name="Serif", roleName="label")
+ dialog.child(name="Cantarell Bold", roleName="push button")
except SearchError:
self.fail("Font was not saved")
self.assertEqual(dialog.child(roleName="spin button").text, "12")
@@ -57,5 +69,5 @@ class DialogsPreferencesTest(HelpFunc):
# Check resetting to factory settings
dialog.child("Reset to Factory Settings", roleName="push button").click()
- dialog.child(name="Sans", roleName="label")
+ dialog.child(name="Sans", roleName="push button")
self.assertEqual(dialog.child(roleName="spin button").text, "5", "Resetting to factory defaults failed")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]