Schildplatten-Golem aus Icon, Phase-4-Bild und Kohlenbeißer-Konzept als Stilvorlage, 68 Credits, Lane-Fassung inklusive. FigureViewsTests erkennt Grund- und Aufwertungstruppen selbst. Stresstest 35 Schlackenwachten: Mid 161,9 -> 148,5 fps, Karte unverändert 124,5. Tests grün, Fingerabdrücke unverändert. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
104 lines
4.9 KiB
C#
104 lines
4.9 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Linq;
|
|
using Luneraria.Core;
|
|
using Luneraria.View;
|
|
using NUnit.Framework;
|
|
using UnityEngine;
|
|
using UnityEngine.TestTools;
|
|
|
|
namespace Luneraria.UI.Tests
|
|
{
|
|
/// <summary>
|
|
/// U5.5 pilot pictures of one figure in the real game (the Meshy Kohlenbeißer against the
|
|
/// Phase-4 model it replaces): the human seat plays the Glutpakt, buys the starter army and
|
|
/// four Kohlenbeißer (g01) in round 3, and the camera shows them in the planning formation,
|
|
/// in the HUD portrait and in the fight on the own lane, close (zoom 12) and at the benchmark's
|
|
/// lane distance (zoom 22). Like HudViewsTests, commands go straight to the match followed by
|
|
/// the preview rebuild. A capture tool, not part of the suite:
|
|
/// -testFilter "Luneraria.UI.Tests.FigureViewsTests"; LUNE_EVIDENCE names the folder below
|
|
/// docs/port/screenshots (default u5.5/spiel). LUNE_FIGURE names another Glutpakt troop
|
|
/// (default g01); an upgraded troop (g02, g04, ...) is bought as its base and upgraded.
|
|
/// </summary>
|
|
[Explicit("Bildwerkzeug: nur gezielt per -testFilter")]
|
|
public sealed class FigureViewsTests
|
|
{
|
|
/// <summary>The human seat 1 plays the Glutpakt, as do the bots of seats 2 and 5.</summary>
|
|
static readonly string[] Bunds = { "wurzelbund", "glutpakt", "glutpakt", "wurzelbund", "wurzelbund", "glutpakt" };
|
|
|
|
string _folder;
|
|
|
|
IEnumerator Shot(HudSession s, string label)
|
|
{
|
|
yield return s.Shot(_folder + label + ".png");
|
|
}
|
|
|
|
static void Send(HudSession s, Command command)
|
|
{
|
|
CommandResult result = s.Match.Submit(HudSession.Human, command);
|
|
Assert.IsTrue(result.Ok, command.Type + ": " + result.Message);
|
|
s.Game.RebuildPreview();
|
|
s.Sync();
|
|
}
|
|
|
|
/// <summary>The own Kohlenbeißer on the field: the one nearest to the enemy (the front of the fight).</summary>
|
|
static LuneUnit Front(HudSession s, string figure)
|
|
{
|
|
int team = s.Me.Team;
|
|
return s.Match.Combat.Units.Where(u => u.Alive && u.Team == team && u.Def.Id == figure)
|
|
.OrderByDescending(u => u.Progress).FirstOrDefault();
|
|
}
|
|
|
|
[UnityTest, Timeout(900000)]
|
|
public IEnumerator Kohlenbeisser()
|
|
{
|
|
string evidence = Environment.GetEnvironmentVariable("LUNE_EVIDENCE");
|
|
_folder = "docs/port/screenshots/" + (string.IsNullOrEmpty(evidence) ? "u5.5/spiel" : evidence) + "/";
|
|
string figure = Environment.GetEnvironmentVariable("LUNE_FIGURE");
|
|
if (string.IsNullOrEmpty(figure))
|
|
figure = "g01";
|
|
// An upgraded troop has a base troop whose upgrade it is.
|
|
string baseId = ContentData.Units.Keys.FirstOrDefault(id => DataCatalog.UpgradeOf(id) == figure);
|
|
bool upgrade = baseId != null;
|
|
var s = new HudSession();
|
|
yield return s.Open(1920, 1080, seed: 4, bunds: Bunds);
|
|
s.Match.RoundNumber = 3;
|
|
s.Me.Draft.Gold = upgrade ? 2000 : 900;
|
|
yield return s.Starter();
|
|
s.Leave();
|
|
for (int i = 0; i < 4; i++)
|
|
Send(s, Command.Buy(upgrade ? baseId : figure, s.Me.Lane));
|
|
if (upgrade)
|
|
{
|
|
foreach (RosterEntry entry in s.Me.Draft.Roster.Where(e => e.TypeId == baseId).ToList())
|
|
Send(s, Command.Upgrade(entry.Uid));
|
|
}
|
|
yield return new WaitForSecondsRealtime(.4f);
|
|
RosterEntry first = s.Me.Draft.Roster.First(e => e.TypeId == figure);
|
|
// The planning preview stands the army in its formation on the own lane.
|
|
LuneUnit waiting = s.View.Preview?.Units.FirstOrDefault(u => u.Team == s.Me.Team && u.Def.Id == figure);
|
|
Assert.IsNotNull(waiting, "Kohlenbeißer in the planning preview");
|
|
s.Rig.LookAt(waiting.Position, 12f, true);
|
|
yield return new WaitForSecondsRealtime(.5f);
|
|
yield return Shot(s, "01-aufstellung-nah");
|
|
s.Hud.SelectUnit(first.Uid);
|
|
yield return new WaitForSecondsRealtime(.4f);
|
|
yield return Shot(s, "02-portraet");
|
|
s.Hud.ClearSelection();
|
|
s.Game.Key(KeyCode.Space);
|
|
yield return HudSession.Frames(1);
|
|
Assert.AreEqual(LuneMatchRunner.Stage.Combat, s.Runner.Current, "combat of round 3");
|
|
yield return s.Fight(7.0);
|
|
s.Driver.Paused = true;
|
|
LuneUnit front = Front(s, figure);
|
|
Assert.IsNotNull(front, "a Kohlenbeißer on the field");
|
|
s.Rig.LookAt(front.Position, 12f, true);
|
|
yield return new WaitForSecondsRealtime(.5f);
|
|
yield return Shot(s, "03-kampf-nah");
|
|
s.Rig.LookAt(front.Position, 22f, true);
|
|
yield return new WaitForSecondsRealtime(.5f);
|
|
yield return Shot(s, "04-kampf-lane");
|
|
s.Close();
|
|
}
|
|
}
|
|
}
|