Ctrl-a key stroke is not simulated correctly

WindowTester allows you to easily create and run unit tests for every GUI they build. It can also be used to generate system level tests.

Moderators: gnebling, Eric Clayberg, Dan Rubel, keertip, Phil Quitslund

Ctrl-a key stroke is not simulated correctly

Postby keico » Tue Feb 01, 2011 9:01 am

Hi all,

I am trying to simulate the CTRL-A (Ctrl-a) key stroke in my test case by invoking the keyClick(int modifierMask, char c) method from the com.windowtester.runtime.IUIContext interface. Please refer to attached codes for more details. This key event does NOT get simulated correctly while the test is running. Does anyone ever encounter this issue and know how to fix it?
Attachments
SpinnerTest3.java
JUnit test
(817 Bytes) Downloaded 14 times
NumberSpinner.java
Main class
(907 Bytes) Downloaded 13 times
keico
 
Posts: 21
Joined: Wed Jan 05, 2011 7:37 am

Re: Ctrl-a key stroke is not simulated correctly

Postby gnebling » Mon Feb 07, 2011 11:33 am

What is it you're trying to accomplish? In your example, if you need to select the text and delete it, you can do something like this:
Code: Select all
ui.keyClick(WT.CTRL);
ui.keyClick(WT.END);
ui.keyClick(WT.DEL);   
gnebling
Moderator
 
Posts: 243
Joined: Tue Aug 22, 2006 7:49 am

Re: Ctrl-a key stroke is not simulated correctly

Postby keico » Wed Feb 09, 2011 12:00 pm

I use the example code to do some experiment in order to learn how the tool simulates the key strokes. To answer your question, yes I wanted to select the text and delete it; and your provided solution does solve the issue here. However, I have an swing app that supports several hot keys such as Ctrl-A, Ctrl-F, Ctrl-Shift-T, F1, ... I need to simulate these key in my test code. I have tried using something like the these but they did NOT work:
Code: Select all
ui.keyClick(WT.CTRL);
ui.keyClick('A');


Code: Select all
ui.keyClick(WT.CTRL);
ui.keyClick('F');


I was wondering if you could show us how to simulate these hot keys in the test code. I really appreciate it!
Thanks!
-keico
keico
 
Posts: 21
Joined: Wed Jan 05, 2011 7:37 am

Re: Ctrl-a key stroke is not simulated correctly

Postby gnebling » Tue Feb 15, 2011 10:11 am

Unfortunately, those key combinations are not supported. If it doesn't work, it's probably not supported :)
gnebling
Moderator
 
Posts: 243
Joined: Tue Aug 22, 2006 7:49 am

Re: Ctrl-a key stroke is not simulated correctly

Postby fredg » Thu May 12, 2011 9:18 am

We use ui.keyClick(WT.CTRL, 'a'); to simulate CTRL-A in Window Tester Pro 6.0 in Eclipse SWT tests without a problem.
fredg
 
Posts: 7
Joined: Fri Nov 19, 2010 3:35 am


Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest

cron