Esempio n. 1
0
def test_update_command_with_parameter():
    a = App()

    callback_event = Event()

    def callback(value):
        assert c.value == "foo"
        callback_event.set()

    c = Combo(a, ["foo", "bar"])

    c.update_command(callback)

    c._command_callback(c.value)
    assert callback_event.is_set()

    a.destroy()
Esempio n. 2
0
def test_update_command():
    a = App()

    callback_event = Event()

    def callback():
        callback_event.set()

    c = Combo(a, ["foo", "bar"])

    c._command_callback(c.value)
    assert not callback_event.is_set()

    c.update_command(callback)
    c._command_callback(c.value)
    assert callback_event.is_set()
    callback_event.clear()

    c.update_command(None)
    c._command_callback(c.value)
    assert not callback_event.is_set()

    a.destroy()