Java Code Examples for org.robolectric.shadows.ShadowBitmapFactory#provideWidthAndHeightHints()

The following examples show how to use org.robolectric.shadows.ShadowBitmapFactory#provideWidthAndHeightHints() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PictureResizeDialogTest.java    From Onosendai with Apache License 2.0 6 votes vote down vote up
@Test
public void itGeneratesLivePreview () throws Exception {
	this.alert.show();
	this.dlg.updateSummary();

	final TextView txtSummary = (TextView) this.shadowAlert.getView().findViewById(R.id.txtSummary);

	ShadowBitmapFactory.provideWidthAndHeightHints(this.attachment, 72, 72);
	// Note above does not actually have any effect,
	// since dimensions are read via BitmapFactory.decodeFileDescriptor().
	// 100x100 is ShadowBitmapFactory's default.
	final String expectedStatus = "100 x 100 (3.4 KB) --> 36 x 36 (69 B)";
	int n = 0;
	while (true) {
		if (expectedStatus.equals(txtSummary.getText().toString())) break;
		if (n > 5) fail("Expected '" + txtSummary.getText() + "' to be '" + expectedStatus + "' after " + n + " seconds.");
		n++;
		Thread.sleep(1000L);
	}

	// TODO assert img in UI is set.
}
 
Example 2
Source File: ImageRequestTest.java    From volley with Apache License 2.0 4 votes vote down vote up
@Test
public void parseNetworkResponse_resizing() throws Exception {
    // This is a horrible hack but Robolectric doesn't have a way to provide
    // width and height hints for decodeByteArray. It works because the byte array
    // "file:fake" is ASCII encodable and thus the name in Robolectric's fake
    // bitmap creator survives as-is, and provideWidthAndHeightHints puts
    // "file:" + name in its lookaside map. I write all this because it will
    // probably break mysteriously at some point and I feel terrible about your
    // having to debug it.
    byte[] jpegBytes = "file:fake".getBytes(StandardCharsets.UTF_8);
    ShadowBitmapFactory.provideWidthAndHeightHints("fake", 1024, 500);
    NetworkResponse jpeg = new NetworkResponse(jpegBytes);

    // Scale the image uniformly (maintain the image's aspect ratio) so that
    // both dimensions (width and height) of the image will be equal to or
    // less than the corresponding dimension of the view.
    ScaleType scalteType = ScaleType.CENTER_INSIDE;

    // Exact sizes
    verifyResize(jpeg, 512, 250, scalteType, 512, 250); // exactly half
    verifyResize(jpeg, 511, 249, scalteType, 509, 249); // just under half
    verifyResize(jpeg, 1080, 500, scalteType, 1024, 500); // larger
    verifyResize(jpeg, 500, 500, scalteType, 500, 244); // keep same ratio

    // Specify only width, preserve aspect ratio
    verifyResize(jpeg, 512, 0, scalteType, 512, 250);
    verifyResize(jpeg, 800, 0, scalteType, 800, 390);
    verifyResize(jpeg, 1024, 0, scalteType, 1024, 500);

    // Specify only height, preserve aspect ratio
    verifyResize(jpeg, 0, 250, scalteType, 512, 250);
    verifyResize(jpeg, 0, 391, scalteType, 800, 391);
    verifyResize(jpeg, 0, 500, scalteType, 1024, 500);

    // No resize
    verifyResize(jpeg, 0, 0, scalteType, 1024, 500);

    // Scale the image uniformly (maintain the image's aspect ratio) so that
    // both dimensions (width and height) of the image will be equal to or
    // larger than the corresponding dimension of the view.
    scalteType = ScaleType.CENTER_CROP;

    // Exact sizes
    verifyResize(jpeg, 512, 250, scalteType, 512, 250);
    verifyResize(jpeg, 511, 249, scalteType, 511, 249);
    verifyResize(jpeg, 1080, 500, scalteType, 1024, 500);
    verifyResize(jpeg, 500, 500, scalteType, 1024, 500);

    // Specify only width
    verifyResize(jpeg, 512, 0, scalteType, 512, 250);
    verifyResize(jpeg, 800, 0, scalteType, 800, 390);
    verifyResize(jpeg, 1024, 0, scalteType, 1024, 500);

    // Specify only height
    verifyResize(jpeg, 0, 250, scalteType, 512, 250);
    verifyResize(jpeg, 0, 391, scalteType, 800, 391);
    verifyResize(jpeg, 0, 500, scalteType, 1024, 500);

    // No resize
    verifyResize(jpeg, 0, 0, scalteType, 1024, 500);

    // Scale in X and Y independently, so that src matches dst exactly. This
    // may change the aspect ratio of the src.
    scalteType = ScaleType.FIT_XY;

    // Exact sizes
    verifyResize(jpeg, 512, 250, scalteType, 512, 250);
    verifyResize(jpeg, 511, 249, scalteType, 511, 249);
    verifyResize(jpeg, 1080, 500, scalteType, 1024, 500);
    verifyResize(jpeg, 500, 500, scalteType, 500, 500);

    // Specify only width
    verifyResize(jpeg, 512, 0, scalteType, 512, 500);
    verifyResize(jpeg, 800, 0, scalteType, 800, 500);
    verifyResize(jpeg, 1024, 0, scalteType, 1024, 500);

    // Specify only height
    verifyResize(jpeg, 0, 250, scalteType, 1024, 250);
    verifyResize(jpeg, 0, 391, scalteType, 1024, 391);
    verifyResize(jpeg, 0, 500, scalteType, 1024, 500);

    // No resize
    verifyResize(jpeg, 0, 0, scalteType, 1024, 500);
}
 
