8159694: HiDPI, Unity, java/awt/dnd/DropTargetEnterExitTest/MissedDragExitTest.java

Reviewed-by: phh
Backport-of: c3938ec18b4026d70d9654235dcd986d90344f5b
This commit is contained in:
Taizo Kurashige 2025-05-21 16:06:18 +00:00 committed by Paul Hohensee
parent 1daca5f46e
commit b4aa2218a4
2 changed files with 10 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2022, 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
@ -59,6 +59,7 @@ public class MissedDragExitTest {
private static void initAndShowUI() {
f = new Frame("Test frame");
f.setUndecorated(true);
f.setBounds(FRAME_LOCATION,FRAME_LOCATION,FRAME_SIZE,FRAME_SIZE);
final DraggablePanel dragSource = new DraggablePanel();
@ -101,7 +102,7 @@ public class MissedDragExitTest {
Util.drag(r,
new Point(FRAME_LOCATION + FRAME_SIZE / 3, FRAME_LOCATION + FRAME_SIZE / 3),
new Point(FRAME_LOCATION + FRAME_SIZE / 3 * 2, FRAME_LOCATION + FRAME_SIZE / 3 * 2),
InputEvent.BUTTON1_MASK);
InputEvent.BUTTON1_DOWN_MASK);
Util.waitForIdle(r);
if (!dragExitCalled) {

View File

@ -323,8 +323,13 @@ public final class Util {
* {@code InputEvent.BUTTON3_MASK}
*/
public static void drag(Robot robot, Point startPoint, Point endPoint, int button) {
if (!(button == InputEvent.BUTTON1_MASK || button == InputEvent.BUTTON2_MASK
|| button == InputEvent.BUTTON3_MASK))
if (!(button == InputEvent.BUTTON1_MASK
|| button == InputEvent.BUTTON2_MASK
|| button == InputEvent.BUTTON3_MASK
|| button == InputEvent.BUTTON1_DOWN_MASK
|| button == InputEvent.BUTTON2_DOWN_MASK
|| button == InputEvent.BUTTON3_DOWN_MASK
))
{
throw new IllegalArgumentException("invalid mouse button");
}