1.1 --- a/tests/test_dialog.py Thu Dec 13 21:41:15 2007 +0000
1.2 +++ b/tests/test_dialog.py Thu Dec 13 21:41:26 2007 +0000
1.3 @@ -8,60 +8,129 @@
1.4 except OSError:
1.5 return None
1.6
1.7 -"""
1.8 -obj = desktop.dialog.Question("Are you sure?", 40, 5)
1.9 -print test_open(obj)
1.10 -print test_open(obj, "KDE")
1.11 -print test_open(obj, "GNOME")
1.12 -print test_open(obj, "X11")
1.13 +def test_question():
1.14 + obj = desktop.dialog.Question("Are you sure?", 40, 5)
1.15 + print test_open(obj)
1.16 + print test_open(obj, "KDE")
1.17 + print test_open(obj, "GNOME")
1.18 + print test_open(obj, "X11")
1.19 +
1.20 +def test_message():
1.21 + obj = desktop.dialog.Message("Hello world!", 40, 5)
1.22 + print test_open(obj)
1.23 + print test_open(obj, "KDE")
1.24 + print test_open(obj, "GNOME")
1.25 + print test_open(obj, "X11")
1.26
1.27 -obj = desktop.dialog.Message("Hello world!", 40, 5)
1.28 -print test_open(obj)
1.29 -print test_open(obj, "KDE")
1.30 -print test_open(obj, "GNOME")
1.31 -print test_open(obj, "X11")
1.32 +def test_warning():
1.33 + obj = desktop.dialog.Warning("Beware of the penguin!", 40, 5)
1.34 + print test_open(obj)
1.35 + print test_open(obj, "KDE")
1.36 + print test_open(obj, "GNOME")
1.37 + print test_open(obj, "X11")
1.38 +
1.39 +def test_error():
1.40 + obj = desktop.dialog.Error("Penguin invasion complete!", 40, 5)
1.41 + print test_open(obj)
1.42 + print test_open(obj, "KDE")
1.43 + print test_open(obj, "GNOME")
1.44 + print test_open(obj, "X11")
1.45
1.46 -obj = desktop.dialog.Warning("Beware of the penguin!", 40, 5)
1.47 -print test_open(obj)
1.48 -print test_open(obj, "KDE")
1.49 -print test_open(obj, "GNOME")
1.50 -print test_open(obj, "X11")
1.51 +def test_menu():
1.52 + obj = desktop.dialog.Menu("Choose an animal", ["Animal"], width=40, height=15, list_height=5)
1.53 + obj.add("a", "Antelope")
1.54 + obj.add("b", "Badger")
1.55 + obj.add("c", "Cow")
1.56 + obj.add("d", "Dog")
1.57 + obj.add("e", "Elephant")
1.58 + obj.add("f", "Fox")
1.59 + obj.add("g", "Giraffe")
1.60 + obj.add("h", "Horse")
1.61 + obj.add("i", "Iguana")
1.62 + print repr(test_open(obj))
1.63 + print repr(test_open(obj, "KDE"))
1.64 + print repr(test_open(obj, "GNOME"))
1.65 + print repr(test_open(obj, "X11"))
1.66
1.67 -obj = desktop.dialog.Error("Penguin invasion complete!", 40, 5)
1.68 -print test_open(obj)
1.69 -print test_open(obj, "KDE")
1.70 -print test_open(obj, "GNOME")
1.71 -print test_open(obj, "X11")
1.72 -"""
1.73 +def test_checklist():
1.74 + obj = desktop.dialog.CheckList("Choose some animals", ["Animal"], width=40, height=15, list_height=5)
1.75 + obj.add("a", "Antelope")
1.76 + obj.add("b", "Badger", 1)
1.77 + obj.add("c", "Cow", 0)
1.78 + obj.add("d", "Dog")
1.79 + obj.add("e", "Elephant")
1.80 + obj.add("f", "Fox", 1)
1.81 + obj.add("g", "Giraffe")
1.82 + obj.add("h", "Horse")
1.83 + obj.add("i", "Iguana")
1.84 + print repr(test_open(obj))
1.85 + print repr(test_open(obj, "KDE"))
1.86 + print repr(test_open(obj, "GNOME"))
1.87 + print repr(test_open(obj, "X11"))
1.88
1.89 -obj = desktop.dialog.Menu("Choose an animal", ["*", "Animal"], width=40, height=15, list_height=5)
1.90 -obj.add("a", "Antelope")
1.91 -obj.add("b", "Badger")
1.92 -obj.add("c", "Cow")
1.93 -obj.add("d", "Dog")
1.94 -obj.add("e", "Elephant")
1.95 -obj.add("f", "Fox")
1.96 -obj.add("g", "Giraffe")
1.97 -obj.add("h", "Horse")
1.98 -obj.add("i", "Iguana")
1.99 -print test_open(obj)
1.100 -print test_open(obj, "KDE")
1.101 -print test_open(obj, "GNOME")
1.102 -print test_open(obj, "X11")
1.103 +def test_radiolist():
1.104 + obj = desktop.dialog.RadioList("Choose one animal", ["Animal"], width=40, height=15, list_height=5)
1.105 + obj.add("a", "Antelope")
1.106 + obj.add("b", "Badger", 1)
1.107 + obj.add("c", "Cow", 0)
1.108 + obj.add("d", "Dog")
1.109 + obj.add("e", "Elephant")
1.110 + obj.add("f", "Fox", 1)
1.111 + obj.add("g", "Giraffe")
1.112 + obj.add("h", "Horse")
1.113 + obj.add("i", "Iguana")
1.114 + print repr(test_open(obj))
1.115 + print repr(test_open(obj, "KDE"))
1.116 + print repr(test_open(obj, "GNOME"))
1.117 + print repr(test_open(obj, "X11"))
1.118 +
1.119 +def test_pulldown():
1.120 + obj = desktop.dialog.Pulldown("Choose an animal", ["Animal"], width=40, height=15, list_height=5)
1.121 + obj.add("Antelope")
1.122 + obj.add("Badger")
1.123 + obj.add("Cow")
1.124 + obj.add("Dog")
1.125 + obj.add("Elephant")
1.126 + obj.add("Fox")
1.127 + obj.add("Giraffe")
1.128 + obj.add("Horse")
1.129 + obj.add("Iguana")
1.130 + print repr(test_open(obj))
1.131 + print repr(test_open(obj, "KDE"))
1.132 + print repr(test_open(obj, "GNOME"))
1.133 + print repr(test_open(obj, "X11"))
1.134
1.135 -obj = desktop.dialog.CheckList("Choose some animals", ["S", "*", "Animal"], width=40, height=15, list_height=5)
1.136 -obj.add("a", "Antelope")
1.137 -obj.add("b", "Badger", 1)
1.138 -obj.add("c", "Cow", 0)
1.139 -obj.add("d", "Dog")
1.140 -obj.add("e", "Elephant")
1.141 -obj.add("f", "Fox", 1)
1.142 -obj.add("g", "Giraffe")
1.143 -obj.add("h", "Horse")
1.144 -obj.add("i", "Iguana")
1.145 -print test_open(obj)
1.146 -print test_open(obj, "KDE")
1.147 -print test_open(obj, "GNOME")
1.148 -print test_open(obj, "X11")
1.149 +def test_input():
1.150 + obj = desktop.dialog.Input("Enter your name!", "Monty", 40, 5)
1.151 + print repr(test_open(obj))
1.152 + print repr(test_open(obj, "KDE"))
1.153 + print repr(test_open(obj, "GNOME"))
1.154 + print repr(test_open(obj, "X11"))
1.155 +
1.156 +def test_password():
1.157 + obj = desktop.dialog.Password("Enter your password!", "Python", 40, 5)
1.158 + print repr(test_open(obj))
1.159 + print repr(test_open(obj, "KDE"))
1.160 + print repr(test_open(obj, "GNOME"))
1.161 + print repr(test_open(obj, "X11"))
1.162 +
1.163 +def test_textfile():
1.164 + obj = desktop.dialog.TextFile("README.txt", "Showing file...", 80, 25)
1.165 + print repr(test_open(obj))
1.166 + print repr(test_open(obj, "KDE"))
1.167 + print repr(test_open(obj, "GNOME"))
1.168 + print repr(test_open(obj, "X11"))
1.169 +
1.170 +test_question()
1.171 +test_message()
1.172 +test_warning()
1.173 +test_error()
1.174 +test_menu()
1.175 +test_checklist()
1.176 +test_radiolist()
1.177 +test_pulldown()
1.178 +test_input()
1.179 +test_password()
1.180 +test_textfile()
1.181
1.182 # vim: tabstop=4 expandtab shiftwidth=4