-
Notifications
You must be signed in to change notification settings - Fork 185
/
test_gui_style_initialization.py
52 lines (32 loc) · 1.31 KB
/
test_gui_style_initialization.py
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import inspect
import pytest
import imgui
IMGUI_DATA_DESCRIPTORS = [
attribute_name for attribute_name in dir(imgui.GuiStyle)
if inspect.isdatadescriptor(getattr(imgui.GuiStyle, attribute_name))
]
@pytest.fixture
def context():
return imgui.create_context()
@pytest.fixture(params=IMGUI_DATA_DESCRIPTORS)
def data_descriptor(request):
if request.param == "colors":
pytest.skip("'{}' isn't a writable property".format(request.param))
return request.param
def gui_style_property():
pass
def test_gui_style_attribute_access_without_create(context, data_descriptor):
style = imgui.GuiStyle()
with pytest.raises(RuntimeError):
setattr(style, data_descriptor, getattr(style, data_descriptor))
def test_gui_style_data_descriptor_symmetry(context, data_descriptor):
style = imgui.GuiStyle.create()
value = getattr(style, data_descriptor)
setattr(style, data_descriptor, getattr(style, data_descriptor))
assert getattr(style, data_descriptor) == value
def test_gui_style_equality(context):
assert imgui.get_style() == imgui.get_style()
assert imgui.get_style() is not imgui.get_style()
def test_gui_style_inequality(context):
assert imgui.GuiStyle.create() != imgui.GuiStyle.create()
assert imgui.GuiStyle.create() is not imgui.GuiStyle.create()