@skip_if_not_wx
def test_wx_spin_control_editing():
    # behavior: when editing the text part of a spin control box, pressing
    # the OK button should update the value of the HasTraits class
    # (tests a bug where this fails with an AttributeError)

    with store_exceptions_on_all_threads():
        num = NumberWithTextEditor()
        ui = num.edit_traits()

        # the following is equivalent to setting the text in the text control,
        # then pressing OK

        textctrl = ui.control.FindWindowByName('text')
        textctrl.SetValue('1')

        # press the OK button and close the dialog
        press_ok_button(ui)

    # the number traits should be between 3 and 8
    assert num.number >= 3 and num.number <=8
dataset/ETHPy150Open enthought/traitsui/traitsui/tests/editors/test_range_editor_text.py/test_wx_spin_control_editing/original