[pitivi] dogtail tests: Fix the preferences saving test
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] dogtail tests: Fix the preferences saving test
- Date: Wed, 25 Jul 2012 11:56:38 +0000 (UTC)
commit b2972882bffebe7c859f0d83ca396b6db544f990
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date: Sun Jul 22 12:56:10 2012 -0400
dogtail tests: Fix the preferences saving test
tests/dogtail_scripts/test_dialogs_prefs.py | 51 ++++++++++++++++----------
1 files changed, 31 insertions(+), 20 deletions(-)
---
diff --git a/tests/dogtail_scripts/test_dialogs_prefs.py b/tests/dogtail_scripts/test_dialogs_prefs.py
index 54ec49c..dd1db81 100644
--- a/tests/dogtail_scripts/test_dialogs_prefs.py
+++ b/tests/dogtail_scripts/test_dialogs_prefs.py
@@ -5,46 +5,57 @@ import dogtail.rawinput
class DialogsPreferencesTest(HelpFunc):
+
def test_pref_dialog(self):
dogtail.rawinput.pressKey("Esc")
self.menubar.menu("Edit").click()
- self.menubar.child(name="Preferences", roleName="menu item").click()
+ self.menubar.menuItem("Preferences").click()
dialog = self.pitivi.child(name="Preferences", roleName="dialog")
dialog.child("Reset to Factory Settings", roleName="push button").click()
- #Try choose the font
+ # 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()
- #Try choose thumbnail gap
- dialog.child(roleName="spin button").text = "12"
-
- #Restart pitivi, look if saved
- dialog.button("Close")
-
- self.tearDown()
+ # Set the thumbnail gap setting (or whatever the first spinbutton is)
+ foo = dialog.child(roleName="spin button")
+ # The following is quite silly. You *need* to focus the widget
+ # before changing its text, otherwise GTK won't fire "changed" signals
+ # when you click somewhere else (ex: the Close button) and it won't be
+ # saved. Since grabFocus() doesn't work here, just click it.
+ foo.click()
+ foo.text = "12"
+
+ # Close the preferences, restart the app...
+ dialog.button("Close").click()
+ self.tearDown(kill=False) # Pitivi only saves prefs on a normal exit
self.setUp()
-
dogtail.rawinput.pressKey("Esc")
self.menubar.menu("Edit").click()
- self.menubar.child(name="Preferences", roleName="menu item").click()
+ self.menubar.menuItem("Preferences").click()
dialog = self.pitivi.child(name="Preferences", roleName="dialog")
- #Just search of such item
+ # 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")
except SearchError:
- self.fail("Font is not saved")
- self.assertEqual(dialog.child(roleName="spin button").text, 12)
-
- #Check revert
- dialog.child(roleName="spin button").text = "7"
+ self.fail("Font was not saved")
+ self.assertEqual(dialog.child(roleName="spin button").text, "12")
+
+ # Check the "revert to last user values" feature
+ foo = dialog.child(roleName="spin button")
+ foo.click()
+ foo.text = "" # Clear the text so we can type into it
+ # Finish typeText with a \n so that the "changed" signals get fired
+ # Otherwise the Revert button will not be made sensitive
+ foo.typeText("888\n")
dialog.child("Revert", roleName="push button").click()
- self.assertEqual(dialog.child(roleName="spin button").text, 12, "Spacing is not reverted")
+ self.assertEqual(dialog.child(roleName="spin button").text, "12", "Spacing setting was not reverted")
- #Check reset to factory settings
+ # Check resetting to factory settings
dialog.child("Reset to Factory Settings", roleName="push button").click()
dialog.child(name="Sans", roleName="label")
- self.assertEqual(dialog.child(roleName="spin button").text, 5, "Spacing is not reseted")
+ 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]