# HG changeset patch # User psadhukhan # Date 1520051122 -19800 # Node ID d084b517639542fa9659196108d9e13b3bca6fb0 # Parent 3f825ec26b01bd17c1a9b00158ac54ecb3ae3e72 8194767: Regression automated Test 'javax/swing/JEditorPane/6917744/bug6917744.java' fails Reviewed-by: ssadetsky, prr diff -r 3f825ec26b01 -r d084b5176395 test/jdk/ProblemList.txt --- a/test/jdk/ProblemList.txt Fri Mar 02 14:25:39 2018 -0800 +++ b/test/jdk/ProblemList.txt Sat Mar 03 09:55:22 2018 +0530 @@ -643,7 +643,6 @@ javax/swing/JComboBox/8072767/bug8072767.java 8196093 windows-all,macosx-all javax/swing/JComponent/4337267/bug4337267.java 8146451 windows-all javax/swing/JEditorPane/5076514/bug5076514.java 8198321 generic-all -javax/swing/JEditorPane/6917744/bug6917744.java 8194767 generic-all javax/swing/JFileChooser/4524490/bug4524490.java 8042380 generic-all javax/swing/JFileChooser/8002077/bug8002077.java 8196094 windows-all javax/swing/JFileChooser/DeserializedJFileChooser/DeserializedJFileChooserTest.java 8196095 generic-all diff -r 3f825ec26b01 -r d084b5176395 test/jdk/javax/swing/JEditorPane/6917744/bug6917744.java --- a/test/jdk/javax/swing/JEditorPane/6917744/bug6917744.java Fri Mar 02 14:25:39 2018 -0800 +++ b/test/jdk/javax/swing/JEditorPane/6917744/bug6917744.java Sat Mar 03 09:55:22 2018 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,13 +24,14 @@ /* * @test * @key headful - * @bug 6917744 + * @bug 6917744 8194767 * @summary JScrollPane Page Up/Down keys do not handle correctly html tables with different cells contents * @author Pavel Porvatov * @run main bug6917744 */ import java.awt.*; +import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.io.IOException; import javax.swing.*; @@ -44,6 +45,23 @@ private static Robot robot; + private static Point p = null; + + static void blockTillDisplayed(JComponent comp) throws Exception { + while (p == null) { + try { + SwingUtilities.invokeAndWait(() -> { + p = comp.getLocationOnScreen(); + }); + } catch (IllegalStateException e) { + try { + Thread.sleep(1000); + } catch (InterruptedException ie) { + } + } + } + } + public static void main(String[] args) throws Exception { robot = new Robot(); @@ -58,6 +76,7 @@ try { editorPane.setPage(bug6917744.class.getResource("/test.html")); } catch (IOException e) { + frame.dispose(); throw new RuntimeException("HTML resource not found", e); } @@ -69,6 +88,12 @@ } }); + blockTillDisplayed(editorPane); + robot.mouseMove(p.x+50, p.y+50); + robot.waitForIdle(); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); robot.waitForIdle(); for (int i = 0; i < 50; i++) { @@ -84,6 +109,7 @@ BoundedRangeModel model = scrollPane.getVerticalScrollBar().getModel(); if (model.getValue() + model.getExtent() != model.getMaximum()) { + frame.dispose(); throw new RuntimeException("Invalid HTML position"); } } @@ -104,6 +130,7 @@ BoundedRangeModel model = scrollPane.getVerticalScrollBar().getModel(); if (model.getValue() != model.getMinimum()) { + frame.dispose(); throw new RuntimeException("Invalid HTML position"); }