Skip to content

Commit

Permalink
test: Simply Robolectric checking for AccessibilityNodeInfoTest
Browse files Browse the repository at this point in the history
Signed-off-by: utzcoz <[email protected]>
  • Loading branch information
utzcoz committed Nov 18, 2024
1 parent 39f59d0 commit 1bd0bcf
Showing 1 changed file with 2 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,11 @@ public void directAccessibilityConnection_queryChildCount() {
assertThat(node.getChildCount()).isEqualTo(1);
assertThat(node.getChild(0)).isNotNull();
// Only expect getWindowId() is -1 in Robolectric environment.
// TODO remove isRobolectric checking after fixing Robolectric's implementation.
if (isRobolectric()) {
// TODO remove Robolectric checking after fixing Robolectric's implementation.
if (Build.FINGERPRINT.equals("robolectric")) {
assertThat(node.getWindowId()).isEqualTo(-1);
}
});
}
}

private static boolean isRobolectric() {
try {
Class.forName("org.robolectric.RobolectricTestRunner");
return true;
} catch (ClassNotFoundException e) {
return false;
}
}
}

0 comments on commit 1bd0bcf

Please sign in to comment.