Skip to content

Commit 6fdce6d

Browse files
authored
Add more tests for Enum Editor (#836)
* Add more tests for Enum Editor * Add wx EnumEditor tests * Add missing skipif decorator * Add issue references to FIXMEs * Address review comments
1 parent 64858b8 commit 6fdce6d

File tree

2 files changed

+446
-79
lines changed

2 files changed

+446
-79
lines changed

traitsui/tests/_tools.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,32 @@ def get_dialog_size(ui_control):
177177
return ui_control.size().width(), ui_control.size().height()
178178

179179

180+
def get_all_button_status(control):
181+
"""Get status of all 2-state (wx) or checkable (qt) buttons under given
182+
control.
183+
184+
Assumes all sizer children (wx) or layout items (qt) are buttons.
185+
"""
186+
button_status = []
187+
188+
if is_current_backend_wx():
189+
for item in control.GetSizer().GetChildren():
190+
button = item.GetWindow()
191+
# Ignore empty buttons (assumption that they are invisible)
192+
if button.value != "":
193+
button_status.append(button.GetValue())
194+
195+
elif is_current_backend_qt4():
196+
layout = control.layout()
197+
for i in range(layout.count()):
198+
button = layout.itemAt(i).widget()
199+
button_status.append(button.isChecked())
200+
201+
else:
202+
raise NotImplementedError()
203+
204+
return button_status
205+
180206
# ######### Debug tools
181207

182208

0 commit comments

Comments
 (0)