FakeMainLoop.cs 796 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. 
  2. namespace Terminal.Gui.Drivers;
  3. internal class FakeMainLoop : IMainLoopDriver
  4. {
  5. public Action<ConsoleKeyInfo> MockKeyPressed;
  6. public FakeMainLoop (IConsoleDriver consoleDriver = null)
  7. {
  8. // No implementation needed for FakeMainLoop
  9. }
  10. public void Setup (MainLoop mainLoop)
  11. {
  12. // No implementation needed for FakeMainLoop
  13. }
  14. public void Wakeup ()
  15. {
  16. // No implementation needed for FakeMainLoop
  17. }
  18. public bool EventsPending ()
  19. {
  20. // Always return true for FakeMainLoop
  21. return true;
  22. }
  23. public void Iteration ()
  24. {
  25. if (FakeConsole.MockKeyPresses.Count > 0)
  26. {
  27. MockKeyPressed?.Invoke (FakeConsole.MockKeyPresses.Pop ());
  28. }
  29. }
  30. public void TearDown () { }
  31. }