Example 3
Source File: ImageRequestTest.java    From device-database with Apache License 2.0 4 votes vote down vote up
@Test public void parseNetworkResponse_resizing() throws Exception {
    // This is a horrible hack but Robolectric doesn't have a way to provide
    // width and height hints for decodeByteArray. It works because the byte array
    // "file:fake" is ASCII encodable and thus the name in Robolectric's fake
    // bitmap creator survives as-is, and provideWidthAndHeightHints puts
    // "file:" + name in its lookaside map. I write all this because it will
    // probably break mysteriously at some point and I feel terrible about your
    // having to debug it.
    byte[] jpegBytes = "file:fake".getBytes();
    ShadowBitmapFactory.provideWidthAndHeightHints("fake", 1024, 500);
    NetworkResponse jpeg = new NetworkResponse(jpegBytes);

    // Scale the image uniformly (maintain the image's aspect ratio) so that
    // both dimensions (width and height) of the image will be equal to or
    // less than the corresponding dimension of the view.
    ScaleType scalteType = ScaleType.CENTER_INSIDE;

    // Exact sizes
    verifyResize(jpeg, 512, 250, scalteType, 512, 250); // exactly half
    verifyResize(jpeg, 511, 249, scalteType, 509, 249); // just under half
    verifyResize(jpeg, 1080, 500, scalteType, 1024, 500); // larger
    verifyResize(jpeg, 500, 500, scalteType, 500, 244); // keep same ratio

    // Specify only width, preserve aspect ratio
    verifyResize(jpeg, 512, 0, scalteType, 512, 250);
    verifyResize(jpeg, 800, 0, scalteType, 800, 390);
    verifyResize(jpeg, 1024, 0, scalteType, 1024, 500);

    // Specify only height, preserve aspect ratio
    verifyResize(jpeg, 0, 250, scalteType, 512, 250);
    verifyResize(jpeg, 0, 391, scalteType, 800, 391);
    verifyResize(jpeg, 0, 500, scalteType, 1024, 500);

    // No resize
    verifyResize(jpeg, 0, 0, scalteType, 1024, 500);


    // Scale the image uniformly (maintain the image's aspect ratio) so that
    // both dimensions (width and height) of the image will be equal to or
    // larger than the corresponding dimension of the view.
    scalteType = ScaleType.CENTER_CROP;

    // Exact sizes
    verifyResize(jpeg, 512, 250, scalteType, 512, 250);
    verifyResize(jpeg, 511, 249, scalteType, 511, 249);
    verifyResize(jpeg, 1080, 500, scalteType, 1024, 500);
    verifyResize(jpeg, 500, 500, scalteType, 1024, 500);

    // Specify only width
    verifyResize(jpeg, 512, 0, scalteType, 512, 250);
    verifyResize(jpeg, 800, 0, scalteType, 800, 390);
    verifyResize(jpeg, 1024, 0, scalteType, 1024, 500);

    // Specify only height
    verifyResize(jpeg, 0, 250, scalteType, 512, 250);
    verifyResize(jpeg, 0, 391, scalteType, 800, 391);
    verifyResize(jpeg, 0, 500, scalteType, 1024, 500);

    // No resize
    verifyResize(jpeg, 0, 0, scalteType, 1024, 500);


    // Scale in X and Y independently, so that src matches dst exactly. This
    // may change the aspect ratio of the src.
    scalteType = ScaleType.FIT_XY;

    // Exact sizes
    verifyResize(jpeg, 512, 250, scalteType, 512, 250);
    verifyResize(jpeg, 511, 249, scalteType, 511, 249);
    verifyResize(jpeg, 1080, 500, scalteType, 1024, 500);
    verifyResize(jpeg, 500, 500, scalteType, 500, 500);

    // Specify only width
    verifyResize(jpeg, 512, 0, scalteType, 512, 500);
    verifyResize(jpeg, 800, 0, scalteType, 800, 500);
    verifyResize(jpeg, 1024, 0, scalteType, 1024, 500);

    // Specify only height
    verifyResize(jpeg, 0, 250, scalteType, 1024, 250);
    verifyResize(jpeg, 0, 391, scalteType, 1024, 391);
    verifyResize(jpeg, 0, 500, scalteType, 1024, 500);

    // No resize
    verifyResize(jpeg, 0, 0, scalteType, 1024, 500);
}
 
