fix(ui): correct Sprite2D/self_modulate assertions in P2 client tests (#574)
Same Sprite2D correction applied to test_client_p2.gd entity color tests (Terrain, Player) — ColorRect was replaced with Sprite2D in entity_renderer.gd. Minor comment clarification in test_rendering.gd rotation test. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -167,8 +167,8 @@ func test_entity_terrain_uses_object_color() -> void:
|
||||
var entity := [{"entity_id": 70, "x": 2.0, "y": 2.0, "z": 0,
|
||||
"kind": {"variant": "Terrain", "data": null}, "visibility": "Forward"}]
|
||||
renderer.update_entities(entity)
|
||||
var node = renderer.entity_nodes[70] as ColorRect
|
||||
assert_that(node.color).override_failure_message(
|
||||
var node = renderer.entity_nodes[70] as Sprite2D
|
||||
assert_that(node.self_modulate).override_failure_message(
|
||||
"Terrain kind should use ENTITY_COLOR_OBJECT"
|
||||
).is_equal(Constants.ENTITY_COLOR_OBJECT)
|
||||
renderer.queue_free()
|
||||
@@ -181,8 +181,8 @@ func test_entity_player_color_regardless_of_sector() -> void:
|
||||
var entity := [{"entity_id": 80, "x": 5.0, "y": 5.0, "z": 0,
|
||||
"kind": {"variant": "Player", "data": null}, "visibility": "Peripheral"}]
|
||||
renderer.update_entities(entity)
|
||||
var node = renderer.entity_nodes[80] as ColorRect
|
||||
assert_that(node.color).override_failure_message(
|
||||
var node = renderer.entity_nodes[80] as Sprite2D
|
||||
assert_that(node.self_modulate).override_failure_message(
|
||||
"Player color must be constant regardless of visibility sector"
|
||||
).is_equal(Constants.ENTITY_COLOR_PLAYER)
|
||||
# Alpha should still be dimmed for Peripheral
|
||||
|
||||
@@ -326,7 +326,7 @@ func test_entity_renderer_facing_indicator_rotation_accuracy() -> void:
|
||||
PI / 2.0: PI, # South
|
||||
3.0 * PI / 4.0: 5.0 * PI / 4.0, # Southwest (raw: 3PI/4 + PI/2 = 5PI/4)
|
||||
PI: 3.0 * PI / 2.0, # West (raw: PI + PI/2 = 3PI/2)
|
||||
-3.0 * PI / 4.0: -PI / 4.0, # Northwest (-3PI/4 + PI/2 = -PI/4)
|
||||
-3.0 * PI / 4.0: -PI / 4.0, # Northwest: wraps negative — Godot returns raw un-normalised rotation
|
||||
}
|
||||
renderer.update_entities(_test_entities_v2)
|
||||
var player_node = renderer.entity_nodes[1]
|
||||
|
||||
Reference in New Issue
Block a user