Implement core diagnostic memory layer, execution helpers, and high-level facade slices
Implemented: - Core: UTF-16 ReadString boundary/alignment fix, target bitness and process id on MemoryBase - function interception: PatchManager, DetourManager, InstructionAnalyzer, MainThreadDispatcher - Execution: BackgroundTaskExecutor, InProcessInvoker - High-level: Magic facade, RemotePointer, async wrappers - Discovery/external code loading/Window groundwork (PEB/TEB, pattern scanning, raw allocations, DLL external code loading, window/input) Tests: 180 passing, 4 integration/interactive tests skipped.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using System.Diagnostics;
|
||||
using WhiteMagic.Input;
|
||||
using WhiteMagic.Windows;
|
||||
using Xunit;
|
||||
|
||||
namespace WhiteMagicTest.Input;
|
||||
|
||||
public sealed class InputSimulatorTests
|
||||
{
|
||||
[Fact(Skip = "Interactive input test - requires a visible window")]
|
||||
public void SendKeys_to_current_window_does_not_throw()
|
||||
{
|
||||
using var process = Process.GetCurrentProcess();
|
||||
IntPtr handle = process.MainWindowHandle != IntPtr.Zero
|
||||
? process.MainWindowHandle
|
||||
: WindowFactory.GetWindows().FirstOrDefault()?.Handle ?? IntPtr.Zero;
|
||||
|
||||
if (handle == IntPtr.Zero)
|
||||
return;
|
||||
|
||||
var simulator = new InputSimulator();
|
||||
bool result = simulator.SendKeys(handle, "ab");
|
||||
Assert.True(result);
|
||||
}
|
||||
|
||||
[Fact(Skip = "Interactive input test - requires a visible window")]
|
||||
public void SendMouseClick_to_current_window_does_not_throw()
|
||||
{
|
||||
using var process = Process.GetCurrentProcess();
|
||||
IntPtr handle = process.MainWindowHandle != IntPtr.Zero
|
||||
? process.MainWindowHandle
|
||||
: WindowFactory.GetWindows().FirstOrDefault()?.Handle ?? IntPtr.Zero;
|
||||
|
||||
if (handle == IntPtr.Zero)
|
||||
return;
|
||||
|
||||
var simulator = new InputSimulator();
|
||||
bool result = simulator.SendMouseClick(handle, 10, 20, MouseButton.Left);
|
||||
Assert.True(result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user