/*
@test %I% %E%
@bug 6315717
@summary verifies that sun.awt.enableExtraMouseButtons is working
@author Andrei Dmitriev : area=awt.mouse
*/
// Testcase 1: set to TRUE (via jtreg option)
// Testcase 2: set to TRUE and check that extra events are coming
// check that standard events are coming
static boolean propValue;
static int [] buttonsPressed;
static int [] buttonsReleased;
static int [] buttonsClicked;
frame.setVisible(true);
public void mousePressed(MouseEvent e) {
}
public void mouseReleased(MouseEvent e) {
}
public void mouseClicked(MouseEvent e) {
}
};
// frame.addMouseListener(ma1);
try {
robot.mouseMove(frame.getLocationOnScreen().x + frame.getWidth()/2, frame.getLocationOnScreen().y + frame.getHeight()/2);
testCase0();
testCase1();
if ( !lessThenFourButtons ) {
testCase2();
// testCase3();
// testCase4();
}
} catch (Exception e){
e.printStackTrace();
throw new RuntimeException(e);
}
}
public static void testCase0(){
if (!propValue){
throw new RuntimeException("TEST FAILED (0) : System property sun.awt.enableExtraMouseButtons = " + propValue);
}
}
public static void testCase1(){
throw new RuntimeException("TEST FAILED (1) : setting to TRUE. enabled = " + Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled());
}
}
public static void testCase2(){
emptyArrays();
//we can't post a message from an unexistent button
}
}
throw new RuntimeException("TESTCASE 2 FAILED : button " + (i+1) + " wasn't single pressed|released|clicked : "+ buttonsPressed[i] +" : "+ buttonsReleased[i] +" : "+ buttonsClicked[i]);
}
}
}
public static void emptyArrays(){
buttonsPressed[i] = 0;
buttonsReleased[i] = 0;
buttonsClicked[i] = 0;
}
}
}