desktop

Change of tests/test_dialog.py

48:e717f5ff9f90
tests/test_dialog.py
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tests/test_dialog.py	Tue Dec 04 00:07:43 2007 +0000
     1.3 @@ -0,0 +1,67 @@
     1.4 +#!/usr/bin/env python
     1.5 +
     1.6 +import desktop.dialog
     1.7 +
     1.8 +def test_open(obj, desktop=None):
     1.9 +    try:
    1.10 +        return obj.open(desktop)
    1.11 +    except OSError:
    1.12 +        return None
    1.13 +
    1.14 +"""
    1.15 +obj = desktop.dialog.Question("Are you sure?", 40, 5)
    1.16 +print test_open(obj)
    1.17 +print test_open(obj, "KDE")
    1.18 +print test_open(obj, "GNOME")
    1.19 +print test_open(obj, "X11")
    1.20 +
    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.Warning("Beware of the penguin!", 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 +
    1.33 +obj = desktop.dialog.Error("Penguin invasion complete!", 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 +
    1.40 +obj = desktop.dialog.Menu("Choose an animal", ["*", "Animal"], width=40, height=15, list_height=5)
    1.41 +obj.add("a", "Antelope")
    1.42 +obj.add("b", "Badger")
    1.43 +obj.add("c", "Cow")
    1.44 +obj.add("d", "Dog")
    1.45 +obj.add("e", "Elephant")
    1.46 +obj.add("f", "Fox")
    1.47 +obj.add("g", "Giraffe")
    1.48 +obj.add("h", "Horse")
    1.49 +obj.add("i", "Iguana")
    1.50 +print test_open(obj)
    1.51 +print test_open(obj, "KDE")
    1.52 +print test_open(obj, "GNOME")
    1.53 +print test_open(obj, "X11")
    1.54 +
    1.55 +obj = desktop.dialog.CheckList("Choose some animals", ["S", "*", "Animal"], width=40, height=15, list_height=5)
    1.56 +obj.add("a", "Antelope")
    1.57 +obj.add("b", "Badger", 1)
    1.58 +obj.add("c", "Cow", 0)
    1.59 +obj.add("d", "Dog")
    1.60 +obj.add("e", "Elephant")
    1.61 +obj.add("f", "Fox", 1)
    1.62 +obj.add("g", "Giraffe")
    1.63 +obj.add("h", "Horse")
    1.64 +obj.add("i", "Iguana")
    1.65 +print test_open(obj)
    1.66 +print test_open(obj, "KDE")
    1.67 +print test_open(obj, "GNOME")
    1.68 +print test_open(obj, "X11")
    1.69 +
    1.70 +# vim: tabstop=4 expandtab shiftwidth=4