use of com.squareup.picasso3.RequestHandler.Result in project picasso by square.
the class BitmapHunterTest method exifRotationWithManualRotation.
@Test
public void exifRotationWithManualRotation() {
Bitmap source = Bitmap.createBitmap(10, 10, ARGB_8888);
Request data = new Request.Builder(URI_1).rotate(-45).build();
Bitmap result = transformResult(data, source, ORIENTATION_ROTATE_90);
ShadowBitmap shadowBitmap = shadowOf(result);
assertThat(shadowBitmap.getCreatedFromBitmap()).isSameInstanceAs(source);
Matrix matrix = shadowBitmap.getCreatedFromMatrix();
ShadowMatrix shadowMatrix = shadowOf(matrix);
assertThat(shadowMatrix.getPreOperations()).containsExactly("rotate 90.0");
assertThat(shadowMatrix.getSetOperations()).containsEntry("rotate", "-45.0");
}
use of com.squareup.picasso3.RequestHandler.Result in project picasso by square.
the class BitmapHunterTest method exifRotationNoSizing.
@Test
public void exifRotationNoSizing() {
Request data = new Request.Builder(URI_1).build();
Bitmap source = Bitmap.createBitmap(10, 10, ARGB_8888);
Bitmap result = transformResult(data, source, ORIENTATION_ROTATE_90);
ShadowBitmap shadowBitmap = shadowOf(result);
assertThat(shadowBitmap.getCreatedFromBitmap()).isSameInstanceAs(source);
Matrix matrix = shadowBitmap.getCreatedFromMatrix();
ShadowMatrix shadowMatrix = shadowOf(matrix);
assertThat(shadowMatrix.getPreOperations()).contains("rotate 90.0");
}
use of com.squareup.picasso3.RequestHandler.Result in project picasso by square.
the class BitmapHunterTest method centerInsideTallTooSmall.
@Test
public void centerInsideTallTooSmall() {
Bitmap source = Bitmap.createBitmap(20, 10, ARGB_8888);
Request data = new Request.Builder(URI_1).resize(50, 50).centerInside().build();
Bitmap result = transformResult(data, source, 0);
ShadowBitmap shadowBitmap = shadowOf(result);
assertThat(shadowBitmap.getCreatedFromBitmap()).isSameInstanceAs(source);
Matrix matrix = shadowBitmap.getCreatedFromMatrix();
ShadowMatrix shadowMatrix = shadowOf(matrix);
assertThat(shadowMatrix.getPreOperations()).containsExactly("scale 2.5 2.5");
}
use of com.squareup.picasso3.RequestHandler.Result in project picasso by square.
the class BitmapHunterTest method centerCropResultMatchesTargetSizeWhileDesiredHeightIs0.
@Test
public void centerCropResultMatchesTargetSizeWhileDesiredHeightIs0() {
Request request = new Request.Builder(URI_1).resize(1080, 0).centerCrop().build();
Bitmap source = Bitmap.createBitmap(640, 640, ARGB_8888);
Bitmap result = transformResult(request, source, 0);
assertThat(result.getWidth()).isEqualTo(1080);
assertThat(result.getHeight()).isEqualTo(1080);
}
use of com.squareup.picasso3.RequestHandler.Result in project picasso by square.
the class BitmapHunterTest method exifTransverse.
@Test
public void exifTransverse() {
Request data = new Request.Builder(URI_1).rotate(-45).build();
Bitmap source = Bitmap.createBitmap(10, 10, ARGB_8888);
Bitmap result = transformResult(data, source, ORIENTATION_TRANSVERSE);
ShadowBitmap shadowBitmap = shadowOf(result);
assertThat(shadowBitmap.getCreatedFromBitmap()).isSameInstanceAs(source);
Matrix matrix = shadowBitmap.getCreatedFromMatrix();
ShadowMatrix shadowMatrix = shadowOf(matrix);
assertThat(shadowMatrix.getPostOperations()).containsExactly("scale -1.0 1.0");
assertThat(shadowMatrix.getPreOperations()).containsExactly("rotate 270.0");
}
Aggregations