mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 19:08:55 -04:00
30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
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)
|