Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions test/jdk/javax/swing/JSlider/bug4382876.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public class bug4382876 {
private static Robot r;
private static JFrame f;
private static JSlider slider;
private static boolean upFail;
private static boolean downFail;
private static volatile boolean upFail;
private static volatile boolean downFail;

public static void main(String[] args) throws Exception {
try {
Expand All @@ -70,23 +70,30 @@ public static void main(String[] args) throws Exception {
r.delay(1000);

r.keyPress(KeyEvent.VK_PAGE_UP);
r.keyRelease(KeyEvent.VK_PAGE_UP);

SwingUtilities.invokeAndWait(() -> {
if (slider.getValue() < -1000) {
System.out.println("PAGE_UP VAL: " + slider.getValue());
upFail = true;
}
});

if (upFail) {
writeFailImage();
throw new RuntimeException("Slider value did NOT change with PAGE_UP");
}

r.keyPress(KeyEvent.VK_PAGE_DOWN);
r.keyRelease(KeyEvent.VK_PAGE_DOWN);

SwingUtilities.invokeAndWait(() -> {
if (slider.getValue() > -1000) {
System.out.println("PAGE_DOWN VAL: " + slider.getValue());
downFail = true;
}
});

if (downFail) {
writeFailImage();
throw new RuntimeException("Slider value did NOT change with PAGE_DOWN");
Expand Down