mirror of
https://github.com/OMGeeky/pytiled_parser.git
synced 2025-12-26 17:02:28 +01:00
Fix color parsing
This commit is contained in:
@@ -20,10 +20,10 @@ def parse_color(color: str) -> Color:
|
||||
return Color(int(color[0:2], 16), int(color[2:4], 16), int(color[4:6], 16), 255)
|
||||
elif len(color) == 8:
|
||||
return Color(
|
||||
int(color[0:2], 16),
|
||||
int(color[2:4], 16),
|
||||
int(color[4:6], 16),
|
||||
int(color[6:8], 16),
|
||||
int(color[0:2], 16),
|
||||
)
|
||||
|
||||
raise ValueError("Improperly formatted color passed to parse_color")
|
||||
|
||||
@@ -173,7 +173,7 @@ EXPECTED = tiled_map.TiledMap(
|
||||
},
|
||||
properties={
|
||||
"bool property - true": True,
|
||||
"color property": common_types.Color(255, 73, 252, 255),
|
||||
"color property": common_types.Color(73, 252, 255, 255),
|
||||
"file property": Path("../../../../../../var/log/syslog"),
|
||||
"float property": 1.23456789,
|
||||
"int property": 13,
|
||||
|
||||
@@ -35,7 +35,7 @@ EXPECTED = tiled_map.TiledMap(
|
||||
},
|
||||
properties={
|
||||
"bool property - true": True,
|
||||
"color property": common_types.Color(255, 73, 252, 255),
|
||||
"color property": common_types.Color(73, 252, 255, 255),
|
||||
"file property": Path("../../../../../../var/log/syslog"),
|
||||
"float property": 1.23456789,
|
||||
"int property": 13,
|
||||
|
||||
@@ -68,7 +68,7 @@ EXPECTED = tiled_map.TiledMap(
|
||||
},
|
||||
properties={
|
||||
"bool property - true": True,
|
||||
"color property": common_types.Color(255, 73, 252, 255),
|
||||
"color property": common_types.Color(73, 252, 255, 255),
|
||||
"file property": Path("../../../../../../var/log/syslog"),
|
||||
"float property": 1.23456789,
|
||||
"int property": 13,
|
||||
|
||||
@@ -18,7 +18,7 @@ EXPECTED = tileset.Tileset(
|
||||
version="1.6",
|
||||
properties={
|
||||
"bool property": True,
|
||||
"color property": Color(255, 0, 0, 255),
|
||||
"color property": Color(0, 0, 255, 255),
|
||||
"float property": 5.6,
|
||||
"int property": 5,
|
||||
"string property": "testing",
|
||||
|
||||
@@ -261,7 +261,7 @@ RECTANGLES = [
|
||||
coordinates=common_types.OrderedPair(39.0678640445606, 131.826759122428),
|
||||
properties={
|
||||
"bool property": False,
|
||||
"color property": common_types.Color(255, 170, 0, 0),
|
||||
"color property": common_types.Color(170, 0, 0, 255),
|
||||
"file property": Path("../../../../../../dev/null"),
|
||||
"float property": 42.1,
|
||||
"int property": 8675309,
|
||||
|
||||
Reference in New Issue
Block a user