Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing properties and tests #148

Merged
merged 3 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/czml3/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,8 @@ class Polygon(BaseCZMLObject):
holes = attr.ib(default=None)
outlineColor = attr.ib(default=None)
outline = attr.ib(default=None)
extrudedHeight = attr.ib(default=None)
perPositionHeight = attr.ib(default=None)


@attr.s(str=False, frozen=True, kw_only=True)
Expand Down
68 changes: 68 additions & 0 deletions tests/test_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,22 @@ def test_outline_material_colors():
assert str(omat) == expected_result


def test_positionlist_epoch():
expected_result = """{
"cartographicDegrees": [
200,
100,
30
],
"epoch": "2019-06-11T12:26:58.000000Z"
}"""
p = PositionList(
epoch=dt.datetime(2019, 6, 11, 12, 26, 58, tzinfo=dt.timezone.utc),
cartographicDegrees=[200, 100, 30],
)
assert str(p) == expected_result


def test_color_isvalid():
assert Color.is_valid([255, 204, 0, 55])
assert Color.is_valid([255, 204, 55])
Expand Down Expand Up @@ -829,6 +845,58 @@ def test_polygon_interval():
assert str(poly) == expected_result


def test_polygon_outline():
expected_result = """{
"positions": {
"cartographicDegrees": [
10.0,
20.0,
0.0
]
},
"material": {
"solidColor": {
"color": {
"rgba": [
255,
100,
0,
100
]
}
}
},
"outlineColor": {
"rgba": [
0,
0,
0,
255
]
},
"outline": true,
"extrudedHeight": 0,
"perPositionHeight": true
}"""
poly = Polygon(
positions=PositionList(cartographicDegrees=[10.0, 20.0, 0.0]),
material=Material(
solidColor=SolidColorMaterial(
color=Color(
rgba=[255, 100, 0, 100],
),
),
),
outlineColor=Color(
rgba=[0, 0, 0, 255],
),
outline=True,
extrudedHeight=0,
perPositionHeight=True,
)
assert str(poly) == expected_result


def test_polygon_interval_with_position():
"""This only tests one interval"""

Expand Down
Loading