test_ux: Undo-Ketten-Zählung korrigiert — 4 Commits brauchen 4 Undos (Karte t_f6f29d86)
Der Off-by-one im Test erwartete nach 2 Undos den Zustand nach move1, obwohl 3 Züge davorliegen (Zug, Kanten-Clamp, zurück ins Feld). Der Code war korrekt (EINE Aktion = EIN Undo-Schritt), der Test zählte falsch. Jetzt wird jeder Schritt einzeln verifiziert inkl. geclamptem Kanten-Zustand. Suite: 253 Checks grün.
This commit is contained in:
parent
849129d67f
commit
595d1217d9
1 changed files with 7 additions and 3 deletions
|
|
@ -464,15 +464,19 @@ func _test_group_move_rotate_undo() -> void:
|
||||||
_check(center_after.distance_to(center) < 0.5, "Drehen: Schwerpunkt bleibt (Rotation um die Mitte)")
|
_check(center_after.distance_to(center) < 0.5, "Drehen: Schwerpunkt bleibt (Rotation um die Mitte)")
|
||||||
|
|
||||||
# UND JETZT das Kern-Versprechen: EINE Aktion = EIN Undo-Schritt.
|
# UND JETZT das Kern-Versprechen: EINE Aktion = EIN Undo-Schritt.
|
||||||
|
# 4 Commits (Zug, Kanten-Clamp, zurück ins Feld, Drehen) → 4 Undos bis zum Anfang.
|
||||||
var steps_before := hist.entries.size()
|
var steps_before := hist.entries.size()
|
||||||
hist.undo() # nimmt Rotation zurück → Zustand nach "zurück ins Feld"
|
hist.undo() # nimmt die Rotation zurück → Zustand nach "zurück ins Feld"
|
||||||
_check(absf(float(objects[0]["rot_y_deg"]) - 0.0) < 0.001, "undo: Rotation zurück")
|
_check(absf(float(objects[0]["rot_y_deg"]) - 0.0) < 0.001, "undo: Rotation zurück")
|
||||||
_check(GroupOps.group_id(objects[0]) == 0 and GroupOps.group_id(objects[1]) == 0, "undo: Gruppen-Bindung bleibt (Feld reist im objects-Snapshot)")
|
_check(GroupOps.group_id(objects[0]) == 0 and GroupOps.group_id(objects[1]) == 0, "undo: Gruppen-Bindung bleibt (Feld reist im objects-Snapshot)")
|
||||||
_check(hist.entries.size() == steps_before, "kein Eintrag verlorengegangen")
|
_check(hist.entries.size() == steps_before, "kein Eintrag verlorengegangen")
|
||||||
hist.undo() # nimmt den letzten Zug zurück → Zustand nach move1 (4/-3)
|
hist.undo() # nimmt "zurück ins Feld" zurück → geclampte Kanten-Position
|
||||||
|
_check(float(objects[0]["pos"][0]) <= 128.0 and absf(float(objects[0]["pos"][1]) - 0.0) < 0.001,
|
||||||
|
"undo: Kanten-Zug zurück (geclampter Zustand, EIN Schritt)")
|
||||||
|
hist.undo() # nimmt den Kanten-Zug zurück → Zustand nach move1 (4/-3)
|
||||||
_check(absf(float(objects[0]["pos"][0]) - 4.0) < 0.001 and absf(float(objects[0]["pos"][2]) - -3.0) < 0.001,
|
_check(absf(float(objects[0]["pos"][0]) - 4.0) < 0.001 and absf(float(objects[0]["pos"][2]) - -3.0) < 0.001,
|
||||||
"undo: Zug komplett zurück (beide Mitglieder EIN Schritt)")
|
"undo: Zug komplett zurück (beide Mitglieder EIN Schritt)")
|
||||||
hist.redo() # setzt die geclampte Kanten-Position wieder ein
|
hist.redo() # setzt den Kanten-Zug wieder ein
|
||||||
_check(float(objects[0]["pos"][0]) <= 128.0 and absf(float(objects[0]["pos"][1]) - 0.0) < 0.001,
|
_check(float(objects[0]["pos"][0]) <= 128.0 and absf(float(objects[0]["pos"][1]) - 0.0) < 0.001,
|
||||||
"redo: Zug wieder da (geclampt auf die gleiche Stelle)")
|
"redo: Zug wieder da (geclampt auf die gleiche Stelle)")
|
||||||
_check(GroupOps.group_id(objects[1]) == 0, "redo: Gruppe bleibt gebunden")
|
_check(GroupOps.group_id(objects[1]) == 0, "redo: Gruppe bleibt gebunden")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue