test_DirectButton.py 594 B

123456789101112131415161718192021
  1. from direct.gui.DirectButton import DirectButton
  2. def test_button_default_extraArgs():
  3. btn = DirectButton()
  4. assert btn.configure('extraArgs') == ('extraArgs', [], [])
  5. assert btn._optionInfo['extraArgs'] == [[], [], None]
  6. # Changing will not affect default value
  7. btn['extraArgs'].append(1)
  8. assert btn.configure('extraArgs') == ('extraArgs', [], [1])
  9. # Changing this does
  10. btn.configure('extraArgs')[1].append(2)
  11. assert btn.configure('extraArgs') == ('extraArgs', [2], [1])
  12. def test_button_destroy():
  13. btn = DirectButton(text="Test")
  14. btn.destroy()