Skip to content

Commit

Permalink
Add more tests for Enum Editor (#836)
Browse files Browse the repository at this point in the history
* Add more tests for Enum Editor

* Add wx EnumEditor tests

* Add missing skipif decorator

* Add issue references to FIXMEs

* Address review comments
  • Loading branch information
ievacerny authored May 29, 2020
1 parent 64858b8 commit 6fdce6d
Show file tree
Hide file tree
Showing 2 changed files with 446 additions and 79 deletions.
26 changes: 26 additions & 0 deletions traitsui/tests/_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,32 @@ def get_dialog_size(ui_control):
return ui_control.size().width(), ui_control.size().height()


def get_all_button_status(control):
"""Get status of all 2-state (wx) or checkable (qt) buttons under given
control.
Assumes all sizer children (wx) or layout items (qt) are buttons.
"""
button_status = []

if is_current_backend_wx():
for item in control.GetSizer().GetChildren():
button = item.GetWindow()
# Ignore empty buttons (assumption that they are invisible)
if button.value != "":
button_status.append(button.GetValue())

elif is_current_backend_qt4():
layout = control.layout()
for i in range(layout.count()):
button = layout.itemAt(i).widget()
button_status.append(button.isChecked())

else:
raise NotImplementedError()

return button_status

# ######### Debug tools


Expand Down
Loading

0 comments on commit 6fdce6d

Please sign in to comment.