forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_DirectSlider.py
More file actions
29 lines (24 loc) · 1.08 KB
/
test_DirectSlider.py
File metadata and controls
29 lines (24 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from direct.gui.DirectSlider import DirectSlider
from direct.gui import DirectGuiGlobals as DGG
import pytest
def test_slider_orientation():
slider = DirectSlider()
# Horizontal orientation is the default
assert slider['orientation'] == DGG.HORIZONTAL
assert slider['frameSize'] == (-1, 1, -0.08, 0.08)
assert slider['frameVisibleScale'] == (1, 0.25)
# try change to vertical orientation
slider['orientation'] = DGG.VERTICAL
assert slider['orientation'] == DGG.VERTICAL
assert slider['frameSize'] == (-0.08, 0.08, -1, 1)
assert slider['frameVisibleScale'] == (0.25, 1)
# back to horizontal
slider['orientation'] = DGG.HORIZONTAL
assert slider['orientation'] == DGG.HORIZONTAL
assert slider['frameSize'] == (-1, 1, -0.08, 0.08)
assert slider['frameVisibleScale'] == (1, 0.25)
# finally change to inverted vertical orientation
slider['orientation'] = DGG.VERTICAL_INVERTED
assert slider['orientation'] == DGG.VERTICAL_INVERTED
assert slider['frameSize'] == (-0.08, 0.08, -1, 1)
assert slider['frameVisibleScale'] == (0.25, 1)