
org.robolectric.shadows.ShadowVirtualMouse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shadows-framework Show documentation
Show all versions of shadows-framework Show documentation
An alternative Android testing framework.
The newest version!
package org.robolectric.shadows;
import android.hardware.input.VirtualMouse;
import android.hardware.input.VirtualMouseButtonEvent;
import android.hardware.input.VirtualMouseRelativeEvent;
import android.hardware.input.VirtualMouseScrollEvent;
import android.os.Build.VERSION_CODES;
import java.util.ArrayList;
import java.util.List;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
/** Shadow for VirtualMouse. */
@Implements(value = VirtualMouse.class, minSdk = VERSION_CODES.TIRAMISU, isInAndroidSdk = false)
public class ShadowVirtualMouse extends ShadowVirtualInputDevice {
private final List sentButtonEvents = new ArrayList<>();
private final List sentScrollEvents = new ArrayList<>();
private final List sentRelativeEvents = new ArrayList<>();
@Implementation
protected void sendButtonEvent(VirtualMouseButtonEvent event) {
sentButtonEvents.add(event);
}
@Implementation
protected void sendScrollEvent(VirtualMouseScrollEvent event) {
sentScrollEvents.add(event);
}
@Implementation
protected void sendRelativeEvent(VirtualMouseRelativeEvent event) {
sentRelativeEvents.add(event);
}
public List getSentButtonEvents() {
return sentButtonEvents;
}
public List getSentScrollEvents() {
return sentScrollEvents;
}
public List getSentRelativeEvents() {
return sentRelativeEvents;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy