Implement ADV text publication service
This commit is contained in:
@@ -53,4 +53,24 @@ public class AdvTextOpsTests
|
||||
Assert.Equal(new Age.Engine.Hosting.AdvWaitIndicatorConfig(1, 385, 140, 12, 0, 0, 30, 27, 12, 48),
|
||||
Assert.Single(host.WaitIndicators));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WaitIndicatorToggleAndTextLayoutPublicationReachHost()
|
||||
{
|
||||
var table = OpcodeTableJson.Load(Paths.OpcodesJson);
|
||||
var script = ScriptAssembler.Assemble(table, "WAITMARK_SERVICE",
|
||||
new List<(int, Operand[])>
|
||||
{
|
||||
(0x1ce, new[] { new Operand(0, 1) }),
|
||||
(0x20a, new[] { new Operand(0, 4) }),
|
||||
(0x1ce, new[] { new Operand(0, 0) }),
|
||||
(0x2, Array.Empty<Operand>()),
|
||||
}, Array.Empty<string>());
|
||||
var host = new RecordingHost();
|
||||
|
||||
new VirtualMachine(script, table, host).Run();
|
||||
|
||||
Assert.Equal(new[] { true, false }, host.WaitIndicatorEnabledChanges);
|
||||
Assert.Equal(4, Assert.Single(host.PublishedAdvTextLayouts));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,6 +295,8 @@ public class HistoryInteractionOpsTests
|
||||
Assert.Equal(1, host.Waits); // the enclosing ADV page was never released or re-entered
|
||||
Assert.Equal(1, host.HistoryPresentationEnds);
|
||||
Assert.Empty(host.ActiveHistoryRenders);
|
||||
Assert.Contains(false, host.WaitIndicatorEnabledChanges);
|
||||
Assert.Contains(1, host.PublishedAdvTextLayouts);
|
||||
|
||||
var historyButtons = host.FirstHistoryFrame
|
||||
.Where(render => render.Handle >= 0xd2fa && render.Handle <= 0xd300)
|
||||
|
||||
@@ -102,5 +102,6 @@ public class HistoryPresentationOpsTests
|
||||
Assert.All(host.HistoryRenders.Where(render => render.Text.Length > 0),
|
||||
render => Assert.Equal(8, render.Style.LineSpacing));
|
||||
Assert.Contains(host.PresentedRanges, range => range == (0L, 60000L));
|
||||
Assert.Contains(false, host.WaitIndicatorEnabledChanges);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ internal class RecordingHost : IHost
|
||||
public readonly List<SurfaceRectFill> SurfaceFills = new();
|
||||
public readonly List<(long First, long Count)> PresentedRanges = new();
|
||||
public readonly List<AdvWaitIndicatorConfig> WaitIndicators = new();
|
||||
public readonly List<bool> WaitIndicatorEnabledChanges = new();
|
||||
public readonly List<int> PublishedAdvTextLayouts = new();
|
||||
public readonly List<long> SleptDurations = new();
|
||||
public readonly List<(long Resource, int Channel)> SfxLoads = new();
|
||||
public readonly List<long> Voices = new();
|
||||
@@ -62,6 +64,8 @@ internal class RecordingHost : IHost
|
||||
public void PresentObjectRange(GfxState gfx, long firstHandle, long count)
|
||||
=> PresentedRanges.Add((firstHandle, count));
|
||||
public void ConfigureAdvWaitIndicator(AdvWaitIndicatorConfig config) => WaitIndicators.Add(config);
|
||||
public void SetAdvWaitIndicatorEnabled(bool enabled) => WaitIndicatorEnabledChanges.Add(enabled);
|
||||
public void PublishAdvTextLayout(int layoutSlot) => PublishedAdvTextLayouts.Add(layoutSlot);
|
||||
public void SetAdvPagePresentationSuspended(bool suspended)
|
||||
=> AdvPagePresentationSuspended.Add(suspended);
|
||||
public void WaitForInput() => Waits++;
|
||||
|
||||
Reference in New Issue
Block a user