Example 4
Source File: ImageRequestTest.java    From SaveVolley with Apache License 2.0 4 votes vote down vote up
@Test public void parseNetworkResponse_resizing() throws Exception {
    // This is a horrible hack but Robolectric doesn't have a way to provide
    // width and height hints for decodeByteArray. It works because the byte array
    // "file:fake" is ASCII encodable and thus the name in Robolectric's fake
    // bitmap creator survives as-is, and provideWidthAndHeightHints puts
    // "file:" + name in its lookaside map. I write all this because it will
    // probably break mysteriously at some point and I feel terrible about your
    // having to debug it.
    byte[] jpegBytes = "file:fake".getBytes();
    ShadowBitmapFactory.provideWidthAndHeightHints("fake", 1024, 500);
    NetworkResponse jpeg = new NetworkResponse(jpegBytes);

    // Scale the image uniformly (maintain the image's aspect ratio) so that
    // both dimensions (width and height) of the image will be equal to or
    // less than the corresponding dimension of the view.
    ScaleType scalteType = ScaleType.CENTER_INSIDE;

    // Exact sizes
    verifyResize(jpeg, 512, 250, scalteType, 512, 250); // exactly half
    verifyResize(jpeg, 511, 249, scalteType, 509, 249); // just under half
    verifyResize(jpeg, 1080, 500, scalteType, 1024, 500); // larger
    verifyResize(jpeg, 500, 500, scalteType, 500, 244); // keep same ratio

    // Specify only width, preserve aspect ratio
    verifyResize(jpeg, 512, 0, scalteType, 512, 250);
    verifyResize(jpeg, 800, 0, scalteType, 800, 390);
    verifyResize(jpeg, 1024, 0, scalteType, 1024, 500);

    // Specify only height, preserve aspect ratio
    verifyResize(jpeg, 0, 250, scalteType, 512, 250);
    verifyResize(jpeg, 0, 391, scalteType, 800, 391);
    verifyResize(jpeg, 0, 500, scalteType, 1024, 500);

    // No resize
    verifyResize(jpeg, 0, 0, scalteType, 1024, 500);

    // Scale the image uniformly (maintain the image's aspect ratio) so that
    // both dimensions (width and height) of the image will be equal to or
    // larger than the corresponding dimension of the view.
    scalteType = ScaleType.CENTER_CROP;

    // Exact sizes
    verifyResize(jpeg, 512, 250, scalteType, 512, 250);
    verifyResize(jpeg, 511, 249, scalteType, 511, 249);
    verifyResize(jpeg, 1080, 500, scalteType, 1024, 500);
    verifyResize(jpeg, 500, 500, scalteType, 1024, 500);

    // Specify only width
    verifyResize(jpeg, 512, 0, scalteType, 512, 250);
    verifyResize(jpeg, 800, 0, scalteType, 800, 390);
    verifyResize(jpeg, 1024, 0, scalteType, 1024, 500);

    // Specify only height
    verifyResize(jpeg, 0, 250, scalteType, 512, 250);
    verifyResize(jpeg, 0, 391, scalteType, 800, 391);
    verifyResize(jpeg, 0, 500, scalteType, 1024, 500);

    // No resize
    verifyResize(jpeg, 0, 0, scalteType, 1024, 500);

    // Scale in X and Y independently, so that src matches dst exactly. This
    // may change the aspect ratio of the src.
    scalteType = ScaleType.FIT_XY;

    // Exact sizes
    verifyResize(jpeg, 512, 250, scalteType, 512, 250);
    verifyResize(jpeg, 511, 249, scalteType, 511, 249);
    verifyResize(jpeg, 1080, 500, scalteType, 1024, 500);
    verifyResize(jpeg, 500, 500, scalteType, 500, 500);

    // Specify only width
    verifyResize(jpeg, 512, 0, scalteType, 512, 500);
    verifyResize(jpeg, 800, 0, scalteType, 800, 500);
    verifyResize(jpeg, 1024, 0, scalteType, 1024, 500);

    // Specify only height
    verifyResize(jpeg, 0, 250, scalteType, 1024, 250);
    verifyResize(jpeg, 0, 391, scalteType, 1024, 391);
    verifyResize(jpeg, 0, 500, scalteType, 1024, 500);

    // No resize
    verifyResize(jpeg, 0, 0, scalteType, 1024, 500);
}
 
