Automated UI testing question
- From: Torsten <tma012008@xxxxxxxx>
- Date: Tue, 03 Jul 2012 22:58:24 +0200
I have an application whose user interface is a single canvas called .ui with some items as buttons, e.g. btn_1
I need a test routine that simulates mouse clicks on those buttons.
Here is my approach:
The following bindings are defined for item btn_1:
.ui bind btn_1 <ButtonPress-1> "key_press b1"
.ui bind btn_1 <ButtonRelease-1> "key_release b1"
This is the click routine:
# get top right edge of .ui on screen
set uix [winfo rootx .ui]
set uiy [winfo rooty .ui]
# compute center ot item btn_1 in screen coords
lassign [.ui bbox btn_1] bx0 by0 bx1 by1
set mx [expr int($uix + $bx0 + ($bx1-$bx0)/2.0)]
set my [expr int($uiy + $by0 + ($by1-$by0)/2.0)]
# simulate mouse click
focus .ui
event generate .ui <ButtonPress-1> -x $mx -y $my -when tail
event generate .ui <ButtonRelease-1> -x $mx -y $my -when tail
When I run the code nothing happens; key_press/key_release are not called.
What am I doing wrong?
Torsten
.
- Follow-Ups:
- Re: Automated UI testing question
- From: ghoest
- Re: Automated UI testing question
- Prev by Date: Re: Tcl/Tk for Android?
- Next by Date: Re: Automated UI testing question
- Previous by thread: Tcl/C++ ; send arguments to .dll
- Next by thread: Re: Automated UI testing question
- Index(es):