mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -04:00
parent
16afdd2bf9
commit
8c74919a8b
@ -224,7 +224,12 @@ class DirectGuiBase(DirectObject.DirectObject):
|
|||||||
del keywords[name]
|
del keywords[name]
|
||||||
else:
|
else:
|
||||||
# Use optionDefs value
|
# 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:
|
elif optionInfo[name][FUNCTION] is None:
|
||||||
# Only override function if not defined by derived class
|
# Only override function if not defined by derived class
|
||||||
optionInfo[name][FUNCTION] = function
|
optionInfo[name][FUNCTION] = function
|
||||||
|
@ -1,6 +1,21 @@
|
|||||||
from direct.gui.DirectButton import DirectButton
|
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():
|
def test_button_destroy():
|
||||||
btn = DirectButton(text="Test")
|
btn = DirectButton(text="Test")
|
||||||
btn.destroy()
|
btn.destroy()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user