mirror of
https://github.com/deunix-educ/aventuriers-des-mots.git
synced 2026-10-13 10:21:58 +02:00
Fix overlapping mission markers on the world map
Manual test: "La clairière" and "La cabane" overlapped on screen. Their fractional positions (0.8,0.65) and (0.92,0.78) were too close given the marker size at the project's default window size — exactly the risk flagged but unverified in the previous commit. Repositioned all 9 missions (not just the new ones) onto a regular 3x3 grid with 0.35 spacing, well clear of marker dimensions at the default resolution. Added a headless regression test (tests/data/test_mission_positions.gd) that fails if any two missions are closer than a 0.3 fractional gap on both axes — a data-level guard, not a substitute for visually checking actual on-screen layout. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
extends GutTest
|
||||
## Garde-fou contre le chevauchement de marqueurs sur la carte (signale
|
||||
## manuellement : "La clairiere" et "La cabane" se chevauchaient, voir
|
||||
## docs/specs/decisions.md). scenes/world/world_map.gd place chaque marqueur
|
||||
## a une position fractionnelle (map_position.x/y de data/missions/*.json) ;
|
||||
## sans ecart suffisant entre deux missions, leurs boutons se recouvrent a
|
||||
## l'ecran. Verifie l'ecart plutot que le rendu reel (non testable sans
|
||||
## ecran), avec une marge volontairement un peu permissive par rapport a la
|
||||
## grille 0.35 utilisee dans les donnees.
|
||||
|
||||
const MIN_FRACTIONAL_GAP := 0.3
|
||||
|
||||
|
||||
func test_mission_markers_do_not_overlap() -> void:
|
||||
var missions := ExerciseEngine.get_missions()
|
||||
for i in missions.size():
|
||||
for j in range(i + 1, missions.size()):
|
||||
var a: Dictionary = missions[i]["map_position"]
|
||||
var b: Dictionary = missions[j]["map_position"]
|
||||
var dx: float = abs(float(a["x"]) - float(b["x"]))
|
||||
var dy: float = abs(float(a["y"]) - float(b["y"]))
|
||||
assert_true(
|
||||
dx >= MIN_FRACTIONAL_GAP or dy >= MIN_FRACTIONAL_GAP,
|
||||
(
|
||||
"%s et %s sont trop proches (dx=%s, dy=%s)"
|
||||
% [missions[i]["mission_id"], missions[j]["mission_id"], dx, dy]
|
||||
),
|
||||
)
|
||||
Reference in New Issue
Block a user