procedure TGUITestCase.CheckTabTo(Control: TControl; Msg :string = '');
var
i :Integer;
begin
Assert(GUI <> nil, 'GUI variable not set');
Check(Control is TWinControl,
Format('%s: Expected a TWinControl, but %s is a %s',
[msg, Control.Name, Control.ClassName])
);
Check(TWinControl(Control).CanFocus,
Format('%s: Control %s:%s cannot focus', [msg, Control.Name, Control.ClassName])
);
for i := 1 to GUI.ComponentCount do
begin
if GetFocused = Control then
EXIT;
Tab;
end;
Fail(Format('%s: Could not Tab to control "%s"', [Msg, Control.Name]), CallerAddr);
End; |