Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4504963
Votes 0
Synopsis JCK1.3a, interactive: Robot's mouseMove behaves incorrectly under Windows
Category java:classes_awt
Reported Against 1.3.1_01a-ea , merlin-beta3
Release Fixed 1.4(merlin-rc1)
State 10-Fix Delivered, Verified, bug
Priority: 1-Very High
Related Bugs 4511093
Submit Date 20-SEP-2001
Description
JDK            : JDK1.3.1_01-ea
JCK            : JCK1.3a
Platform[s]    : Windows XP, Windows XP + IE 6.0
switch/Mode    : -client -Xmixed -Xfuture
JCK test owner : http://javaweb.eng/jck/usr/owners.jto
Failing Test   : api/java_awt/interactive/RobotTests.html#RobotTests [RobotTest0003]

This test fails under Windows XP both under plugin and regular JCK run.
The test passes under Windows 2000.

Test source location:
=====================
/net/jdk/export/disk8/local.java/jck1.3a/JCK-runtime-13a/tests/api/java_awt/interactive/RobotTests.java

jtr file location:
==================
file:/net/jtgb4u4c.eng/export/sail15/results/jdk1.3.1_01/2001-09-14/jck13a/win32/winxp_plugin_ie60/workDir/api-interactive/java_awt/interactive/RobotTests_RobotTests.jtr

How to reproduce:
=================
1. Run the following script under Windows XP (probably, you need to change JCK and JAVA_HOME paths)
2. Press "Start test" button
You will see that mouse pointer moves to the wrong locations.

--------Script START---------------------
#!/bin/sh
JAVA_HOME=c:/jdk1.3.1_01ea
JCK=c:/jck1.3a
export CLASSPATH="$JCK/classes:$JCK/javatest.jar"
executeClass="javasoft.sqe.tests.api.java.awt.interactive.RobotTests -TestCaseID RobotTest0003 -platform.robotAvailable true"
$JAVA_HOME/bin/java -Xfuture ${executeClass}
---------Script END----------------------

Test output:
============
RobotTest0003: Failed. mousePress/Release method does NOT work as expected.
result: Failed. tests: 1; passed: 0; failed: 1; first test case failure: RobotTest0003

Specific Machine Info:
=====================
Host name: jck-win2000XP
OS: Windows XP
Work Around
Set your mouse speed to the default (middle value).
  xxxxx@xxxxx   2001-09-28
Evaluation
Commit to fix in merlin-beta3 (JCK, XP).  
  xxxxx@xxxxx   2001-09-19

I can't reproduce this w/ 1.3.1, 1.3.1_01, 1.3.1_01a, or 1.4.0-b80.  I ran on XP Home Edition, build 2505.  I'll request more info from the submitter.
  xxxxx@xxxxx   2001-09-20

The submitter ran the test on XP Professional, build 2526.  Running on XP Home Edition, he couldn't reproduce the bug either.  Looks like a XP-Pro or build 2526-specific problem
  xxxxx@xxxxx   2001-09-20

Running XP Pro RC-2 (build 2526) on another machine still can't reproduce the problem.  I guess I'll have to pay a visit to the submitter to see this.

As for the problems with the EventTests, they are failing because they cannot create a Robot.  Here's the output:

Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01a-ea)
Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)
EventTest0008: Failed. Unable to create java.awt.robot: null
STATUS:Failed.tests: 1; failed: 1; first test case failure: EventTest0008

This is neither an XP-specific problem, nor limited to 1.3.1.  This test fails in exactly the same way on NT4, w/ 1.3, 1.3.1, 1.3.1a, and 1.4.

Because most of the tests ARE able to create Robot objects, I'm not convinced that the problem is with the Robot itself.

  xxxxx@xxxxx   2001-09-26

I witnessed the bug using the submitter's lab machine.  Not having set up the machine, the only difference I'm aware of between it and my XP Pro machine is that mine is a PIII and the lab machine is a Pentium 4.

Some debuging code in the JDK indicates that though ::mouse_event() was being passed the appropriate values, the cursor was not being moved to the correct spot.  Hmmm.

I modified Robot::MouseMove() to use ::SendInput() instead of mouse_event().  The problem persisted.

Just to make sure, I wrote a small Win32 app which calls mouse_event().  Sure enough, it also causes erroneous mouse movement.

After one of my treks over to the lab, I logged in not as Administrator, but as a user account I created for myself.  Out of the blue, the tests began to work.  Could logging in as Administrator play a part in producing this bug.

  xxxxx@xxxxx   2001-09-28

Today, the submitter deduced that the Administrator account had the mouse configured to move faster than the default.  Setting the mouse speed on any XP (or Win2000) machine can reproduce this problem.  He also discovered that the calls to SystemParametersInfo(SPI_SETMOUSESPEED,...) were failing.  So the mouse speed wasn't being programmatically set to a low speed, and the mouse_event() calls were causing the mouse to move much farther than intended - the behavior observed.

The MSDN docs for SystemParametersInfo for SPI_SETMOUSESPEED state that the void pointer parameter pvParam is not interpreted as a pointer at all, but "an integer between 1 (slowest) and 20 (fastest).  The default value is 10."  Passing the desired value as an int cast to a pointer (i.e. (int*) 10 )causes SystemParametersInfo(SPI_SETMOUSESPEED,...) calls to once again succeed.

  xxxxx@xxxxx   2001-09-28
Comments
  
  Include a link with my name & email   

Submitted On 04-MAY-2003
manishchopra
I am having the same problem with Win 2000, the cursor was 
not being moved to the correct
spot.  :-).


Submitted On 04-MAY-2003
manishchopra
If I adjust my mouse speed manually then it works fine.



PLEASE NOTE: JDK6 is formerly known as Project Mustang