Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Lint
  • Loading branch information
Emmanuel Garcia committed Sep 1, 2020
commit fc81d61ce851e9b6486b9056afb3ca291292ad18
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ public FlutterImageView(@NonNull Context context, int width, int height, Surface
this(context, createImageReader(width, height), kind);
}

public FlutterImageView(@NonNull Context context) {
this(context, 1, 1, SurfaceKind.background);
}

public FlutterImageView(@NonNull Context context, @NonNull AttributeSet attrs) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the import for AttributeSet

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦‍♂️

this(context, 1, 1, SurfaceKind.background);
}

@VisibleForTesting
FlutterImageView(@NonNull Context context, @NonNull ImageReader imageReader, SurfaceKind kind) {
super(context, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,24 +601,24 @@ public void flutterImageView_onDrawClosesAllImages() {
imageView.acquireLatestImage();
imageView.acquireLatestImage();

imageView.onDraw(mock(Canvas.class));
imageView.onDraw(mock(Canvas.class));
imageView.draw(mock(Canvas.class));
imageView.draw(mock(Canvas.class));

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

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

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

// Then, the second image is closed.
imageView.onDraw(mock(Canvas.class));
imageView.draw(mock(Canvas.class));
verify(mockImage, times(2)).close();
}
/*
Expand Down