procedure TGUITestCase.ClickLeftMouseButtonOn(Control: TControl);
var
P :TSmallPoint;
begin
Assert(Control <> nil, 'No control');
Control := FindParentWinControl(Control);
if Control <> nil then
begin
{:@ todo consider if this method should have X,Y parameters.
@todo This doesn't work if the original control is not a TWinControl and is not in
the middle of its parent. }
P := SmallPoint(Control.Width div 2, Control.Height div 2);
PostMessage(TWinControl(Control).Handle, WM_LBUTTONDOWN, 0, Longint(P));
PostMessage(TWinControl(Control).Handle, WM_LBUTTONUP, 0, Longint(P));
Sleep(ActionDelay);
end;
Application.ProcessMessages;
End; |