summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/screenshot/ScrollCaptureControllerTest.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScrollCaptureControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScrollCaptureControllerTest.java
index 410d9de9e0ac..7fe178c81ea8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScrollCaptureControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScrollCaptureControllerTest.java
@@ -17,6 +17,7 @@
package com.android.systemui.screenshot;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyFloat;
import static org.mockito.ArgumentMatchers.anyInt;
@@ -57,13 +58,17 @@ public class ScrollCaptureControllerTest extends SysuiTestCase {
public int availableBottom = Integer.MAX_VALUE;
// If true, return an empty rect any time a partial result would have been returned.
public boolean emptyInsteadOfPartial = false;
+ private int mPreviousTopRequested = 0;
@Override
public ListenableFuture<ScrollCaptureClient.CaptureResult> requestTile(int top) {
+ // Ensure we don't request a tile more than a tile away.
+ assertTrue(Math.abs(top - mPreviousTopRequested) <= getTileHeight());
+ mPreviousTopRequested = top;
Rect requested = new Rect(0, top, getPageWidth(), top + getTileHeight());
Rect fullContent = new Rect(0, availableTop, getPageWidth(), availableBottom);
Rect captured = new Rect(requested);
- captured.intersect(fullContent);
+ assertTrue(captured.intersect(fullContent));
if (emptyInsteadOfPartial && captured.height() != getTileHeight()) {
captured = new Rect();
}