using Annulus; using Blacklight.Core; using Blacklight.Core.Cameras; using Blacklight.Core.Keyboard; using Amphora; using Glass; using System.Collections.Generic; namespace Foundations.UnitTests { public class RecordingWindow : NullWindowHandle { public List Calls { get; } = new List(); public override void FrameReset() { Calls.Add("FrameReset"); } public override void SubmitDrawCalls() { Calls.Add("SubmitDrawCalls"); } } public class FakePointerSource : IPointerSource { public PointerInput? PointerState { get; set; } } public class FakePointerLock : IPointerLock { public bool PointerLocked { get; set; } public event System.Action PointerLockLost { add { } remove { } } } public class FakeTextSource : ITextSource { public ITextConsumer TextConsumer { get; set; } public bool AcceptsComposition { get; set; } public Rect? CaretBounds { get; set; } public void FinishComposition() { } } public class FakeWindowFocus : IWindowFocus { public event System.Action FocusReturned; public void Return() { FocusReturned?.Invoke(); } } public class FakeClipboard : IHostClipboard { public bool TryOpenText(out IHostClipboardText text) { text = null; return false; } public bool SetText(IChunkedText text) { return false; } } public class RecordingCursorSurface : ICursorSurface { public int Set { get; private set; } public int Cleared { get; private set; } public bool CursorVisible { get; set; } public bool TrySetCursor(CursorImage cursor) { ++Set; return true; } public void ClearCursor() { ++Cleared; } } public class FakeHost { public RecordingWindow Window { get; } = new RecordingWindow(); public InputRouter Router { get; } = new InputRouter(); public FakePointerSource Pointer { get; } = new FakePointerSource(); public FakePointerLock PointerLock { get; } = new FakePointerLock(); public FakeTextSource Text { get; } = new FakeTextSource(); public FakeWindowFocus WindowFocus { get; } = new FakeWindowFocus(); public FakeClipboard Clipboard { get; } = new FakeClipboard(); public InMemoryFileSystem Files { get; } = new InMemoryFileSystem(); public HostServices Services() { return new HostServices(Window, Router, Pointer, PointerLock, Text, WindowFocus, Clipboard, Files); } } }