Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit a63f3b8

Browse files
author
Emmanuel Garcia
committed
Use View#onDraw and suppress lint
1 parent a43b79a commit a63f3b8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

shell/platform/android/test/io/flutter/embedding/android/FlutterViewTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,7 @@ public void flutterImageView_detachFromRendererClosesAllImages() {
579579
}
580580

581581
@Test
582+
@SuppressLint("WrongCall") /*View#onDraw*/
582583
public void flutterImageView_onDrawClosesAllImages() {
583584
final ImageReader mockReader = mock(ImageReader.class);
584585
when(mockReader.getMaxImages()).thenReturn(2);
@@ -601,26 +602,27 @@ public void flutterImageView_onDrawClosesAllImages() {
601602
imageView.acquireLatestImage();
602603
imageView.acquireLatestImage();
603604

604-
imageView.draw(mock(Canvas.class));
605-
imageView.draw(mock(Canvas.class));
605+
imageView.onDraw(mock(Canvas.class));
606+
imageView.onDraw(mock(Canvas.class));
606607

607608
// 1 image is closed and 1 is active.
608609
verify(mockImage, times(1)).close();
609610
verify(mockReader, times(2)).acquireLatestImage();
610611

611612
// This call doesn't do anything because there isn't
612613
// an image in the queue.
613-
imageView.draw(mock(Canvas.class));
614+
imageView.onDraw(mock(Canvas.class));
614615
verify(mockImage, times(1)).close();
615616

616617
// Aquire another image and push it to the queue.
617618
imageView.acquireLatestImage();
618619
verify(mockReader, times(3)).acquireLatestImage();
619620

620621
// Then, the second image is closed.
621-
imageView.draw(mock(Canvas.class));
622+
imageView.onDraw(mock(Canvas.class));
622623
verify(mockImage, times(2)).close();
623624
}
625+
624626
/*
625627
* A custom shadow that reports fullscreen flag for system UI visibility
626628
*/

0 commit comments

Comments
 (0)