diff --git a/src/main/java/io/appium/java_client/TouchAction.java b/src/main/java/io/appium/java_client/TouchAction.java
index cc27ed8e2..ba88d8f91 100644
--- a/src/main/java/io/appium/java_client/TouchAction.java
+++ b/src/main/java/io/appium/java_client/TouchAction.java
@@ -125,6 +125,11 @@ public T release() {
* Moves current touch to a new position.
*
* @param moveToOptions see {@link PointOption} and {@link ElementOption}
+ * Important: some older Appium drivers releases have a bug when moveTo
+ * coordinates are calculated as relative to the recent pointer position
+ * in the chain instead of being absolute.
+ * @see Appium Issue #7486
+ * for more details.
* @return this TouchAction, for chaining.
*/
public T moveTo(PointOption moveToOptions) {
diff --git a/src/main/java/io/appium/java_client/touch/offset/PointOption.java b/src/main/java/io/appium/java_client/touch/offset/PointOption.java
index 9eeaaecd9..24c2dceb2 100644
--- a/src/main/java/io/appium/java_client/touch/offset/PointOption.java
+++ b/src/main/java/io/appium/java_client/touch/offset/PointOption.java
@@ -1,7 +1,5 @@
package io.appium.java_client.touch.offset;
-import static com.google.common.base.Preconditions.checkArgument;
-import static java.lang.String.format;
import static java.util.Optional.ofNullable;
import io.appium.java_client.touch.ActionOptions;
@@ -13,8 +11,6 @@ public class PointOption> extends ActionOptions {
protected Point coordinates;
- private static final String ERROR_MESSAGE_TEMPLATE = "%s coordinate value should be equal or greater than zero";
-
/**
* It creates a built instance of {@link PointOption} which takes x and y coordinates.
* This is offset from the upper left corner of the screen.
@@ -36,14 +32,14 @@ public static PointOption point(int xOffset, int yOffset) {
* @return self-reference
*/
public T withCoordinates(int xOffset, int yOffset) {
- checkArgument(xOffset >= 0, format(ERROR_MESSAGE_TEMPLATE, "X"));
- checkArgument(yOffset >= 0, format(ERROR_MESSAGE_TEMPLATE, "Y"));
coordinates = new Point(xOffset, yOffset);
+ //noinspection unchecked
return (T) this;
}
@Override
protected void verify() {
+ //noinspection ResultOfMethodCallIgnored
ofNullable(coordinates).orElseThrow(() -> new IllegalArgumentException(
"Coordinate values must be defined"));
}
diff --git a/src/test/java/io/appium/java_client/touch/TouchOptionsTests.java b/src/test/java/io/appium/java_client/touch/TouchOptionsTests.java
index 9822b0c9e..7faf773f5 100644
--- a/src/test/java/io/appium/java_client/touch/TouchOptionsTests.java
+++ b/src/test/java/io/appium/java_client/touch/TouchOptionsTests.java
@@ -44,8 +44,6 @@ public void invalidOptionsArgumentsShouldFailOnAltering() throws Exception {
final List invalidOptions = new ArrayList<>();
invalidOptions.add(() -> waitOptions(ofMillis(-1)));
invalidOptions.add(() -> new ElementOption().withCoordinates(0, 0).withElement(null));
- invalidOptions.add(() -> new PointOption().withCoordinates(0, -1));
- invalidOptions.add(() -> new PointOption().withCoordinates(-1, 0));
invalidOptions.add(() -> new WaitOptions().withDuration(null));
invalidOptions.add(() -> tapOptions().withTapsCount(-1));
invalidOptions.add(() -> longPressOptions().withDuration(null));