diff options
author | Vadim Caen <caen@google.com> | 2018-01-29 17:11:43 +0000 |
---|---|---|
committer | Vadim Caen <caen@google.com> | 2018-01-29 18:58:01 +0000 |
commit | 63d12f56487ec31b006f38985ddd03a08d86b6e9 (patch) | |
tree | a75f217e7875c2f91365a338748cf609a18d2235 | |
parent | ea9a9b4277dc05164b94133d2266ee443c3849e4 (diff) | |
download | swing-testing-63d12f56487ec31b006f38985ddd03a08d86b6e9.tar.gz |
Offset 5 pixel to the right when clicking tree cell
The previous implementation was clicking on (0, height/2) which could
lead to clicking outside the cell. To avoid this situation, the click
location has been slightly offset to the right by 5 pixels.
Test: existing test are passing
Change-Id: Ifc1a34a7e18825cd3e5f9b059ddd53f4c5fdecd6
-rw-r--r-- | fest-swing/src/main/java/org/fest/swing/driver/JTreeLocation.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fest-swing/src/main/java/org/fest/swing/driver/JTreeLocation.java b/fest-swing/src/main/java/org/fest/swing/driver/JTreeLocation.java index 58e8ff0a..a7a01693 100644 --- a/fest-swing/src/main/java/org/fest/swing/driver/JTreeLocation.java +++ b/fest-swing/src/main/java/org/fest/swing/driver/JTreeLocation.java @@ -141,6 +141,8 @@ public final class JTreeLocation { } private @NotNull Point pointAt(@NotNull Rectangle cellBounds) { - return new Point(cellBounds.x, cellBounds.y + cellBounds.height / 2); + // We don't want to click in the middle in case the cell is too wide and the middle is off-screen. + // And we click at a +5 offset to ensure that we are not clicking just outside the cell + return new Point(cellBounds.x + 5, cellBounds.y + cellBounds.height / 2); } } |