Fix menu cursor auto-move
This commit is contained in:
@@ -47,6 +47,25 @@ public class InputBindingTests
|
||||
Assert.NotEqual(0, vm.InputBindings.JoystickButtonActionMask(3) & (1 << 4));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SetCursorVirtualUpdatesVmCoordinatesAndRequestsAHostWarp()
|
||||
{
|
||||
var script = ScriptAssembler.Assemble(Table, "CURSOR_WARP", new List<(int, Operand[])>
|
||||
{
|
||||
(0x10a, new[] { I(321), I(234) }),
|
||||
(0x109, new[] { G(0x710), G(0x711) }),
|
||||
(0x2, Array.Empty<Operand>()),
|
||||
}, Array.Empty<string>());
|
||||
var host = new RecordingHost();
|
||||
var vm = new VirtualMachine(script, Table, host);
|
||||
|
||||
vm.Run();
|
||||
|
||||
Assert.Equal((321, 234), Assert.Single(host.CursorWarps));
|
||||
Assert.Equal(321, vm.Globals.GetValueOrDefault(0x710));
|
||||
Assert.Equal(234, vm.Globals.GetValueOrDefault(0x711));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", "Workspace")]
|
||||
public void System4BootstrapReplaysAllSixteenInputConfigurationCalls()
|
||||
|
||||
@@ -76,6 +76,7 @@ internal class RecordingHost : IHost
|
||||
public readonly List<FullwidthTextEditRequest> FullwidthTextEdits = new();
|
||||
public System.Func<FullwidthTextEditRequest, FullwidthTextEditResult>? OnFullwidthTextEdit;
|
||||
public readonly List<long> CursorResources = new();
|
||||
public readonly List<(int X, int Y)> CursorWarps = new();
|
||||
public readonly List<bool> AdvPagePresentationSuspended = new();
|
||||
public readonly List<(AdvLiveTextRun Run, int GlyphDelayMilliseconds)> LiveTextRuns = new();
|
||||
public readonly Dictionary<int, RgbaImage> SurfacePixels = new();
|
||||
@@ -176,6 +177,7 @@ internal class RecordingHost : IHost
|
||||
public virtual long InputClockMilliseconds => Environment.TickCount64;
|
||||
public void SetCursorResource(long resourceId) => CursorResources.Add(resourceId);
|
||||
public void ClearCursorResource() => CursorClearCount++;
|
||||
public void WarpCursor(int virtualX, int virtualY) => CursorWarps.Add((virtualX, virtualY));
|
||||
public virtual void Sleep(long duration) => SleptDurations.Add(duration);
|
||||
public virtual void WaitForTimedCallbackDeadline(long duration)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user