Fix smoke gaps: recorder target + VK translation, player enum + null guard (#11)
This commit is contained in:
@@ -9,6 +9,9 @@ public enum StepKind
|
||||
Wait,
|
||||
Checkpoint,
|
||||
Save,
|
||||
// Added for issue #11 — recorder emits these kinds from the smoke test.
|
||||
Wheel,
|
||||
Focus,
|
||||
}
|
||||
|
||||
public sealed class Step
|
||||
|
||||
@@ -68,6 +68,15 @@ public sealed class PlayerEngine
|
||||
}
|
||||
point = ComputeScreenPoint(element.Value.Bounds, step.Target.Offset);
|
||||
}
|
||||
else if (StepRequiresTarget(step.Kind))
|
||||
{
|
||||
// Issue #11: recorder may emit Click/Drag/Type/Focus steps with
|
||||
// null target. Never click/drag/type at (0,0) on the desktop —
|
||||
// skip with a warning instead.
|
||||
Console.WriteLine(
|
||||
$"[player] warn: skipping step {index} kind={step.Kind} — target is null (issue #11)");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (step.Kind)
|
||||
{
|
||||
@@ -101,9 +110,30 @@ public sealed class PlayerEngine
|
||||
case StepKind.Save:
|
||||
host.Hotkey(step.Value ?? "ctrl+s");
|
||||
break;
|
||||
case StepKind.Wheel:
|
||||
// Issue #11: wheel replay not yet implemented — log & no-op so
|
||||
// scenarios that contain wheel events don't crash the engine.
|
||||
Console.WriteLine(
|
||||
$"[player] info: wheel step {index} value={step.Value} — no-op (issue #11)");
|
||||
break;
|
||||
case StepKind.Focus:
|
||||
// Issue #11: focus replay deferred. IPlayerHost has no Focus()
|
||||
// method yet; we log and continue.
|
||||
Console.WriteLine(
|
||||
$"[player] info: focus step {index} — no-op (issue #11)");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool StepRequiresTarget(StepKind kind) => kind switch
|
||||
{
|
||||
StepKind.Click => true,
|
||||
StepKind.Drag => true,
|
||||
StepKind.Type => true,
|
||||
StepKind.Focus => true,
|
||||
_ => false,
|
||||
};
|
||||
|
||||
public static ScreenPoint ComputeScreenPoint(ElementBounds bounds, double[] offset)
|
||||
{
|
||||
var ox = offset.Length > 0 ? offset[0] : 0.5;
|
||||
|
||||
Reference in New Issue
Block a user