Example 5
Source File: ImageRequestTest.java    From product-emm with Apache License 2.0 4 votes vote down vote up
@Test public void parseNetworkResponse_resizing() throws Exception {
    // This is a horrible hack but Robolectric doesn't have a way to provide
    // width and height hints for decodeByteArray. It works because the byte array
    // "file:fake" is ASCII encodable and thus the name in Robolectric's fake
    // bitmap creator survives as-is, and provideWidthAndHeightHints puts
    // "file:" + name in its lookaside map. I write all this because it will
    // probably break mysteriously at some point and I feel terrible about your
    // having to debug it.
    byte[] jpegBytes = "file:fake".getBytes();
    ShadowBitmapFactory.provideWidthAndHeightHints("fake", 1024, 500);
    NetworkResponse jpeg = new NetworkResponse(jpegBytes);

    // Scale the image uniformly (maintain the image's aspect ratio) so that
    // both dimensions (width and height) of the image will be equal to or
    // less than the corresponding dimension of the view.
    ScaleType scalteType = ScaleType.CENTER_INSIDE;

    // Exact sizes
    verifyResize(jpeg, 512, 250, scalteType, 512, 250); // exactly half
    verifyResize(jpeg, 511, 249, scalteType, 509, 249); // just under half
    verifyResize(jpeg, 1080, 500, scalteType, 1024, 500); // larger
    verifyResize(jpeg, 500, 500, scalteType, 500, 244); // keep same ratio

    // Specify only width, preserve aspect ratio
    verifyResize(jpeg, 512, 0, scalteType, 512, 250);
    verifyResize(jpeg, 800, 0, scalteType, 800, 390);
    verifyResize(jpeg, 1024, 0, scalteType, 1024, 500);

    // Specify only height, preserve aspect ratio
    verifyResize(jpeg, 0, 250, scalteType, 512, 250);
    verifyResize(jpeg, 0, 391, scalteType, 800, 391);
    verifyResize(jpeg, 0, 500, scalteType, 1024, 500);

    // No resize
    verifyResize(jpeg, 0, 0, scalteType, 1024, 500);


    // Scale the image uniformly (maintain the image's aspect ratio) so that
    // both dimensions (width and height) of the image will be equal to or
    // larger than the corresponding dimension of the view.
    scalteType = ScaleType.CENTER_CROP;

    // Exact sizes
    verifyResize(jpeg, 512, 250, scalteType, 512, 250);
    verifyResize(jpeg, 511, 249, scalteType, 511, 249);
    verifyResize(jpeg, 1080, 500, scalteType, 1024, 500);
    verifyResize(jpeg, 500, 500, scalteType, 1024, 500);

    // Specify only width
    verifyResize(jpeg, 512, 0, scalteType, 512, 250);
    verifyResize(jpeg, 800, 0, scalteType, 800, 390);
    verifyResize(jpeg, 1024, 0, scalteType, 1024, 500);

    // Specify only height
    verifyResize(jpeg, 0, 250, scalteType, 512, 250);
    verifyResize(jpeg, 0, 391, scalteType, 800, 391);
    verifyResize(jpeg, 0, 500, scalteType, 1024, 500);

    // No resize
    verifyResize(jpeg, 0, 0, scalteType, 1024, 500);


    // Scale in X and Y independently, so that src matches dst exactly. This
    // may change the aspect ratio of the src.
    scalteType = ScaleType.FIT_XY;

    // Exact sizes
    verifyResize(jpeg, 512, 250, scalteType, 512, 250);
    verifyResize(jpeg, 511, 249, scalteType, 511, 249);
    verifyResize(jpeg, 1080, 500, scalteType, 1024, 500);
    verifyResize(jpeg, 500, 500, scalteType, 500, 500);

    // Specify only width
    verifyResize(jpeg, 512, 0, scalteType, 512, 500);
    verifyResize(jpeg, 800, 0, scalteType, 800, 500);
    verifyResize(jpeg, 1024, 0, scalteType, 1024, 500);

    // Specify only height
    verifyResize(jpeg, 0, 250, scalteType, 1024, 250);
    verifyResize(jpeg, 0, 391, scalteType, 1024, 391);
    verifyResize(jpeg, 0, 500, scalteType, 1024, 500);

    // No resize
    verifyResize(jpeg, 0, 0, scalteType, 1024, 500);
}
 
