feat: configure outdoor texture scale and rotation per area
This commit is contained in:
1 parent
d8cf076019
commit
c56f1a5ba9
26 files changed
+1958
-1778
No files matched your search
@@ -408,3 +408,22 @@ def test_new_outdoor_surfaces(kind: str) -> None:
|
||||
data = {"id": "outside", "type": kind, "points": [[0, 0], [4.03, 0], [4, 3]], "slope": 0.2, "opacity": 0.4}
|
||||
result = OUTDOOR_SCHEMA(data)
|
||||
assert all(result[key] == value for key, value in data.items())
|
||||
|
||||
|
||||
def test_outdoor_texture_settings() -> None:
|
||||
from custom_components.nextfloor.schema import OUTDOOR_SCHEMA
|
||||
|
||||
base = {"id": "outside", "type": "terrace", "points": [[0, 0], [4, 0], [4, 3]]}
|
||||
old = OUTDOOR_SCHEMA(base)
|
||||
assert old["texture_scale"] is None and old["texture_rotation"] is None
|
||||
for scale, rotation in [(0.05, -360), (1, 0), (2.5, 45), (20, 360)]:
|
||||
result = OUTDOOR_SCHEMA({**base, "texture_scale": scale, "texture_rotation": rotation})
|
||||
assert result["texture_scale"] == scale and result["texture_rotation"] == rotation
|
||||
for key, invalid in [
|
||||
("texture_scale", 0),
|
||||
("texture_scale", 21),
|
||||
("texture_rotation", -361),
|
||||
("texture_rotation", 361),
|
||||
]:
|
||||
with pytest.raises(vol.Invalid):
|
||||
OUTDOOR_SCHEMA({**base, key: invalid})
|
||||
Reference in new issue
Block a user