Files
Pal3.Unity/Assets/Tests/Editor/CombatCameraConfigFileReaderTests.cs
Jiaqi Liu 5d0f564a00 Add a standalone battle editor and battle system for PAL3 and PAL3A (#99)
* build: migrate C# formatting and add offscreen editor test support

Host IMGUI tests on a detached panel without creating a native editor window.

* feat(core): decode native battle records, geometry and animation metadata

Read the two game variants’ battle tables and model data, with binary-reader and original-resource coverage.

* feat(battle): implement deterministic combat rules and action settlement

Implement actors, inventory, formation, action timing, status interruption, AI, stage ownership and deterministic replay. Keep the domain and its regression suite independent of Unity.

* feat(battle): project native HUD state and input commands

Add the presentation assembly and tests for command routing, lineup selection, floating numbers and stage messages.

* feat(rendering): add battle lighting, actor appearance and native shadows

Support baked and toon lighting, actor and weapon rendering, display refresh rate and resource ownership.

* feat(effects): drive battle effects through shared resource previews

Bind battle control nodes to action owners. Share preview lighting, geometry and effect resources with the existing Unity editors.

* refactor(game): isolate story battle targeting and actor lifetimes

Preserve scene ownership, bound story battle targeting and stop debug attacks when their actor leaves the scene.

* feat(editor): compile original game data into battle scenarios

Build per-variant animation and ability catalogs, encounter music, scene lighting profiles, random parties, equipment and test inventory from the original resources.

* feat(editor): play battle sessions with animated previews and synced media

Drive the preview scene, camera, effects, hit feedback, result choreography, music and movies from simulation snapshots and events.

* feat(editor): add the battle workbench, native HUD and input controls

Expose scenario authoring, replay, diagnostics, responsive command menus and mouse, touch and gamepad targeting. Include the editor workflow and HUD integration tests.
2026-11-21 22:28:47 +08:00

70 lines
2.8 KiB
C#

// ------------------------------------------------------------------------
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
namespace Pal3.Core.Tests
{
using System;
using System.Globalization;
using System.Text;
using Core.DataReader.Ini;
using NUnit.Framework;
public sealed class CombatCameraConfigFileReaderTests
{
private const string Camera = "[DefaultCam0]\nx=-70.413155\ny=.125\nz=140.5\nyaw=-3.171740\npitch=-.500003\nroll=1.25e-2\n";
private static CombatCameraConfig Read(string text) => new CombatCameraConfigFileReader().Read(Encoding.ASCII.GetBytes(text), 936).DefaultCamConfigs[0];
[TestCase("en-US")]
[TestCase("fr-FR")]
[TestCase("de-DE")]
public void NativeCameraCoordinatesAndAnglesIgnoreTheEditorsCulture(string culture)
{
CultureInfo previous = CultureInfo.CurrentCulture;
try
{
CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo(culture);
CombatCameraConfig camera = Read(Camera);
Assert.That(camera.GameBoxPositionX, Is.EqualTo(-70.413155f));
Assert.That(camera.GameBoxPositionY, Is.EqualTo(.125f));
Assert.That(camera.GameBoxPositionZ, Is.EqualTo(140.5f));
Assert.That(camera.Yaw, Is.EqualTo(-3.171740f));
Assert.That(camera.Pitch, Is.EqualTo(-.500003f));
Assert.That(camera.Roll, Is.EqualTo(.0125f));
}
finally
{
CultureInfo.CurrentCulture = previous;
}
}
[TestCase("en-US")]
[TestCase("fr-FR")]
[TestCase("de-DE")]
public void NativeCameraNumbersNeverInterpretCommasAsThousandsSeparators(string culture)
{
CultureInfo previous = CultureInfo.CurrentCulture;
try
{
CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo(culture);
const string grouped = "[DefaultCam0]\nx=-70,413155\ny=1\nz=2\nyaw=-3\npitch=-1\nroll=0\n";
Assert.Throws<FormatException>(() => Read(grouped));
}
finally
{
CultureInfo.CurrentCulture = previous;
}
}
[Test]
public void CameraValuesAllowNativeInlineCommentsWithoutChangingTheirValue()
{
CombatCameraConfig camera = Read(Camera.Replace("-70.413155", "-70.413155 ; position").Replace("-3.171740", "-3.171740 ; angle"));
Assert.That(camera.GameBoxPositionX, Is.EqualTo(-70.413155f));
Assert.That(camera.Yaw, Is.EqualTo(-3.171740f));
}
}
}