Example 6
Source File: ImageRequestTest.java    From product-emm with Apache License 2.0 4 votes vote down vote up
@Test public void parseNetworkResponse_resizing() throws Exception {
    // This is a horrible hack but Robolectric doesn't have a way to provide
    // width and height hints for decodeByteArray. It works because the byte array
    // "file:fake" is ASCII encodable and thus the name in Robolectric's fake
    // bitmap creator survives as-is, and provideWidthAndHeightHints puts
    // "file:" + name in its lookaside map. I write all this because it will
    // probably break mysteriously at some point and I feel terrible about your
    // having to debug it.
    byte[] jpegBytes = "file:fake".getBytes();
    ShadowBitmapFactory.provideWidthAndHeightHints("fake", 1024, 500);
    NetworkResponse jpeg = new NetworkResponse(jpegBytes);

    // Scale the image uniformly (maintain the image's aspect ratio) so that
    // both dimensions (width and height) of the image will be equal to or
    // less than the corresponding dimension of the view.
    ScaleType scalteType = ScaleType.CENTER_INSIDE;

    // Exact sizes
    verifyResize(jpeg, 512, 250, scalteType, 512, 250); // exactly half
    verifyResize(jpeg, 511, 249, scalteType, 509, 249); // just under half
    verifyResize(jpeg, 1080, 500, scalteType, 1024, 500); // larger
    verifyResize(jpeg, 500, 500, scalteType, 500, 244); // keep same ratio

    // Specify only width, preserve aspect ratio
    verifyResize(jpeg, 512, 0, scalteType, 512, 250);
    verifyResize(jpeg, 800, 0, scalteType, 800, 390);
    verifyResize(jpeg, 1024, 0, scalteType, 1024, 500);

    // Specify only height, preserve aspect ratio
    verifyResize(jpeg, 0, 250, scalteType, 512, 250);
    verifyResize(jpeg, 0, 391, scalteType, 800, 391);
    verifyResize(jpeg, 0, 500, scalteType, 1024, 500);

    // No resize
    verifyResize(jpeg, 0, 0, scalteType, 1024, 500);


    // Scale the image uniformly (maintain the image's aspect ratio) so that
    // both dimensions (width and height) of the image will be equal to or
    // larger than the corresponding dimension of the view.
    scalteType = ScaleType.CENTER_CROP;

    // Exact sizes
    verifyResize(jpeg, 512, 250, scalteType, 512, 250);
    verifyResize(jpeg, 511, 249, scalteType, 511, 249);
    verifyResize(jpeg, 1080, 500, scalteType, 1024, 500);
    verifyResize(jpeg, 500, 500, scalteType, 1024, 500);

    // Specify only width
    verifyResize(jpeg, 512, 0, scalteType, 512, 250);
    verifyResize(jpeg, 800, 0, scalteType, 800, 390);
    verifyResize(jpeg, 1024, 0, scalteType, 1024, 500);

    // Specify only height
    verifyResize(jpeg, 0, 250, scalteType, 512, 250);
    verifyResize(jpeg, 0, 391, scalteType, 800, 391);
    verifyResize(jpeg, 0, 500, scalteType, 1024, 500);

    // No resize
    verifyResize(jpeg, 0, 0, scalteType, 1024, 500);


    // Scale in X and Y independently, so that src matches dst exactly. This
    // may change the aspect ratio of the src.
    scalteType = ScaleType.FIT_XY;

    // Exact sizes
    verifyResize(jpeg, 512, 250, scalteType, 512, 250);
    verifyResize(jpeg, 511, 249, scalteType, 511, 249);
    verifyResize(jpeg, 1080, 500, scalteType, 1024, 500);
    verifyResize(jpeg, 500, 500, scalteType, 500, 500);

    // Specify only width
    verifyResize(jpeg, 512, 0, scalteType, 512, 500);
    verifyResize(jpeg, 800, 0, scalteType, 800, 500);
    verifyResize(jpeg, 1024, 0, scalteType, 1024, 500);

    // Specify only height
    verifyResize(jpeg, 0, 250, scalteType, 1024, 250);
    verifyResize(jpeg, 0, 391, scalteType, 1024, 391);
    verifyResize(jpeg, 0, 500, scalteType, 1024, 500);

    // No resize
    verifyResize(jpeg, 0, 0, scalteType, 1024, 500);
}
 
