73 lines
1.8 KiB
C#
73 lines
1.8 KiB
C#
using AcDream.App.Studio;
|
|
using AcDream.App.UI;
|
|
|
|
namespace AcDream.App.Tests.Studio;
|
|
|
|
public class StudioWindowTests
|
|
{
|
|
[Fact]
|
|
public void FrameCloseGate_defersCloseUntilFrameCompletion()
|
|
{
|
|
var gate = new StudioFrameCloseGate();
|
|
int closeCount = 0;
|
|
|
|
gate.Request();
|
|
|
|
Assert.True(gate.IsRequested);
|
|
Assert.Equal(0, closeCount);
|
|
|
|
gate.CompleteFrame(() => closeCount++);
|
|
gate.CompleteFrame(() => closeCount++);
|
|
|
|
Assert.False(gate.IsRequested);
|
|
Assert.Equal(1, closeCount);
|
|
}
|
|
|
|
[Fact]
|
|
public void ParseMockup_doesNotDefaultToSinglePanelLayout()
|
|
{
|
|
var opts = StudioOptions.Parse(new[] { @"C:\fake-dats", "--mockup" });
|
|
|
|
Assert.True(opts.Mockup);
|
|
Assert.Null(opts.LayoutId);
|
|
Assert.Null(opts.DumpSlug);
|
|
Assert.Null(opts.MarkupPath);
|
|
}
|
|
|
|
[Fact]
|
|
public void ParseCapabilitySmokeOptions()
|
|
{
|
|
var opts = StudioOptions.Parse(
|
|
[
|
|
@"C:\fake-dats",
|
|
"--mockup",
|
|
"--capability-report",
|
|
"report.json",
|
|
"--audio-smoke",
|
|
]);
|
|
|
|
Assert.Equal("report.json", opts.CapabilityReportPath);
|
|
Assert.True(opts.AudioSmoke);
|
|
}
|
|
|
|
[Fact]
|
|
public void NormalizeSinglePanelRoot_movesDatPanelToCanvasOrigin()
|
|
{
|
|
var root = new UiPanel
|
|
{
|
|
Left = 500f,
|
|
Top = 138f,
|
|
Width = 300f,
|
|
Height = 362f,
|
|
Anchors = AnchorEdges.Left | AnchorEdges.Top | AnchorEdges.Right,
|
|
};
|
|
|
|
StudioWindow.NormalizeSinglePanelRoot(root);
|
|
|
|
Assert.Equal(0f, root.Left);
|
|
Assert.Equal(0f, root.Top);
|
|
Assert.Equal(300f, root.Width);
|
|
Assert.Equal(362f, root.Height);
|
|
Assert.Equal(AnchorEdges.None, root.Anchors);
|
|
}
|
|
}
|