/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 7050935
@summary closed/java/awt/Choice/WheelEventsConsumed/WheelEventsConsumed.html fails on win32
@author Oleg Pekhovskiy: area=awt-choice
@run main ChoiceMouseWheelTest
*/
private boolean itemChanged = false;
private boolean wheelMoved = false;
private boolean frameExited = false;
new ChoiceMouseWheelTest();
}
super("ChoiceMouseWheelTest");
setLayout(new FlowLayout());
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
}
});
}
public void itemStateChanged(ItemEvent e) {
itemChanged = true;
}
});
public void mouseWheelMoved(MouseWheelEvent e) {
wheelMoved = true;
}
});
addMouseListener(new MouseAdapter() {
public void mouseExited(MouseEvent e) {
frameExited = true;
}
});
setVisible(true);
toFront();
try {
robot.waitForIdle();
// Test mouse wheel over the choice
// mouse wheel doesn't work for the choice on X11 and Mac, so skip it
robot.waitForIdle();
if(!wheelMoved || !itemChanged) {
throw new RuntimeException("Mouse Wheel over the choice failed!");
}
}
// Test mouse wheel over the drop-down list
robot.waitForIdle();
robot.waitForIdle();
robot.waitForIdle();
}
if(x < 0) {
throw new RuntimeException("Could not enter drop-down list!");
}
robot.waitForIdle();
robot.waitForIdle();
// click the last item
itemChanged = false;
robot.waitForIdle();
robot.waitForIdle();
throw new RuntimeException("Mouse Wheel scroll position error!");
}
} catch (AWTException e) {
throw new RuntimeException("AWTException occurred - problem creating robot!");
}
}
}