use of org.robolectric.shadows.ShadowMatrix in project picasso by square.
the class BitmapHunterTest method centerCropWithGravityVerticalBottom.
@Test
public void centerCropWithGravityVerticalBottom() {
Bitmap source = Bitmap.createBitmap(10, 20, ARGB_8888);
Request data = new Request.Builder(URI_1).resize(40, 40).centerCrop(Gravity.BOTTOM).build();
Bitmap result = transformResult(data, source, 0);
ShadowBitmap shadowBitmap = shadowOf(result);
assertThat(shadowBitmap.getCreatedFromBitmap()).isSameAs(source);
assertThat(shadowBitmap.getCreatedFromX()).isEqualTo(0);
assertThat(shadowBitmap.getCreatedFromY()).isEqualTo(10);
assertThat(shadowBitmap.getCreatedFromWidth()).isEqualTo(10);
assertThat(shadowBitmap.getCreatedFromHeight()).isEqualTo(10);
Matrix matrix = shadowBitmap.getCreatedFromMatrix();
ShadowMatrix shadowMatrix = shadowOf(matrix);
assertThat(shadowMatrix.getPreOperations()).containsOnly("scale 4.0 4.0");
}
Aggregations