Example 7
Source File: ImageRequestTest.java    From CrossBow with Apache License 2.0 4 votes vote down vote up
@Test public void parseNetworkResponse_resizing() throws Exception {
    // This is a horrible hack but Robolectric doesn't have a way to provide
    // width and height hints for decodeByteArray. It works because the byte array
    // "file:fake" is ASCII encodable and thus the name in Robolectric's fake
    // bitmap creator survives as-is, and provideWidthAndHeightHints puts
    // "file:" + name in its lookaside map. I write all this because it will
    // probably break mysteriously at some point and I feel terrible about your
    // having to debug it.
    byte[] jpegBytes = "file:fake".getBytes();
    ShadowBitmapFactory.provideWidthAndHeightHints("fake", 1024, 500);
    NetworkResponse jpeg = new NetworkResponse(jpegBytes);

    // Scale the image uniformly (maintain the image's aspect ratio) so that
    // both dimensions (width and height) of the image will be equal to or
    // less than the corresponding dimension of the view.
    ScaleType scalteType = ScaleType.CENTER_INSIDE;

    // Exact sizes
    verifyResize(jpeg, 512, 250, scalteType, 512, 250); // exactly half
    verifyResize(jpeg, 511, 249, scalteType, 509, 249); // just under half
    verifyResize(jpeg, 1080, 500, scalteType, 1024, 500); // larger
    verifyResize(jpeg, 500, 500, scalteType, 500, 244); // keep same ratio

    // Specify only width, preserve aspect ratio
    verifyResize(jpeg, 512, 0, scalteType, 512, 250);
    verifyResize(jpeg, 800, 0, scalteType, 800, 390);
    verifyResize(jpeg, 1024, 0, scalteType, 1024, 500);

    // Specify only height, preserve aspect ratio
    verifyResize(jpeg, 0, 250, scalteType, 512, 250);
    verifyResize(jpeg, 0, 391, scalteType, 800, 391);
    verifyResize(jpeg, 0, 500, scalteType, 1024, 500);

    // No resize
    verifyResize(jpeg, 0, 0, scalteType, 1024, 500);


    // Scale the image uniformly (maintain the image's aspect ratio) so that
    // both dimensions (width and height) of the image will be equal to or
    // larger than the corresponding dimension of the view.
    scalteType = ScaleType.CENTER_CROP;

    // Exact sizes
    verifyResize(jpeg, 512, 250, scalteType, 512, 250);
    verifyResize(jpeg, 511, 249, scalteType, 511, 249);
    verifyResize(jpeg, 1080, 500, scalteType, 1024, 500);
    verifyResize(jpeg, 500, 500, scalteType, 1024, 500);

    // Specify only width
    verifyResize(jpeg, 512, 0, scalteType, 512, 250);
    verifyResize(jpeg, 800, 0, scalteType, 800, 390);
    verifyResize(jpeg, 1024, 0, scalteType, 1024, 500);

    // Specify only height
    verifyResize(jpeg, 0, 250, scalteType, 512, 250);
    verifyResize(jpeg, 0, 391, scalteType, 800, 391);
    verifyResize(jpeg, 0, 500, scalteType, 1024, 500);

    // No resize
    verifyResize(jpeg, 0, 0, scalteType, 1024, 500);


    // Scale in X and Y independently, so that src matches dst exactly. This
    // may change the aspect ratio of the src.
    scalteType = ScaleType.FIT_XY;

    // Exact sizes
    verifyResize(jpeg, 512, 250, scalteType, 512, 250);
    verifyResize(jpeg, 511, 249, scalteType, 511, 249);
    verifyResize(jpeg, 1080, 500, scalteType, 1024, 500);
    verifyResize(jpeg, 500, 500, scalteType, 500, 500);

    // Specify only width
    verifyResize(jpeg, 512, 0, scalteType, 512, 500);
    verifyResize(jpeg, 800, 0, scalteType, 800, 500);
    verifyResize(jpeg, 1024, 0, scalteType, 1024, 500);

    // Specify only height
    verifyResize(jpeg, 0, 250, scalteType, 1024, 250);
    verifyResize(jpeg, 0, 391, scalteType, 1024, 391);
    verifyResize(jpeg, 0, 500, scalteType, 1024, 500);

    // No resize
    verifyResize(jpeg, 0, 0, scalteType, 1024, 500);
}