test_DirectSlider.py 1.1 KB

1234567891011121314151617181920212223242526272829
  1. from direct.gui.DirectSlider import DirectSlider
  2. from direct.gui import DirectGuiGlobals as DGG
  3. import pytest
  4. def test_slider_orientation():
  5. slider = DirectSlider()
  6. # Horizontal orientation is the default
  7. assert slider['orientation'] == DGG.HORIZONTAL
  8. assert slider['frameSize'] == (-1, 1, -0.08, 0.08)
  9. assert slider['frameVisibleScale'] == (1, 0.25)
  10. # try change to vertical orientation
  11. slider['orientation'] = DGG.VERTICAL
  12. assert slider['orientation'] == DGG.VERTICAL
  13. assert slider['frameSize'] == (-0.08, 0.08, -1, 1)
  14. assert slider['frameVisibleScale'] == (0.25, 1)
  15. # back to horizontal
  16. slider['orientation'] = DGG.HORIZONTAL
  17. assert slider['orientation'] == DGG.HORIZONTAL
  18. assert slider['frameSize'] == (-1, 1, -0.08, 0.08)
  19. assert slider['frameVisibleScale'] == (1, 0.25)
  20. # finally change to inverted vertical orientation
  21. slider['orientation'] = DGG.VERTICAL_INVERTED
  22. assert slider['orientation'] == DGG.VERTICAL_INVERTED
  23. assert slider['frameSize'] == (-0.08, 0.08, -1, 1)
  24. assert slider['frameVisibleScale'] == (0.25, 1)