mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
parent
16afdd2bf9
commit
8c74919a8b
@ -224,7 +224,12 @@ class DirectGuiBase(DirectObject.DirectObject):
|
||||
del keywords[name]
|
||||
else:
|
||||
# Use optionDefs value
|
||||
optionInfo[name] = [default, default, function]
|
||||
value = default
|
||||
if isinstance(value, list):
|
||||
value = list(value)
|
||||
elif isinstance(value, dict):
|
||||
value = dict(value)
|
||||
optionInfo[name] = [default, value, function]
|
||||
elif optionInfo[name][FUNCTION] is None:
|
||||
# Only override function if not defined by derived class
|
||||
optionInfo[name][FUNCTION] = function
|
||||
|
@ -1,6 +1,21 @@
|
||||
from direct.gui.DirectButton import DirectButton
|
||||
|
||||
|
||||
def test_button_default_extraArgs():
|
||||
btn = DirectButton()
|
||||
|
||||
assert btn.configure('extraArgs') == ('extraArgs', [], [])
|
||||
assert btn._optionInfo['extraArgs'] == [[], [], None]
|
||||
|
||||
# Changing will not affect default value
|
||||
btn['extraArgs'].append(1)
|
||||
assert btn.configure('extraArgs') == ('extraArgs', [], [1])
|
||||
|
||||
# Changing this does
|
||||
btn.configure('extraArgs')[1].append(2)
|
||||
assert btn.configure('extraArgs') == ('extraArgs', [2], [1])
|
||||
|
||||
|
||||
def test_button_destroy():
|
||||
btn = DirectButton(text="Test")
|
||||
btn.destroy()
|
||||
|
Loading…
x
Reference in New Issue
Block a user