Page 1 of 1

simulate user click?

Posted: Mon Jul 23, 2007 22:31
by phoenixy
I want to make an automated test for game.
What i want to do is, to simulate mouse click on some windows.

Of course, I can generate mouse events at Windows API level, but then it's hard to control which window(CEGUI) to click.

Is there any way to specify a CEGUI window and generate mouse click event?

CEGUI::Window::OnMouse*** events are all protected so I can't directly call them.

Posted: Tue Jul 24, 2007 07:38
by scriptkid
Hi,

automated testing = interesting stuff :)

What you could do is fake a mouse move with the 'injectMousePosition()' call. As you might know, cegui doesn't listen to input itself so this is not hacky or something. It always works like this.

Let's say you want to 'click' your Help button. You could lookup the window, get its screen area (getUnclippedRect()) IIRC, set the mouse at the center and call 'InjecMouseButtonDown()'. All input calls can be found here:
http://www.cegui.org.uk/wiki/index.php/ ... ing_Inputs

HTH.

Posted: Tue Jul 24, 2007 18:25
by phoenixy
Thanks a lot!
It was really helpful :)