diff options
author | SVN-Git Migration <python-modules-team@lists.alioth.debian.org> | 2015-10-08 09:28:03 -0700 |
---|---|---|
committer | SVN-Git Migration <python-modules-team@lists.alioth.debian.org> | 2015-10-08 09:28:03 -0700 |
commit | 0703ed57b9dd3cec45974abc255e5a2f89e3b49a (patch) | |
tree | 5c16375757be87004fab4333ac55d766009b6866 /tests | |
parent | 5d183b3376d1d9250985468c05678e4c40e0bc61 (diff) |
Imported Upstream version 1.9.13
Diffstat (limited to 'tests')
-rw-r--r-- | tests/actions.glade | 119 | ||||
-rw-r--r-- | tests/simple_button.glade | 11 | ||||
-rw-r--r-- | tests/test_Action.py | 11 | ||||
-rw-r--r-- | tests/test_BaseView.py | 6 | ||||
-rw-r--r-- | tests/test_CheckButton.py | 2 | ||||
-rw-r--r-- | tests/test_ComboBox.py | 2 | ||||
-rw-r--r-- | tests/test_Delegate.py | 9 | ||||
-rw-r--r-- | tests/test_Entry.py | 22 | ||||
-rw-r--r-- | tests/test_comboentry.py | 13 | ||||
-rw-r--r-- | tests/test_component.py | 19 | ||||
-rw-r--r-- | tests/test_datatypes.py | 18 | ||||
-rw-r--r-- | tests/test_log.py | 40 | ||||
-rw-r--r-- | tests/test_masks.py | 290 | ||||
-rw-r--r-- | tests/test_python.py | 38 | ||||
-rw-r--r-- | tests/test_tasklet.py | 176 | ||||
-rw-r--r-- | tests/test_ui.py | 9 | ||||
-rw-r--r-- | tests/ui/diary.py | 69 | ||||
-rw-r--r-- | tests/ui/diary2.py | 146 | ||||
-rw-r--r-- | tests/ui/personalinformation.py | 227 |
19 files changed, 855 insertions, 372 deletions
diff --git a/tests/actions.glade b/tests/actions.glade index dae9071..437571e 100644 --- a/tests/actions.glade +++ b/tests/actions.glade @@ -1,100 +1,83 @@ -<?xml version="1.0" ?> +<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> +<!DOCTYPE glade-interface SYSTEM "http://gazpacho.sicem.biz/gazpacho-0.1.dtd"> <glade-interface> <widget class="GtkUIManager" id="uimanager"> <child> <widget class="GtkActionGroup" id="DefaultActions"> <child> - <widget class="GtkAction" id="FileMenu"> - <property name="label">_File</property> - <property name="tooltip"></property> - <property name="callback"></property> - <property name="accelerator"></property> + <widget class="GtkAction" id="Copy"> + <property name="name">Copy</property> + <property name="tooltip" translatable="yes">Copy selected object into the clipboard</property> + <property name="stock_id">gtk-copy</property> </widget> </child> <child> - <widget class="GtkAction" id="New"> - <property name="label">_New</property> - <property name="tooltip">Create a new file</property> - <property name="stock_id">gtk-new</property> - <property name="callback"></property> - <property name="accelerator"><control>N</property> + <widget class="GtkAction" id="Cut"> + <property name="name">Cut</property> + <property name="label" translatable="yes">C_ut</property> + <property name="tooltip" translatable="yes">Cut selected object into the clipboard</property> + <property name="stock_id">gtk-cut</property> </widget> </child> <child> - <widget class="GtkAction" id="Open"> - <property name="label">_Open</property> - <property name="tooltip">Open a file</property> - <property name="stock_id">gtk-open</property> - <property name="callback"></property> - <property name="accelerator"><control>O</property> + <widget class="GtkAction" id="EditMenu"> + <property name="name">EditMenu</property> + <property name="label" translatable="yes">_Edit</property> </widget> </child> <child> - <widget class="GtkAction" id="Save"> - <property name="label">_Save</property> - <property name="tooltip">Save a file</property> - <property name="stock_id">gtk-save</property> - <property name="callback"></property> - <property name="accelerator"><control>S</property> + <widget class="GtkAction" id="FileMenu"> + <property name="name">FileMenu</property> + <property name="label" translatable="yes">_File</property> </widget> </child> <child> - <widget class="GtkAction" id="SaveAs"> - <property name="label">Save _as</property> - <property name="tooltip">Save with a differente name</property> - <property name="stock_id">gtk-save-as</property> - <property name="callback"></property> - <property name="accelerator"></property> + <widget class="GtkAction" id="New"> + <property name="name">New</property> + <property name="tooltip" translatable="yes">Create a new file</property> + <property name="stock_id">gtk-new</property> </widget> </child> <child> - <widget class="GtkAction" id="Quit"> - <property name="label">_Quit</property> - <property name="tooltip">Quit the program</property> - <property name="stock_id">gtk-quit</property> - <property name="callback"></property> - <property name="accelerator"><control>Q</property> + <widget class="GtkAction" id="Open"> + <property name="name">Open</property> + <property name="tooltip" translatable="yes">Open a file</property> + <property name="stock_id">gtk-open</property> </widget> </child> <child> - <widget class="GtkAction" id="EditMenu"> - <property name="label">_Edit</property> - <property name="tooltip"></property> - <property name="callback"></property> - <property name="accelerator"></property> + <widget class="GtkAction" id="Paste"> + <property name="name">Paste</property> + <property name="tooltip" translatable="yes">Paste object from the Clipboard</property> + <property name="stock_id">gtk-paste</property> </widget> </child> <child> - <widget class="GtkAction" id="Copy"> - <property name="label">_Copy</property> - <property name="tooltip">Copy selected object into the clipboard</property> - <property name="stock_id">gtk-copy</property> - <property name="callback"></property> - <property name="accelerator"><control>C</property> + <widget class="GtkAction" id="Quit"> + <property name="name">Quit</property> + <property name="tooltip" translatable="yes">Quit the program</property> + <property name="stock_id">gtk-quit</property> </widget> </child> <child> - <widget class="GtkAction" id="Cut"> - <property name="label">C_ut</property> - <property name="tooltip">Cut selected object into the clipboard</property> - <property name="stock_id">gtk-cut</property> - <property name="callback"></property> - <property name="accelerator"><control>X</property> + <widget class="GtkAction" id="Save"> + <property name="name">Save</property> + <property name="tooltip" translatable="yes">Save a file</property> + <property name="stock_id">gtk-save</property> </widget> </child> <child> - <widget class="GtkAction" id="Paste"> - <property name="label">_Paste</property> - <property name="tooltip">Paste object from the Clipboard</property> - <property name="stock_id">gtk-paste</property> - <property name="callback"></property> - <property name="accelerator"><control>V</property> + <widget class="GtkAction" id="SaveAs"> + <property name="name">SaveAs</property> + <property name="label" translatable="yes">Save _as</property> + <property name="tooltip" translatable="yes">Save with a differente name</property> + <property name="stock_id">gtk-save-as</property> </widget> </child> </widget> </child> - <ui id="initial-state"><![CDATA[<ui> - <menubar action="menubar1" name="menubar1"> + <ui id="initial-state"><![CDATA[<ui> +<menubar action="menubar1" name="menubar1"> <menu action="FileMenu" name="FileMenu"> <menuitem action="New" name="New"/> <menuitem action="Open" name="Open"/> @@ -108,8 +91,7 @@ <menuitem action="Cut" name="Cut"/> <menuitem action="Paste" name="Paste"/> </menu> - </menubar> - <toolbar action="toolbar1" name="toolbar1"> + </menubar><toolbar action="toolbar1" name="toolbar1"> <toolitem action="New" name="New"/> <toolitem action="Open" name="Open"/> <toolitem action="Save" name="Save"/> @@ -118,16 +100,16 @@ <toolitem action="Cut" name="Cut"/> <toolitem action="Paste" name="Paste"/> </toolbar> - </ui>]]></ui> +</ui>]]></ui> </widget> <widget class="GtkWindow" id="window1"> - <property name="title" translatable="True"></property> <property name="role"></property> + <property name="title" context="yes" translatable="yes"></property> <child> <widget class="GtkVBox" id="vbox1"> <property name="visible">True</property> <child> - <widget class="GtkMenuBar" id="menubar1" constructor="initial-state"> + <widget constructor="initial-state" class="GtkMenuBar" id="menubar1"> <property name="visible">True</property> </widget> <packing> @@ -135,13 +117,12 @@ </packing> </child> <child> - <widget class="GtkToolbar" id="toolbar1" constructor="initial-state"> - <property name="toolbar_style">both</property> + <widget constructor="initial-state" class="GtkToolbar" id="toolbar1"> <property name="visible">True</property> </widget> <packing> - <property name="position">1</property> <property name="expand">False</property> + <property name="position">1</property> </packing> </child> </widget> diff --git a/tests/simple_button.glade b/tests/simple_button.glade index 929a950..ac0d46a 100644 --- a/tests/simple_button.glade +++ b/tests/simple_button.glade @@ -1,15 +1,12 @@ -<?xml version="1.0" ?> +<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> +<!DOCTYPE glade-interface SYSTEM "http://gazpacho.sicem.biz/gazpacho-0.1.dtd"> <glade-interface> <widget class="GtkWindow" id="simple_button"> <property name="role"></property> - <property name="events">all-events-mask | button-motion-mask | button-press-mask | button-release-mask | button1-motion-mask | button2-motion-mask | button3-motion-mask | enter-notify-mask | exposure-mask | focus-change-mask | key-press-mask | key-release-mask | leave-notify-mask | pointer-motion-hint-mask | pointer-motion-mask | property-change-mask | proximity-in-mask | proximity-out-mask | scroll-mask | structure-mask | substructure-mask | visibility-notify-mask</property> - <property name="title" context="True" translatable="True"></property> + <property name="title" context="yes" translatable="yes"></property> <child> <widget class="GtkButton" id="button"> - <property name="receives_default">True</property> - <property name="label" context="True" translatable="True">Click me!</property> - <property name="events">all-events-mask | button-motion-mask | button-press-mask | button-release-mask | button1-motion-mask | button2-motion-mask | button3-motion-mask | enter-notify-mask | exposure-mask | focus-change-mask | key-press-mask | key-release-mask | leave-notify-mask | pointer-motion-hint-mask | pointer-motion-mask | property-change-mask | proximity-in-mask | proximity-out-mask | scroll-mask | structure-mask | substructure-mask | visibility-notify-mask</property> - <property name="can_focus">True</property> + <property name="label" context="yes" translatable="yes">Click me!</property> <property name="visible">True</property> </widget> </child> diff --git a/tests/test_Action.py b/tests/test_Action.py index 21ec18f..3065381 100644 --- a/tests/test_Action.py +++ b/tests/test_Action.py @@ -2,14 +2,13 @@ from utils import refresh_gui import unittest -from kiwi.ui.delegates import Delegate +from kiwi.ui.delegates import GladeDelegate -class ActionDelegate(Delegate): +class ActionDelegate(GladeDelegate): def __init__(self): - Delegate.__init__(self, gladefile="actions.glade", - toplevel_name='window1', - widgets=['New'], - delete_handler=self.quit_if_last) + GladeDelegate.__init__(self, gladefile="actions.glade", + toplevel_name='window1', + delete_handler=self.quit_if_last) self.new_activated = False def on_New__activate(self, *args): diff --git a/tests/test_BaseView.py b/tests/test_BaseView.py index f077f55..afe39da 100644 --- a/tests/test_BaseView.py +++ b/tests/test_BaseView.py @@ -79,12 +79,12 @@ class NotWidgetFoo(FooView, BaseController): class BaseViewTest(unittest.TestCase): def setUp(self): - self.foo = FooController(FooView()) + self.view = FooView() + self.foo = FooController(self.view) refresh_gui() def tearDown(self): - for win in gtk.window_list_toplevels(): - win.destroy() + self.view.win.destroy() def testFooButton(self): self.foo.view.foo__button.clicked() diff --git a/tests/test_CheckButton.py b/tests/test_CheckButton.py index ca18395..a838010 100644 --- a/tests/test_CheckButton.py +++ b/tests/test_CheckButton.py @@ -1,6 +1,4 @@ #!/usr/bin/env python -import utils - import unittest from kiwi.ui.widgets.checkbutton import ProxyCheckButton diff --git a/tests/test_ComboBox.py b/tests/test_ComboBox.py index 5bebbe9..0a59c8b 100644 --- a/tests/test_ComboBox.py +++ b/tests/test_ComboBox.py @@ -1,6 +1,4 @@ #!/usr/bin/env python -import utils - import unittest from kiwi.python import disabledeprecationcall, Settable diff --git a/tests/test_Delegate.py b/tests/test_Delegate.py index 1a37a1d..61bf82c 100644 --- a/tests/test_Delegate.py +++ b/tests/test_Delegate.py @@ -2,7 +2,7 @@ import unittest import gtk -from kiwi.ui.delegates import Delegate +from kiwi.ui.delegates import Delegate, GladeDelegate from utils import refresh_gui class A: @@ -62,11 +62,10 @@ class ClickCounter(Delegate): def on_button__clicked(self, *args): self.clicks += 1 -class GladeClickCounter(Delegate): +class GladeClickCounter(GladeDelegate): def __init__(self): - Delegate.__init__(self, gladefile="simple_button", - widgets=['button'], - delete_handler=self.quit_if_last) + GladeDelegate.__init__(self, gladefile="simple_button", + delete_handler=self.quit_if_last) self.clicks = 0 diff --git a/tests/test_Entry.py b/tests/test_Entry.py index cf41c55..6e9ed1e 100644 --- a/tests/test_Entry.py +++ b/tests/test_Entry.py @@ -9,8 +9,6 @@ from kiwi import datatypes from kiwi.ui.entry import KiwiEntry from kiwi.ui.widgets.entry import ProxyEntry -import utils - class EntryTest(unittest.TestCase): def testModel(self): entry = ProxyEntry() @@ -52,40 +50,40 @@ class EntryTest(unittest.TestCase): e = ProxyEntry() e.set_mask('000.000') self.assertEqual(e.get_text(), ' . ') - self.assertEqual(e.get_field_text(), [None, None]) + self.assertEqual(e.get_fields(), ['', '']) e.set_text('123.456') self.assertEqual(e.get_text(), '123.456') - self.assertEqual(e.get_field_text(), [123, 456]) + self.assertEqual(e.get_fields(), ['123', '456']) e.delete_text(0, 2) - self.assertEqual(e.get_text(), ' 3.456') - self.assertEqual(e.get_field_text(), [3, 456]) + self.assertEqual(e.get_text(), '3 .456') + self.assertEqual(e.get_fields(), ['3', '456']) def testAsciiMask(self): e = ProxyEntry() e.set_mask('LLLL-L') self.assertEqual(e.get_text(), ' - ') - self.assertEqual(e.get_field_text(), ['', '']) + self.assertEqual(e.get_fields(), ['', '']) e.set_text('abcd-e') self.assertEqual(e.get_text(), 'abcd-e') - self.assertEqual(e.get_field_text(), ['abcd', 'e']) + self.assertEqual(e.get_fields(), ['abcd', 'e']) def testAlphaNumericMask(self): e = ProxyEntry() e.set_mask('&&&-aaa') self.assertEqual(e.get_text(), ' - ') - self.assertEqual(e.get_field_text(), ['', '']) + self.assertEqual(e.get_fields(), ['', '']) e.set_text('aáé-á1e') self.assertEqual(e.get_text(), 'aáé-á1e') - self.assertEqual(e.get_field_text(), ['aáé', 'á1e']) + self.assertEqual(e.get_fields(), ['aáé', 'á1e']) def testMaskSmallFields(self): e = ProxyEntry() e.set_mask('0.0.0') self.assertEqual(e.get_text(), ' . . ') - self.assertEqual(e.get_field_text(), [None, None, None]) + self.assertEqual(e.get_fields(), ['', '', '']) e.set_text('1.2.3') self.assertEqual(e.get_text(), '1.2.3') - self.assertEqual(e.get_field_text(), [1, 2, 3]) + self.assertEqual(e.get_fields(), ['1', '2', '3']) def testGType(self): entry = KiwiEntry() diff --git a/tests/test_comboentry.py b/tests/test_comboentry.py index 55f9f8a..270b6c1 100644 --- a/tests/test_comboentry.py +++ b/tests/test_comboentry.py @@ -2,6 +2,7 @@ import unittest import gtk +from kiwi.enums import ComboMode from kiwi.ui.comboentry import ComboEntry from kiwi.ui.widgets.combo import ProxyComboEntry @@ -91,20 +92,16 @@ class TestProxyComboEntry(unittest.TestCase): self.assertEqual(entry.get_selected(), 2) def testDataMode(self): - from kiwi.ui.combomixin import (COMBO_MODE_UNKNOWN, - COMBO_MODE_DATA) entry = ProxyComboEntry() - self.assertEqual(entry.mode, COMBO_MODE_UNKNOWN) + self.assertEqual(entry.get_mode(), ComboMode.UNKNOWN) entry.prefill([('one', 1), ('two', 2)]) - self.assertEqual(entry.mode, COMBO_MODE_DATA) + self.assertEqual(entry.get_mode(), ComboMode.DATA) def testStringMode(self): - from kiwi.ui.combomixin import (COMBO_MODE_UNKNOWN, - COMBO_MODE_STRING) entry = ProxyComboEntry() - self.assertEqual(entry.mode, COMBO_MODE_UNKNOWN) + self.assertEqual(entry.get_mode(), ComboMode.UNKNOWN) entry.prefill(['one', 'two']) - self.assertEqual(entry.mode, COMBO_MODE_STRING) + self.assertEqual(entry.get_mode(), ComboMode.STRING) if __name__ == '__main__': unittest.main() diff --git a/tests/test_component.py b/tests/test_component.py index 7f421c4..9447d3d 100644 --- a/tests/test_component.py +++ b/tests/test_component.py @@ -1,7 +1,7 @@ import unittest from kiwi.component import AlreadyImplementedError, Interface, \ - get_utility, provide_utility, implements + get_utility, provide_utility, remove_utility, implements, utilities class IBanana(Interface): pass @@ -10,29 +10,31 @@ class Obj(object): pass o = Obj() class TestUtilities(unittest.TestCase): - def _clear(self, iface): - # Yey, yey - from kiwi.component import _handler - del _handler._utilities[iface] + def tearDown(self): + utilities.clean() def testGet(self): + self.assertEqual(None, get_utility(IBanana, None)) provide_utility(IBanana, o) self.assertRaises(TypeError, get_utility, object) self.assertEqual(get_utility(IBanana), o) - self._clear(IBanana) def testProvide(self): self.assertRaises(NotImplementedError, get_utility, IBanana) provide_utility(IBanana, o) self.assertRaises(TypeError, provide_utility, object, o) - self._clear(IBanana) + + def testRemove(self): + self.assertRaises(NotImplementedError, remove_utility, IBanana) + provide_utility(IBanana, o) + self.assertEqual(remove_utility(IBanana), o) + self.assertRaises(NotImplementedError, remove_utility, IBanana) def testAlreadyImplemented(self): self.assertRaises(NotImplementedError, get_utility, IBanana) provide_utility(IBanana, o) self.assertRaises(AlreadyImplementedError, provide_utility, IBanana, o) - self._clear(IBanana) def testZopeInterface(self): try: @@ -47,7 +49,6 @@ class TestUtilities(unittest.TestCase): provide_utility(IApple, o) self.assertRaises(AlreadyImplementedError, provide_utility, IApple, o) - self._clear(IApple) def testImplements(self): class I1(Interface): diff --git a/tests/test_datatypes.py b/tests/test_datatypes.py index 4f80e69..da439b5 100644 --- a/tests/test_datatypes.py +++ b/tests/test_datatypes.py @@ -6,10 +6,11 @@ import sys from gtk import gdk -from kiwi.currency import currency from kiwi.datatypes import converter, ValidationError, ValueUnset, \ Decimal, BaseConverter +from kiwi.currency import currency from kiwi.environ import environ +from kiwi.python import enum # pixbuf converter from kiwi.ui import proxywidget @@ -389,5 +390,20 @@ class PixbufTest(unittest.TestCase): self.assertEqual(pixbuf.get_width(), 17) self.assertEqual(pixbuf.get_height(), 17) +class EnumTest(unittest.TestCase): + def testSimple(self): + class status(enum): + (OPEN, CLOSE) = range(2) + + conv = converter.get_converter(status) + self.assertEqual(conv.type, status) + conv2 = converter.get_converter(status) + self.assertEqual(conv, conv2) + + self.assertEqual(conv.from_string('OPEN'), status.OPEN) + self.assertEqual(conv.as_string(status.CLOSE), 'CLOSE') + self.assertRaises(ValidationError, conv.from_string, 'FOO') + self.assertRaises(ValidationError, conv.as_string, object()) + if __name__ == "__main__": unittest.main() diff --git a/tests/test_log.py b/tests/test_log.py new file mode 100644 index 0000000..149adaf --- /dev/null +++ b/tests/test_log.py @@ -0,0 +1,40 @@ +import cStringIO +import logging +import os +import sys +import tempfile +import unittest + +from kiwi.log import Logger, set_log_file + +class LogTest(unittest.TestCase): + def setUp(self): + self.filename = tempfile.mktemp() + self.log = Logger('log') + + def tearDown(self): + if os.path.exists(self.filename): + try: + os.unlink(self.filename) + except OSError: # win32 permission error + pass + + def testSetLogFile(self): + set_log_file(self.filename, 'log') + self.log.info("sliff") + lines = open(self.filename).readlines() + self.assertEqual(len(lines), 1) + self.failUnless('sliff' in lines[0]) + + + def testStdErr(self): + root = logging.getLogger() + stream = root.handlers[0] + fd = cStringIO.StringIO() + stream.stream = fd + self.log.warning("this is a warning") + stream.stream = sys.stderr + fd.seek(0) + lines = fd.readlines() + self.assertEqual(len(lines), 1) + self.failUnless('this is a warning' in lines[0]) diff --git a/tests/test_masks.py b/tests/test_masks.py new file mode 100644 index 0000000..e788565 --- /dev/null +++ b/tests/test_masks.py @@ -0,0 +1,290 @@ +from twisted.trial import unittest +from utils import refresh_gui + +import gtk +from gtk import keysyms + +from kiwi.ui.delegates import Delegate +from kiwi.ui.entry import KiwiEntry + +SPECIAL_KEYS = { + '/' : 'slash', + '+' : 'plus', + '-' : 'minus', + '(' : 'parenleft', + ')' : 'parenright', + ' ' : 'space', +} + +DELAY = 0.1 + +def send_backspace(widget): + event = gtk.gdk.Event(gtk.gdk.KEY_PRESS) + event.keyval = int(keysyms.BackSpace) + event.hardware_keycode = 22 + event.window = widget.window +# widget.event(event) + gtk.main_do_event(event) + refresh_gui(DELAY) + +def send_delete(widget): + event = gtk.gdk.Event(gtk.gdk.KEY_PRESS) + event.keyval = int(keysyms.Delete) + event.hardware_keycode = 107 + event.window = widget.window + gtk.main_do_event(event) +# widget.event(event) + refresh_gui(DELAY) + + +def send_key(widget, key): + if isinstance(key, str) and key.isdigit(): + key = 'KP_'+key + elif isinstance(key, str) and key in SPECIAL_KEYS: + key = SPECIAL_KEYS[key] + + keysym = getattr(keysyms, key) + + # Key press + event = gtk.gdk.Event(gtk.gdk.KEY_PRESS) + event.keyval = int(keysym) + event.window = widget.window + widget.event(event) + + refresh_gui(DELAY) + +def insert_text(widget, text): + for i in text: + send_key(widget, i) + +LEFT, RIGHT = -1, 1 +def move(entry, direction): + entry.emit('move-cursor', gtk.MOVEMENT_VISUAL_POSITIONS, direction, False) + +class MasksDelegate(Delegate): + def __init__(self): + self.win = gtk.Window() + self.entry = KiwiEntry() + self.win.add(self.entry) + + Delegate.__init__(self, toplevel=self.win) + self.win.show_all() + + + +class TestMasks(unittest.TestCase): + def setUpClass(self): + self.delegate = MasksDelegate() + self.entry = self.delegate.entry + + def tearDownClass(self): + self.delegate.win.destroy() + + def testSetMask(self): + entry = self.entry + entry.set_mask('00/00/0000') + refresh_gui(DELAY) + self.assertEqual(entry.get_text(), ' / / ') + + entry.set_mask('(00) 0000-0000') + refresh_gui(DELAY) + self.assertEqual(entry.get_text(), '( ) - ') + + def testSetText(self): + entry = self.entry + entry.set_mask('00/00/0000') + refresh_gui(DELAY) + entry.set_text('12/34/5678') + refresh_gui(DELAY) + self.assertEqual(entry.get_text(), '12/34/5678') + + entry.set_mask('(00) 0000-0000') + refresh_gui(DELAY) + entry.set_text('(11) 1234-5678') + refresh_gui(DELAY) + self.assertEqual(entry.get_text(), '(11) 1234-5678') + + entry.set_text('') + self.assertEqual(entry.get_text(), entry.get_empty_mask()) + + def testInserting(self): + entry = self.entry + entry.set_mask('00/00/0000') + entry.grab_focus() + insert_text(entry, '12345678') + self.assertEqual(entry.get_text(), '12/34/5678') + + entry.set_text('') + insert_text(entry, '1/2/3333') + self.assertEqual(entry.get_text(), '1 /2 /3333') + + entry.set_mask('(00) 0000-0000') + entry.emit('focus', gtk.DIR_TAB_FORWARD) + refresh_gui(DELAY) + insert_text(entry, '1234567890') + self.assertEqual(entry.get_text(), '(12) 3456-7890') + + + def testMovementTabsEmptyMask(self): + entry = self.entry + entry.set_mask('(00) 0000-0000') + self.assertEqual(entry.get_field(), None) + + entry.emit('focus', gtk.DIR_TAB_FORWARD) + self.assertEqual(entry.get_field(), 0) + + entry.emit('focus', gtk.DIR_TAB_FORWARD) + self.assertEqual(entry.get_field(), 1) + + entry.emit('focus', gtk.DIR_TAB_FORWARD) + self.assertEqual(entry.get_field(), 2) + + entry.emit('focus', gtk.DIR_TAB_FORWARD) + self.assertEqual(entry.get_field(), None) + + def testMovementKeysEmptyMask(self): + entry = self.entry + entry.set_mask('(00) 0000-0000') + + entry.emit('focus', gtk.DIR_TAB_FORWARD) + refresh_gui(DELAY) + + self.assertEqual(entry.get_position(), 1) + + # Left + move(entry, LEFT) + self.assertEqual(entry.get_position(), 1) + + # Right + move(entry, RIGHT) + self.assertEqual(entry.get_position(), 2) + + move(entry, RIGHT) + self.assertEqual(entry.get_position(), 3) + + move(entry, RIGHT) + self.assertEqual(entry.get_position(), 5) + + move(entry, LEFT) + self.assertEqual(entry.get_position(), 3) + + + # Home + entry.emit('move-cursor', gtk.MOVEMENT_DISPLAY_LINE_ENDS, -1, False) + self.assertEqual(entry.get_position(), 1) + + # End + entry.emit('move-cursor', gtk.MOVEMENT_DISPLAY_LINE_ENDS, 1, False) + self.assertEqual(entry.get_position(), 14) + + def testInsertAndMovementKeys(self): + entry = self.entry + entry.set_mask('(00) 0000-0000') + entry.grab_focus() + + insert_text(entry, '1') + self.assertEqual(entry.get_text(), '(1 ) - ') + + move(entry, LEFT) + self.assertEqual(entry.get_position(), 1) + + move(entry, RIGHT) + self.assertEqual(entry.get_position(), 2) + + move(entry, RIGHT) + self.assertEqual(entry.get_position(), 3) + + move(entry, RIGHT) + self.assertEqual(entry.get_position(), 5) + + insert_text(entry, '2') + self.assertEqual(entry.get_text(), '(1 ) 2 - ') + + move(entry, RIGHT) + self.assertEqual(entry.get_position(), 7) + + insert_text(entry, '3') + self.assertEqual(entry.get_text(), '(1 ) 2 3 - ') + + move(entry, RIGHT) + self.assertEqual(entry.get_position(), 9) + + move(entry, RIGHT) + self.assertEqual(entry.get_position(), 10) + + insert_text(entry, '4') + self.assertEqual(entry.get_text(), '(1 ) 2 3 -4 ') + + + # FIXME: Backspace does not work on windows + def _testBackspace(self): + entry = self.entry + entry.set_mask('(00) 0000-0000') + entry.grab_focus() + + insert_text(entry, '1234') + refresh_gui(DELAY) + self.assertEqual(entry.get_text(), '(12) 34 - ') + + send_backspace(entry) + refresh_gui(DELAY) + self.assertEqual(entry.get_text(), '(12) 3 - ') + + send_backspace(entry) + refresh_gui(DELAY) + self.assertEqual(entry.get_text(), '(12) - ') + + send_backspace(entry) + refresh_gui(DELAY) + self.assertEqual(entry.get_text(), '(1 ) - ') + + send_backspace(entry) + refresh_gui(DELAY) + self.assertEqual(entry.get_text(), '( ) - ') + + send_backspace(entry) + refresh_gui(DELAY) + self.assertEqual(entry.get_text(), '( ) - ') + + # FIXME: Delete does not work on windows + def _testDelete(self): + entry = self.entry + entry.set_mask('(00) 0000-0000') + entry.grab_focus() + + insert_text(entry, '12345678') + self.assertEqual(entry.get_text(), '(12) 3456-78 ') + + # Home + entry.emit('move-cursor', gtk.MOVEMENT_DISPLAY_LINE_ENDS, -1, False) + self.assertEqual(entry.get_position(), 1) + + send_delete(entry) + refresh_gui(DELAY) + self.assertEqual(entry.get_text(), '(2 ) 3456-78 ') + + send_delete(entry) + refresh_gui(DELAY) + self.assertEqual(entry.get_text(), '( ) 3456-78 ') + + move(entry, RIGHT) + move(entry, RIGHT) + move(entry, RIGHT) + move(entry, RIGHT) + self.assertEqual(entry.get_position(), 6) + + + send_delete(entry) + refresh_gui(DELAY) + self.assertEqual(entry.get_text(), '( ) 356 -78 ') + + send_delete(entry) + refresh_gui(DELAY) + self.assertEqual(entry.get_text(), '( ) 36 -78 ') + + + + +if __name__ == '__main__': + unittest.main() + diff --git a/tests/test_python.py b/tests/test_python.py index 5acd9e1..8cd420c 100644 --- a/tests/test_python.py +++ b/tests/test_python.py @@ -1,6 +1,6 @@ import unittest -from kiwi.python import slicerange +from kiwi.python import slicerange, enum class SliceTest(unittest.TestCase): def genlist(self, limit, start, stop=None, step=None): @@ -26,3 +26,39 @@ class SliceTest(unittest.TestCase): def testStartStopStep(self): self.assertEqual(self.genlist(10, 0, 10, 2), range(10)[0:10:2]) + +class Status(enum): + OPEN, CLOSE = range(2) + +class Color(enum): + RED, GREEN, BLUE = range(3) + +class EnumTest(unittest.TestCase): + def testEnums(self): + self.failUnless(issubclass(enum, int)) + self.failUnless(isinstance(Color.RED, Color)) + self.failUnless(isinstance(Color.RED, int)) + self.failUnless('RED' in repr(Color.RED), repr(Color.RED)) + self.failUnless(int(Color.RED) is not None) + + def testComparision(self): + self.assertEquals(Color.RED, 0) + self.assertNotEquals(Color.RED, 1) + self.assertNotEquals(Color.RED, -1) + self.assertNotEquals(Color.RED, Color.GREEN) + self.assertNotEquals(Color.GREEN, Status.OPEN) + + def testGet(self): + self.assertEqual(Color.get(0), Color.RED) + self.assertRaises(ValueError, Color.get, 3) + + def testNew(self): + yellow = Color(3, 'YELLOW') + self.failUnless(isinstance(yellow, Color)) + self.assertEquals(Color.YELLOW, yellow) + self.assertRaises(ValueError, Color, 3, 'AGAIN') + self.assertRaises(ValueError, Color, 4, 'RED') + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_tasklet.py b/tests/test_tasklet.py index dd5292f..41c8163 100644 --- a/tests/test_tasklet.py +++ b/tests/test_tasklet.py @@ -1,18 +1,182 @@ +import time +import math import unittest +import os +import sys import gobject -from kiwi.tasklet import WaitForSignal +from kiwi import tasklet + + +class C(gobject.GObject): + __gsignals__ = { 'my-signal': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + (gobject.TYPE_INT,)) } + def do_my_signal(self, arg): + self.arg = arg -import utils class TestWaitForSignal(unittest.TestCase): def testBadArguments(self): - self.assertRaises(TypeError, WaitForSignal, '', '') - self.assertRaises(ValueError, WaitForSignal, gobject.GObject(), 'foo') + self.assertRaises(TypeError, tasklet.WaitForSignal, '', '') + self.assertRaises(ValueError, tasklet.WaitForSignal, gobject.GObject(), 'foo') + + def testGoodArguments(self): + tasklet.WaitForSignal(gobject.GObject(), 'notify') + + def testSignal(self): + obj = C() + + def some_task(obj): + yield tasklet.WaitForSignal(obj, 'my-signal') + tasklet.get_event() + raise StopIteration("return-val") + + task = tasklet.run(some_task(obj)) + obj.emit("my-signal", 1) + self.assertEqual(task.state, tasklet.Tasklet.STATE_ZOMBIE) + self.assertEqual(task.return_value, "return-val") + +class TestWaitForTimeout(unittest.TestCase): + def time(self): + if sys.platform == 'win32': + return time.clock() + else: + return time.time() + + def testTimeout(self): + def some_task(): + yield tasklet.WaitForTimeout(100) + tasklet.get_event() + raise StopIteration("return-val") + + mainloop = gobject.MainLoop() + t1 = self.time() + task = tasklet.run(some_task()) + task.add_join_callback(lambda task, retval: mainloop.quit()) + mainloop.run() + t2 = self.time() + self.assertEqual(task.state, tasklet.Tasklet.STATE_ZOMBIE) + self.assertEqual(task.return_value, "return-val") + ## check that elapsed time aproximately 100 ms second, give or take 50 ms + ## (glib doesn't guarantee precise timing) + self.assert_(math.fabs((t2 - t1) - 0.1) < 0.05, "elapsed time was %f, expected 0.1" % ((t2 - t1),)) + +class TestMessages(unittest.TestCase): + def testPing(self): + def pinger(remote, value): + yield tasklet.Message('echo-request', dest=remote, value=value) + yield tasklet.WaitForMessages(accept='echo-reply') + msg = tasklet.get_event() + raise StopIteration(msg.value) + + def echoer(): + yield tasklet.WaitForMessages(accept='echo-request') + msg = tasklet.get_event() + assert isinstance(msg, tasklet.Message) + assert msg.sender is not None + yield tasklet.Message('echo-reply', dest=msg.sender, value=msg.value) + + task = tasklet.run(pinger(tasklet.run(echoer()), 123)) + self.assertEqual(task.state, tasklet.Tasklet.STATE_ZOMBIE) + self.assertEqual(task.return_value, 123) + +class TestIO(unittest.TestCase): + def testPipe(self): + # + # Disable this test for win32, because it fails and warns: + # + # File "tests\test_tasklet.py", line 81, in pipe_reader + # assert chan.get_flags() & gobject.IO_FLAG_IS_READABLE + # + # ???:81: g_io_channel_get_flags: assertion `channel != NULL' failed + # ???:95: giowin32.c:1669: 4 is neither a file descriptor or a socket + # ???:96: g_io_channel_set_flags: assertion `channel != NULL' failed + # + if sys.platform == 'win32': + return + + def pipe_reader(chan): + assert chan.get_flags() & gobject.IO_FLAG_IS_READABLE + yield tasklet.WaitForIO(chan, gobject.IO_IN) + tasklet.get_event() + c = chan.read(1) + raise StopIteration(c) + + def pipe_writer(chan, c): + assert chan.get_flags() & gobject.IO_FLAG_IS_WRITEABLE + yield tasklet.WaitForIO(chan, gobject.IO_OUT) + tasklet.get_event() + chan.write(c) + + read_fd, write_fd = os.pipe() + + read_chan = gobject.IOChannel(read_fd) + read_chan.set_flags(gobject.IO_FLAG_NONBLOCK) + reader = tasklet.run(pipe_reader(read_chan)) + + write_chan = gobject.IOChannel(write_fd) + write_chan.set_flags(gobject.IO_FLAG_NONBLOCK) + write_chan.set_encoding(None) + write_chan.set_buffered(False) + writer = tasklet.run(pipe_writer(write_chan, chr(123))) + + mainloop = gobject.MainLoop() + reader.add_join_callback(lambda task, retval: mainloop.quit()) + mainloop.run() + + self.assertEqual(reader.state, tasklet.Tasklet.STATE_ZOMBIE) + self.assertEqual(reader.return_value, chr(123)) + +class TestCallback(unittest.TestCase): + def testCallback(self): + + def dispatch_callback(callback): + callback(123, 456, foo="bar") + return False + + def register_callback(callback): + gobject.timeout_add(100, dispatch_callback, callback) + + def task_func(): + callback = tasklet.WaitForCall() + register_callback(callback) + yield callback + tasklet.get_event() + callback.return_value = False + mainloop.quit() + raise StopIteration((callback.args, callback.kwargs)) + + task = tasklet.run(task_func()) + + mainloop = gobject.MainLoop() + mainloop.run() + + self.assertEqual(task.state, tasklet.Tasklet.STATE_ZOMBIE) + args, kwargs = task.return_value + self.assertEqual(args, (123, 456)) + self.assertEqual(kwargs, dict(foo="bar")) + + +class TestWaitForTasklet(unittest.TestCase): + def testWaitForInstantaneousTask(self): + """Test waiting for a tasklet that is already finished.""" + + def quick_task(): + if 1: + raise StopIteration(123) + yield None + + def task_waiter(): + yield quick_task() + taskwait = tasklet.get_event() + raise StopIteration(taskwait.retval) - def testGoodArgumnets(self): - WaitForSignal(gobject.GObject(), 'notify') + mainloop = gobject.MainLoop() + task = tasklet.run(task_waiter()) + task.add_join_callback(lambda task, retval: mainloop.quit()) + mainloop.run() + self.assertEqual(task.return_value, 123) if __name__ == '__main__': unittest.main() diff --git a/tests/test_ui.py b/tests/test_ui.py index 9bfe1b7..417bb05 100644 --- a/tests/test_ui.py +++ b/tests/test_ui.py @@ -1,8 +1,7 @@ import os +import popen2 import sys -import traceback import unittest -import popen2 def setup(self, rootdir): self._dir = os.getcwd() @@ -12,9 +11,9 @@ def teardown(self): os.chdir(self._dir) def test_filename(rootdir, filename): - cmd = '%s %s %s' % (sys.executable, - os.path.join(rootdir, 'bin', 'kiwi-ui-test'), - os.path.join('tests', 'ui', filename)) + cmd = '%s %s -v %s' % (sys.executable, + os.path.join(rootdir, 'bin', 'kiwi-ui-test'), + os.path.join('tests', 'ui', filename)) if sys.platform == 'win32': status = os.system(cmd) else: diff --git a/tests/ui/diary.py b/tests/ui/diary.py index a753c01..36142aa 100644 --- a/tests/ui/diary.py +++ b/tests/ui/diary.py @@ -1,42 +1,29 @@ -from kiwi.ui.test.player import Player +... -*- Mode: doctest -*- +... run: examples/framework/diary/diary.py -player = Player(['examples/framework/diary/diary.py']) -app = player.get_app() - -player.wait_for_window("Diary") -app.Diary.add.clicked() -app.Diary.title.set_text("New title") -app.Diary.title.set_text("") -app.Diary.title.set_text("F") -app.Diary.title.set_text("Fo") -app.Diary.title.set_text("Foo") -app.Diary.title.set_text("Foob") -app.Diary.title.set_text("Fooba") -app.Diary.title.set_text("Foobar") -app.Diary.add.clicked() -app.Diary.title.set_text("") -app.Diary.title.set_text("New title") -app.Diary.ObjectList.select_paths(['1']) -app.Diary.title.set_text("") -app.Diary.title.set_text("T") -app.Diary.title.set_text("Te") -app.Diary.title.set_text("Tes") -app.Diary.title.set_text("Test") -app.Diary.title.set_text("Testi") -app.Diary.title.set_text("Testin") -app.Diary.title.set_text("Testing") -app.Diary.title.set_text("") -app.Diary.title.set_text("Foobar") -app.Diary.ObjectList.select_paths(['0']) -app.Diary.remove.clicked() -app.Diary.ObjectList.select_paths([]) -app.Diary.title.set_text("") -app.Diary.title.set_text("Testing") -app.Diary.ObjectList.select_paths(['0']) -app.Diary.period.clicked() -app.Diary.evening.clicked() -app.Diary.remove.clicked() -app.Diary.ObjectList.select_paths([]) -player.delete_window("Diary") - -player.finish() +>>> from kiwi.ui.test.runner import runner +>>> runner.start() +>>> Diary = runner.waitopen("Diary") +>>> Diary.add.clicked() +>>> Diary.title.set_text("New title") +>>> Diary.title.set_text("Foobar") +>>> Diary.add.clicked() +>>> Diary.title.set_text("") +>>> Diary.title.set_text("New title") +>>> Diary.ObjectList.select_paths(['1']) +>>> Diary.title.set_text("Testing") +>>> Diary.title.set_text("") +>>> Diary.title.set_text("Foobar") +>>> Diary.ObjectList.select_paths(['0']) +>>> Diary.remove.clicked() +>>> Diary.ObjectList.select_paths([]) +>>> Diary.title.set_text("") +>>> Diary.title.set_text("Testing") +>>> Diary.ObjectList.select_paths(['0']) +>>> Diary.period.clicked() +>>> Diary.evening.clicked() +>>> Diary.remove.clicked() +>>> Diary.ObjectList.select_paths([]) +>>> Diary.delete() +>>> runner.waitclose("Diary") +>>> runner.quit() diff --git a/tests/ui/diary2.py b/tests/ui/diary2.py index d71081c..ce754fa 100644 --- a/tests/ui/diary2.py +++ b/tests/ui/diary2.py @@ -1,83 +1,67 @@ -from kiwi.ui.test.player import Player +... -*- Mode: doctest -*- +... run: examples/framework/diary/diary2.py -player = Player(['examples/framework/diary/diary2.py']) -app = player.get_app() +>>> from kiwi.ui.test.runner import runner +>>> runner.start() +>>> Diary = runner.waitopen("Diary") +>>> Diary.add.clicked() +>>> Diary.title.set_text("Untitled") +>>> Diary.ObjectList.select_paths(['0']) +>>> Diary.title.set_text("First") +>>> Diary.add.clicked() +>>> Diary.title.set_text("") +>>> Diary.title.set_text("Untitled") +>>> Diary.ObjectList.select_paths(['1']) +>>> Diary.title.set_text("Second") +>>> Diary.period.clicked() +>>> Diary.afternoon.clicked() +>>> Diary.add.clicked() +>>> Diary.afternoon.clicked() +>>> Diary.period.clicked() +>>> Diary.title.set_text("") +>>> Diary.title.set_text("Untitled") +>>> Diary.ObjectList.select_paths(['2']) +>>> Diary.title.set_text("Third") +>>> Diary.period.clicked() +>>> Diary.evening.clicked() +>>> Diary.evening.clicked() +>>> Diary.afternoon.clicked() +>>> Diary.title.set_text("") +>>> Diary.title.set_text("Second") +>>> Diary.ObjectList.select_paths(['1']) +>>> Diary.afternoon.clicked() +>>> Diary.period.clicked() +>>> Diary.title.set_text("") +>>> Diary.title.set_text("First") +>>> Diary.ObjectList.select_paths(['0']) +>>> Diary.period.clicked() +>>> Diary.afternoon.clicked() +>>> Diary.title.set_text("") +>>> Diary.title.set_text("Second") +>>> Diary.ObjectList.select_paths(['1']) +>>> Diary.afternoon.clicked() +>>> Diary.evening.clicked() +>>> Diary.title.set_text("") +>>> Diary.title.set_text("Third") +>>> Diary.ObjectList.select_paths(['2']) +>>> Diary.remove.clicked() +>>> Diary.ObjectList.select_paths([]) +>>> Diary.evening.clicked() +>>> Diary.afternoon.clicked() +>>> Diary.title.set_text("") +>>> Diary.title.set_text("Second") +>>> Diary.ObjectList.select_paths(['1']) +>>> Diary.remove.clicked() +>>> Diary.ObjectList.select_paths([]) +>>> Diary.afternoon.clicked() +>>> Diary.period.clicked() +>>> Diary.title.set_text("") +>>> Diary.title.set_text("First") +>>> Diary.ObjectList.select_paths(['0']) +>>> Diary.remove.clicked() +>>> Diary.ObjectList.select_paths([]) +>>> Diary.title.set_text("") +>>> Diary.title.set_text("") +>>> Diary.delete() +>>> runner.quit() -player.wait_for_window("Diary") -app.Diary.add.clicked() -app.Diary.title.set_text("Untitled") -app.Diary.ObjectList.select_paths(['0']) -app.Diary.title.set_text("") -app.Diary.title.set_text("F") -app.Diary.title.set_text("Fi") -app.Diary.title.set_text("Fir") -app.Diary.title.set_text("Firs") -app.Diary.title.set_text("First") -app.Diary.add.clicked() -app.Diary.title.set_text("") -app.Diary.title.set_text("Untitled") -app.Diary.ObjectList.select_paths(['1']) -app.Diary.title.set_text("") -app.Diary.title.set_text("S") -app.Diary.title.set_text("Se") -app.Diary.title.set_text("Sec") -app.Diary.title.set_text("Seco") -app.Diary.title.set_text("Secon") -app.Diary.title.set_text("Second") -app.Diary.period.clicked() -app.Diary.afternoon.clicked() -app.Diary.add.clicked() -app.Diary.afternoon.clicked() -app.Diary.period.clicked() -app.Diary.title.set_text("") -app.Diary.title.set_text("Untitled") -app.Diary.ObjectList.select_paths(['2']) -app.Diary.title.set_text("") -app.Diary.title.set_text("T") -app.Diary.title.set_text("Th") -app.Diary.title.set_text("Thi") -app.Diary.title.set_text("Thir") -app.Diary.title.set_text("Third") -app.Diary.period.clicked() -app.Diary.evening.clicked() -app.Diary.evening.clicked() -app.Diary.afternoon.clicked() -app.Diary.title.set_text("") -app.Diary.title.set_text("Second") -app.Diary.ObjectList.select_paths(['1']) -app.Diary.afternoon.clicked() -app.Diary.period.clicked() -app.Diary.title.set_text("") -app.Diary.title.set_text("First") -app.Diary.ObjectList.select_paths(['0']) -app.Diary.period.clicked() -app.Diary.afternoon.clicked() -app.Diary.title.set_text("") -app.Diary.title.set_text("Second") -app.Diary.ObjectList.select_paths(['1']) -app.Diary.afternoon.clicked() -app.Diary.evening.clicked() -app.Diary.title.set_text("") -app.Diary.title.set_text("Third") -app.Diary.ObjectList.select_paths(['2']) -app.Diary.remove.clicked() -app.Diary.ObjectList.select_paths([]) -app.Diary.evening.clicked() -app.Diary.afternoon.clicked() -app.Diary.title.set_text("") -app.Diary.title.set_text("Second") -app.Diary.ObjectList.select_paths(['1']) -app.Diary.remove.clicked() -app.Diary.ObjectList.select_paths([]) -app.Diary.afternoon.clicked() -app.Diary.period.clicked() -app.Diary.title.set_text("") -app.Diary.title.set_text("First") -app.Diary.ObjectList.select_paths(['0']) -app.Diary.remove.clicked() -app.Diary.ObjectList.select_paths([]) -app.Diary.title.set_text("") -app.Diary.title.set_text("") -player.delete_window("Diary") - -player.finish() diff --git a/tests/ui/personalinformation.py b/tests/ui/personalinformation.py index 390933c..ff1d468 100644 --- a/tests/ui/personalinformation.py +++ b/tests/ui/personalinformation.py @@ -1,115 +1,114 @@ -from kiwi.ui.test.player import Player +... -*- Mode: doctest -*- +... run: examples/validation/personalinformation.py -player = Player(['examples/validation/personalinformation.py']) -app = player.get_app() - -player.wait_for_window("Form") -app.Form.name.set_text("") -app.Form.name.set_text("J") -app.Form.name.set_text("Jo") -app.Form.name.set_text("Joh") -app.Form.name.set_text("Joha") -app.Form.name.set_text("Johan") -app.Form.age.set_text("") -app.Form.age.set_text(" ") -app.Form.age.set_text(" ") -app.Form.age.set_text("1 ") -app.Form.age.set_text("1") -app.Form.age.set_text("12") -app.Form.age.set_text("1") -app.Form.age.set_text("1 ") -app.Form.age.set_text(" ") -app.Form.age.set_text(" ") -app.Form.age.set_text(" ") -app.Form.age.set_text("9 ") -app.Form.age.set_text("9") -app.Form.age.set_text("99") -app.Form.GtkToggleButton.clicked() -app.Form.ProxyEntry.set_text("") -app.Form.ProxyEntry.set_text(" / / ") -app.Form.ProxyEntry.set_text(" / / ") -app.Form.ProxyEntry.set_text("/ / ") -app.Form.ProxyEntry.set_text(" / ") -app.Form.ProxyEntry.set_text(" / ") -app.Form.ProxyEntry.set_text("/ ") -app.Form.ProxyEntry.set_text(" ") -app.Form.ProxyEntry.set_text(" ") -app.Form.ProxyEntry.set_text(" ") -app.Form.ProxyEntry.set_text(" ") -app.Form.ProxyEntry.set_text("") -app.Form.ProxyEntry.set_text("02/14/1969") -app.Form.GtkToggleButton.clicked() -app.Form.ProxyEntry.set_text("") -app.Form.ProxyEntry.set_text(" / / ") -app.Form.ProxyEntry.set_text(" / / ") -app.Form.ProxyEntry.set_text("/ / ") -app.Form.ProxyEntry.set_text(" / ") -app.Form.ProxyEntry.set_text(" / ") -app.Form.ProxyEntry.set_text("/ ") -app.Form.ProxyEntry.set_text(" ") -app.Form.ProxyEntry.set_text(" ") -app.Form.ProxyEntry.set_text(" ") -app.Form.ProxyEntry.set_text(" ") -app.Form.ProxyEntry.set_text("") -app.Form.ProxyEntry.set_text("02/13/1969") -app.Form.height.set_text("") -app.Form.height.set_text("1") -app.Form.height.set_text("12") -app.Form.height.set_text("123") -app.Form.height.set_text("1234") -app.Form.height.set_text("12345") -app.Form.weight.set_text("") -app.Form.weight.set_text("87") -app.Form.weight.set_text("") -app.Form.weight.set_text("88") -app.Form.weight.set_text("") -app.Form.weight.set_text("89") -app.Form.weight.set_text("") -app.Form.weight.set_text("90") -app.Form.weight.set_text("") -app.Form.weight.set_text("91") -app.Form.weight.set_text("") -app.Form.weight.set_text("92") -app.Form.weight.set_text("") -app.Form.weight.set_text("93") -app.Form.weight.set_text("") -app.Form.weight.set_text("92") -app.Form.weight.set_text("") -app.Form.weight.set_text("91") -app.Form.weight.set_text("") -app.Form.weight.set_text("90") -app.Form.weight.set_text("") -app.Form.weight.set_text("89") -app.Form.weight.set_text("") -app.Form.weight.set_text("90") -app.Form.height.set_text("") -app.Form.height.set_text("1") -app.Form.height.set_text("12") -app.Form.age.set_text("") -app.Form.age.set_text(" ") -app.Form.age.set_text(" ") -app.Form.age.set_text("1 ") -app.Form.age.set_text("1") -app.Form.age.set_text("12") -app.Form.GtkToggleButton.clicked() -app.Form.ProxyEntry.set_text("") -app.Form.ProxyEntry.set_text("Brazilian") -app.Form.GtkToggleButton.clicked() -app.Form.ProxyEntry.set_text("") -app.Form.ProxyEntry.set_text("Yankee") -app.Form.ProxyEntry.set_text("") -app.Form.ProxyEntry.set_text("Other") -app.Form.ProxyEntry.set_text("") -app.Form.ProxyEntry.set_text("Yankee") -app.Form.ProxyEntry.set_text("") -app.Form.ProxyEntry.set_text("Brazilian") -app.Form.ProxyEntry.set_text("") -app.Form.ProxyEntry.set_text("Yankee") -app.Form.gender.select_item_by_label("Male") -app.Form.gender.select_item_by_label("Female") -app.Form.status_single.clicked() -app.Form.status.clicked() -app.Form.status.clicked() -app.Form.status_single.clicked() -app.Form.ok_btn.clicked() -player.finish() +>>> from kiwi.ui.test.runner import runner +>>> Form = runner.waitopen("Form") +>>> Form.name.set_text("") +>>> Form.name.set_text("J") +>>> Form.name.set_text("Jo") +>>> Form.name.set_text("Joh") +>>> Form.name.set_text("Joha") +>>> Form.name.set_text("Johan") +>>> Form.age.set_text("") +>>> Form.age.set_text(" ") +>>> Form.age.set_text(" ") +>>> Form.age.set_text("1 ") +>>> Form.age.set_text("1") +>>> Form.age.set_text("12") +>>> Form.age.set_text("1") +>>> Form.age.set_text("1 ") +>>> Form.age.set_text(" ") +>>> Form.age.set_text(" ") +>>> Form.age.set_text(" ") +>>> Form.age.set_text("9 ") +>>> Form.age.set_text("9") +>>> Form.age.set_text("99") +>>> Form.GtkToggleButton.clicked() +>>> Form.ProxyEntry.set_text("") +>>> Form.ProxyEntry.set_text(" / / ") +>>> Form.ProxyEntry.set_text(" / / ") +>>> Form.ProxyEntry.set_text("/ / ") +>>> Form.ProxyEntry.set_text(" / ") +>>> Form.ProxyEntry.set_text(" / ") +>>> Form.ProxyEntry.set_text("/ ") +>>> Form.ProxyEntry.set_text(" ") +>>> Form.ProxyEntry.set_text(" ") +>>> Form.ProxyEntry.set_text(" ") +>>> Form.ProxyEntry.set_text(" ") +>>> Form.ProxyEntry.set_text("") +>>> Form.ProxyEntry.set_text("02/14/1969") +>>> Form.GtkToggleButton.clicked() +>>> Form.ProxyEntry.set_text("") +>>> Form.ProxyEntry.set_text(" / / ") +>>> Form.ProxyEntry.set_text(" / / ") +>>> Form.ProxyEntry.set_text("/ / ") +>>> Form.ProxyEntry.set_text(" / ") +>>> Form.ProxyEntry.set_text(" / ") +>>> Form.ProxyEntry.set_text("/ ") +>>> Form.ProxyEntry.set_text(" ") +>>> Form.ProxyEntry.set_text(" ") +>>> Form.ProxyEntry.set_text(" ") +>>> Form.ProxyEntry.set_text(" ") +>>> Form.ProxyEntry.set_text("") +>>> Form.ProxyEntry.set_text("02/13/1969") +>>> Form.height.set_text("") +>>> Form.height.set_text("1") +>>> Form.height.set_text("12") +>>> Form.height.set_text("123") +>>> Form.height.set_text("1234") +>>> Form.height.set_text("12345") +>>> Form.weight.set_text("") +>>> Form.weight.set_text("87") +>>> Form.weight.set_text("") +>>> Form.weight.set_text("88") +>>> Form.weight.set_text("") +>>> Form.weight.set_text("89") +>>> Form.weight.set_text("") +>>> Form.weight.set_text("90") +>>> Form.weight.set_text("") +>>> Form.weight.set_text("91") +>>> Form.weight.set_text("") +>>> Form.weight.set_text("92") +>>> Form.weight.set_text("") +>>> Form.weight.set_text("93") +>>> Form.weight.set_text("") +>>> Form.weight.set_text("92") +>>> Form.weight.set_text("") +>>> Form.weight.set_text("91") +>>> Form.weight.set_text("") +>>> Form.weight.set_text("90") +>>> Form.weight.set_text("") +>>> Form.weight.set_text("89") +>>> Form.weight.set_text("") +>>> Form.weight.set_text("90") +>>> Form.height.set_text("") +>>> Form.height.set_text("1") +>>> Form.height.set_text("12") +>>> Form.age.set_text("") +>>> Form.age.set_text(" ") +>>> Form.age.set_text(" ") +>>> Form.age.set_text("1 ") +>>> Form.age.set_text("1") +>>> Form.age.set_text("12") +>>> Form.GtkToggleButton.clicked() +>>> Form.ProxyEntry.set_text("") +>>> Form.ProxyEntry.set_text("Brazilian") +>>> Form.GtkToggleButton.clicked() +>>> Form.ProxyEntry.set_text("") +>>> Form.ProxyEntry.set_text("Yankee") +>>> Form.ProxyEntry.set_text("") +>>> Form.ProxyEntry.set_text("Other") +>>> Form.ProxyEntry.set_text("") +>>> Form.ProxyEntry.set_text("Yankee") +>>> Form.ProxyEntry.set_text("") +>>> Form.ProxyEntry.set_text("Brazilian") +>>> Form.ProxyEntry.set_text("") +>>> Form.ProxyEntry.set_text("Yankee") +>>> Form.gender.select_item_by_label("Male") +>>> Form.gender.select_item_by_label("Female") +>>> Form.status_single.clicked() +>>> Form.status.clicked() +>>> Form.status.clicked() +>>> Form.status_single.clicked() +>>> Form.ok_btn.clicked() +>>> runner.quit() |