Skip to content

Commit bc2d9ea

Browse files
authored
fixing isValid function call bug (#188)
1 parent 2592ede commit bc2d9ea

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/main/java/io/percy/appium/providers/GenericProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public void getRegionsByLocation(JSONArray elementsArray, List<Region> customLoc
234234
for (int index = 0; index < customLocations.size(); index++) {
235235
try {
236236
Region customLocation = customLocations.get(index);
237-
if (customLocation.isValid(width, height)) {
237+
if (customLocation.isValid(height, width)) {
238238
String selector = "custom region " + index;
239239
JSONObject region = new JSONObject();
240240
JSONObject coordinates = new JSONObject();

src/test/java/io/percy/appium/providers/GenericProviderTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,12 @@ public void testGetRegionsByLocation() {
233233
customRegion.setBottom(100);
234234
customRegion.setLeft(200);
235235
customRegion.setRight(250);
236+
// Dimensions are 1080x2160
237+
Region invaliCustomRegion1 = new Region(2299, 2230, 200, 250);
238+
Region invaliCustomRegion2 = new Region(50, 100, 1070, 1100);
236239
customLocations.add(customRegion);
240+
customLocations.add(invaliCustomRegion1);
241+
customLocations.add(invaliCustomRegion2);
237242

238243
AndroidMetadata metadata = new AndroidMetadata(androidDriver, "dummy", null, null, null, null);
239244
GenericProvider genericProvider = new GenericProvider(androidDriver);

0 commit comments

Comments
 (0)