Search in sources :

Example 6 with Request

use of com.squareup.picasso.Request in project picasso by square.

the class PollexorRequestTransformerTest method nonHttpRequestsAreNotTransformed.

@Test
public void nonHttpRequestsAreNotTransformed() {
    Request input = new Request.Builder(IMAGE_URI).build();
    Request output = transformer.transformRequest(input);
    assertThat(output).isSameAs(input);
}
Also used : Request(com.squareup.picasso.Request) Test(org.junit.Test)

Example 7 with Request

use of com.squareup.picasso.Request in project picasso by square.

the class PollexorRequestTransformerTest method simpleResizeWithCenterInsideAndEncryption.

@Test
public void simpleResizeWithCenterInsideAndEncryption() {
    Request input = new Request.Builder(IMAGE_URI).resize(50, 50).centerInside().build();
    Request output = secureTransformer.transformRequest(input);
    assertThat(output).isNotSameAs(input);
    assertThat(output.hasSize()).isFalse();
    assertThat(output.centerInside).isFalse();
    String expected = Thumbor.create(HOST, KEY).buildImage(IMAGE).resize(50, 50).fitIn().toUrl();
    assertThat(output.uri.toString()).isEqualTo(expected);
}
Also used : Request(com.squareup.picasso.Request) Test(org.junit.Test)

Example 8 with Request

use of com.squareup.picasso.Request in project picasso by square.

the class PollexorRequestTransformerTest method simpleResizeWithEncryption.

@Test
public void simpleResizeWithEncryption() {
    Request input = new Request.Builder(IMAGE_URI).resize(50, 50).build();
    Request output = secureTransformer.transformRequest(input);
    assertThat(output).isNotSameAs(input);
    assertThat(output.hasSize()).isFalse();
    String expected = Thumbor.create(HOST, KEY).buildImage(IMAGE).resize(50, 50).toUrl();
    assertThat(output.uri.toString()).isEqualTo(expected);
}
Also used : ThumborUrlBuilder(com.squareup.pollexor.ThumborUrlBuilder) Request(com.squareup.picasso.Request) Test(org.junit.Test)

Example 9 with Request

use of com.squareup.picasso.Request in project picasso by square.

the class PollexorRequestTransformerTest method simpleResize.

@Test
public void simpleResize() {
    Request input = new Request.Builder(IMAGE_URI).resize(50, 50).build();
    Request output = transformer.transformRequest(input);
    assertThat(output).isNotSameAs(input);
    assertThat(output.hasSize()).isFalse();
    String expected = Thumbor.create(HOST).buildImage(IMAGE).resize(50, 50).toUrl();
    assertThat(output.uri.toString()).isEqualTo(expected);
}
Also used : ThumborUrlBuilder(com.squareup.pollexor.ThumborUrlBuilder) Request(com.squareup.picasso.Request) Test(org.junit.Test)

Example 10 with Request

use of com.squareup.picasso.Request in project picasso by square.

the class PollexorRequestTransformerTest method simpleResizeWithCenterCrop.

@Test
public void simpleResizeWithCenterCrop() {
    Request input = new Request.Builder(IMAGE_URI).resize(50, 50).centerCrop().build();
    Request output = transformer.transformRequest(input);
    assertThat(output).isNotSameAs(input);
    assertThat(output.hasSize()).isFalse();
    assertThat(output.centerCrop).isFalse();
    String expected = Thumbor.create(HOST).buildImage(IMAGE).resize(50, 50).toUrl();
    assertThat(output.uri.toString()).isEqualTo(expected);
}
Also used : Request(com.squareup.picasso.Request) Test(org.junit.Test)

Aggregations

Request (com.squareup.picasso.Request)11 Test (org.junit.Test)9 ThumborUrlBuilder (com.squareup.pollexor.ThumborUrlBuilder)4 Uri (android.net.Uri)1 CacheControl (okhttp3.CacheControl)1 Config (org.robolectric.annotation.Config)1