Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

Unity tests: keyboard-only turn gives a unit order (Refs #41) (#2279)

Beri89c8f65d3c76
diff --git a/docs/accessibility-audit-2026-10-14.md b/docs/accessibility-audit-2026-10-14.md
index 16b69167f..ad8fc94b6 100644
--- a/docs/accessibility-audit-2026-10-14.md
+++ b/docs/accessibility-audit-2026-10-14.md
@@ -348,7 +348,8 @@ Escape closes the open screen; on the open card it is Hide; on the start screen
## The keyboard-only turn, 22 October 2026
The done-when's turn, played again on main `5d5bee4d` after B1a (#890), B1b (#1134) and the city panel (#381, #1122,
-#1124): unit orders are left out until #754 closes (owner, 22 October 2026).
+#1124). Unit orders were left out until #754 closed (owner, 22 October 2026); #754 closed on 22 October and the Civ
+movement slices (#1527) are on main, so the turn gives one now (2 November 2026, below).
- **How tested:** `KeyboardTurnTests` (EditMode) on Map.unity at 1280x720, a new GDD game with no start screen. Keys are
sent as the UI Toolkit events the Input System's UI provider makes of them (Tab and Shift+Tab: `NavigationMoveEvent`;
@@ -358,8 +359,10 @@ The done-when's turn, played again on main `5d5bee4d` after B1a (#890), B1b (#11
to the screen's first control (the screens come after the HUD in the order), Tab to a line's +, Enter (focus stays,
H2), Tab to Submit, Enter. Tab to Cabinet, Enter, Tab to a minister's seat, Enter, Tab once to the first candidate,
Enter. Escape (focus to the Cabinet button, M1). Tab to the map stop, pan to Tel Aviv, Enter (the city panel shows),
- Tab to Train halutzim, Enter. Tab to End Turn, Enter: the turn ends and the turn report takes the focus; Enter on its
- Close hands it to the next card, or to End Turn when none opens.
+ Tab to Train halutzim, Enter. Tab to the map stop, pan to Golani, Enter (Golani is selected and its Move pick opens,
+ as in Civ), pan to a lit hex, Enter (Golani moves there; the focus stays on the map stop). Tab to End Turn, Enter:
+ the turn ends and the turn report takes the focus; Enter on its Close hands it to the next card, or to End Turn when
+ none opens.
- **Attention:** the opening turn has 4 Attention; answering the card and Train halutzim cost 2 each, a budget and an
appointment 4 each, so the five steps take more than one turn's Attention. That is the game's rule, not the keyboard's:
the test raises the Attention to check the path. With 4, the budget and the appointment are refused with the toast
@@ -380,6 +383,11 @@ Share, the card again; Shift+Tab the reverse), End Turn's (the map stop, the min
Share, the side menu, New Game, End Turn; Shift+Tab to New Game) and where the focus goes after End Turn
(`KeyboardTurnTests`). No UI string was added, so nothing goes to #564.
+The unit order (2 November 2026, on main `5a2b50ae7`): `AWholeTurnPlaysWithTheKeyboardAlone` now selects Golani
+through the map stop and moves it to a lit hex, both with Enter, and checks that the sim's Move is committed. Nothing
+blocked it, so no code changed. Attack and the confirm step onto a city or a friendly unit (#1808) are pinned in
+`KeyboardOrdersTests`.
+
## The two scroll-bar and focus-drop fixes, 23 October 2026
Two of the three items the 22 October list left open are closed here (the owner's list of 23 October 2026,
diff --git a/unity/Assets/Tests/EditMode/KeyboardTurnTests.cs b/unity/Assets/Tests/EditMode/KeyboardTurnTests.cs
index c2ed17dcf..11c813b5b 100644
--- a/unity/Assets/Tests/EditMode/KeyboardTurnTests.cs
+++ b/unity/Assets/Tests/EditMode/KeyboardTurnTests.cs
@@ -186,7 +186,8 @@ public class KeyboardTurnTests
/// <summary>The done-when's turn, keys only: answer the opening turn's two cards; open Budget, raise a line with its + and submit;
/// open the Cabinet, select a seat, appoint a candidate; close it with Escape; Tab to the map stop over Tel Aviv, Enter
- /// to pick it, Tab to Train halutzim in its city panel and press it; Tab to End Turn and end the turn. Each order is
+ /// to pick it, Tab to Train halutzim in its city panel and press it; Tab to the map stop over Golani, Enter to select it,
+ /// pan to a lit hex, Enter to move it; Tab to End Turn and end the turn. Each order is
/// queued, and a press that rebuilds what it is part of keeps the focus there. The opening turn's attention (4) pays for
/// two of these orders; the test raises it, since what is checked is the keyboard's path, not the attention rule.</summary>
[UnityTest]
@@ -248,6 +249,27 @@ public class KeyboardTurnTests
Assert.IsTrue(Bridge.Queued.OfType<Train>().Any(t => t.Track == "halutz"), "the training order is queued");
Assert.AreEqual("city-train-halutz", FocusedName, "the rebuilt panel gives the focus back to Train halutzim");
+ // A unit order (#41, owner 1 Nov 2026): the map stop over Golani, Enter selects it and opens its Move pick (Civ,
+ // owner 25 Oct 2026); the stop over a lit hex, Enter moves it there. KeyboardOrdersTests covers Attack and the
+ // confirm step onto a city or a friendly unit.
+ var layer = Object.FindFirstObjectByType<Statecraft.Game.Map.Units.UnitLayer>();
+ var golani = layer.Tokens.Single(t => t.Token.Unit.Id == "golani");
+ var unit = UnitCard.SimUnit(Bridge.Content, Bridge.State, golani.Token.Unit)!.Value;
+ yield return TabTo("map-focus");
+ LookAt(golani.Q, golani.R);
+ yield return Frames(3);
+ yield return Enter();
+ Assert.AreEqual("golani", layer.Selected, "Enter on the map stop over Golani selects it");
+ var reach = Movement.Reachable(Bridge.Content, Bridge.State, unit).Keys.ToList();
+ Assert.IsNotEmpty(reach, "precondition: Golani can move");
+ var (q, r) = reach.Last();
+ LookAt(q, r);
+ yield return Frames(3);
+ yield return Enter();
+ var move = Bridge.Session.Committed.OfType<Move>().Single();
+ Assert.AreEqual((unit, q, r), (move.Unit, move.Q, move.R), "Enter on a lit hex moves Golani");
+ Assert.AreEqual("map-focus", FocusedName, "the focus stays on the map stop");
+
// End the turn.
yield return TabTo("end-turn");
var turn = Bridge.State.Turn;
@@ -280,11 +302,16 @@ public class KeyboardTurnTests
/// <summary>Moves the camera's look-at point onto Tel Aviv's hex, on the ground, as a pan would (MapFocusTests).</summary>
static void LookAtTelAviv()
+ {
+ var tlv = MapFocusTests.Inputs.Content.SettlementHexes.Single(s => s.Id == "tel_aviv");
+ LookAt(tlv.Q, tlv.R);
+ }
+
+ /// <summary>Moves the camera's look-at point onto hex (q, r), on the ground, as a pan with the arrows would.</summary>
+ static void LookAt(int q, int r)
{
var map = Object.FindFirstObjectByType<MapScene>();
- var c = MapFocusTests.Inputs.Content;
- var tlv = c.SettlementHexes.Single(s => s.Id == "tel_aviv");
- var hex = c.HexAt(tlv.Q, tlv.R)!;
+ var hex = MapFocusTests.Inputs.Content.HexAt(q, r)!;
var ground = map.Frame.ToWorld(hex.Lon, hex.Lat, 0);
ground.y = map.Terrain.SampleHeight(ground) + map.Terrain.transform.position.y;
var rig = Camera.main.GetComponent<CameraRig>();