7007708: TEST: javax/swing/JScrollBar/6542335/bug6542335.java failes agaisnt jdk7 on solaris/linux
Reviewed-by: alexp
This commit is contained in:
parent
25eeccff38
commit
f6993442af
@ -40,11 +40,13 @@ public class bug6542335 {
|
|||||||
private static MyScrollBarUI ui;
|
private static MyScrollBarUI ui;
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
Robot robot = new Robot();
|
final Robot robot = new Robot();
|
||||||
robot.setAutoDelay(10);
|
robot.setAutoDelay(10);
|
||||||
|
|
||||||
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
|
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
|
||||||
|
|
||||||
|
final Rectangle[] thumbBounds = new Rectangle[1];
|
||||||
|
|
||||||
SwingUtilities.invokeAndWait(new Runnable() {
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
final JFrame frame = new JFrame("bug6542335");
|
final JFrame frame = new JFrame("bug6542335");
|
||||||
@ -63,26 +65,40 @@ public class bug6542335 {
|
|||||||
rangeModel.setValue(50);
|
rangeModel.setValue(50);
|
||||||
|
|
||||||
sb.setModel(rangeModel);
|
sb.setModel(rangeModel);
|
||||||
frame.add(sb);
|
frame.add(sb, BorderLayout.NORTH);
|
||||||
|
|
||||||
frame.setSize(200, 100);
|
frame.setSize(200, 100);
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
|
|
||||||
|
thumbBounds[0] = new Rectangle(ui.getThumbBounds());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Rectangle thumbBounds = new Rectangle(ui.getThumbBounds());
|
|
||||||
|
|
||||||
toolkit.realSync();
|
toolkit.realSync();
|
||||||
|
|
||||||
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
|
public void run() {
|
||||||
Point l = sb.getLocationOnScreen();
|
Point l = sb.getLocationOnScreen();
|
||||||
robot.mouseMove(l.x + (int) (0.75 * sb.getWidth()), l.y + sb.getHeight()/2);
|
|
||||||
|
robot.mouseMove(l.x + (int) (0.75 * sb.getWidth()), l.y + sb.getHeight() / 2);
|
||||||
robot.mousePress(InputEvent.BUTTON1_MASK);
|
robot.mousePress(InputEvent.BUTTON1_MASK);
|
||||||
robot.mouseRelease(InputEvent.BUTTON1_MASK);
|
robot.mouseRelease(InputEvent.BUTTON1_MASK);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
toolkit.realSync();
|
toolkit.realSync();
|
||||||
|
|
||||||
if (!thumbBounds.equals(ui.getThumbBounds())) {
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
throw new RuntimeException("Test failed");
|
public void run() {
|
||||||
|
Rectangle newThumbBounds = ui.getThumbBounds();
|
||||||
|
|
||||||
|
if (!thumbBounds[0].equals(newThumbBounds)) {
|
||||||
|
throw new RuntimeException("Test failed.\nOld bounds: " + thumbBounds[0] +
|
||||||
|
"\nNew bounds: " + newThumbBounds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
static class MyScrollBarUI extends BasicScrollBarUI {
|
static class MyScrollBarUI extends BasicScrollBarUI {
|
||||||
public Rectangle getThumbBounds() {
|
public Rectangle getThumbBounds() {
|
||||||
|
Loading…
Reference in New Issue
Block a user