Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add signature #179

Merged
merged 2 commits into from
Oct 9, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.bumptech.glide;

import android.graphics.Bitmap;

import com.bumptech.glide.load.model.ModelLoader;
import com.bumptech.glide.load.resource.transcode.ResourceTranscoder;
import com.bumptech.glide.manager.Lifecycle;
import com.bumptech.glide.manager.RequestTracker;
import com.bumptech.glide.provider.DataLoadProvider;
import com.bumptech.glide.provider.LoadProvider;
import com.bumptech.glide.tests.GlideShadowLooper;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -36,10 +34,14 @@ public class BitmapTypeRequestTest {
public void setUp() {
optionsApplier = mock(RequestManager.OptionsApplier.class);
when(optionsApplier.apply(anyObject(), any(GenericRequestBuilder.class))).thenAnswer(arg(1));
Glide glide = mock(Glide.class);
when(glide.buildTranscoder(any(Class.class), any(Class.class))).thenReturn(mock(ResourceTranscoder.class));
when(glide.buildDataProvider(any(Class.class), any(Class.class))).thenReturn(mock(DataLoadProvider.class));

model = "testModel";
request = new BitmapTypeRequest(Robolectric.application, model, mock(ModelLoader.class),
mock(ModelLoader.class), Glide.get(Robolectric.application), mock(RequestTracker.class),
mock(Lifecycle.class), optionsApplier);
GenericRequestBuilder original = new GenericRequestBuilder(Robolectric.application, model,
mock(LoadProvider.class), null, glide, null, null);
request = new BitmapTypeRequest(original, mock(ModelLoader.class), mock(ModelLoader.class), optionsApplier);
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.bumptech.glide.manager.Lifecycle;
import com.bumptech.glide.manager.RequestTracker;
import com.bumptech.glide.tests.GlideShadowLooper;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -34,9 +33,9 @@ public void setUp() {
optionsApplier = mock(RequestManager.OptionsApplier.class);
when(optionsApplier.apply(anyObject(), any(GenericRequestBuilder.class))).thenAnswer(arg(1));
model = "testModel";
request = new DrawableTypeRequest<String>(model, mock(ModelLoader.class), mock(ModelLoader.class),
Robolectric.application, Glide.get(Robolectric.application), mock(RequestTracker.class),
mock(Lifecycle.class), optionsApplier);
request = new DrawableTypeRequest<String>(model, mock(ModelLoader.class),
mock(ModelLoader.class), Robolectric.application, Glide.get(Robolectric.application),
mock(RequestTracker.class), mock(Lifecycle.class), optionsApplier);
}

@After
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.bumptech.glide;

import android.widget.ImageView;

import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.ResourceEncoder;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
Expand All @@ -12,7 +11,6 @@
import com.bumptech.glide.request.animation.GlideAnimationFactory;
import com.bumptech.glide.request.target.Target;
import com.bumptech.glide.tests.BackgroundUtil;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -38,8 +36,7 @@ public void setUp() {

@Test(expected = NullPointerException.class)
public void testThrowsIfContextIsNull() {
new GenericRequestBuilder(null,
new Object(), mock(LoadProvider.class), Object.class, mock(Glide.class),
new GenericRequestBuilder(null, new Object(), mock(LoadProvider.class), Object.class, mock(Glide.class),
requestTracker, mock(Lifecycle.class));
}

Expand Down Expand Up @@ -76,8 +73,8 @@ public void testThrowsWhenOverrideHeightEqualToZero() {

@Test
public void testDoesNotThrowWhenModelAndLoaderNull() {
new GenericRequestBuilder(Robolectric.application, null, null, Object.class, mock(Glide.class),
requestTracker, mock(Lifecycle.class));
new GenericRequestBuilder(Robolectric.application, null, null, Object.class, mock(Glide.class), requestTracker,
mock(Lifecycle.class));
}

@Test
Expand Down Expand Up @@ -159,7 +156,7 @@ private GenericRequestBuilder getNullModelRequest() {
Glide glide = mock(Glide.class);
when(glide.buildImageViewTarget(any(ImageView.class), any(Class.class))).thenReturn(
mock(Target.class));
return new GenericRequestBuilder(Robolectric.application, null, null, Object.class,
glide, requestTracker, mock(Lifecycle.class));
return new GenericRequestBuilder(Robolectric.application, null, null, Object.class, glide, requestTracker,
mock(Lifecycle.class));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.bumptech.glide.manager.Lifecycle;
import com.bumptech.glide.manager.RequestTracker;
import com.bumptech.glide.tests.GlideShadowLooper;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -36,8 +35,8 @@ public void setUp() {
when(optionsApplier.apply(anyObject(), any(GenericRequestBuilder.class))).thenAnswer(arg(1));
model = "testModel";
request = new GenericTranscodeRequest<String, Object, Object>(Robolectric.application,
Glide.get(Robolectric.application), model, mock(ModelLoader.class), Object.class, Object.class,
mock(RequestTracker.class), mock(Lifecycle.class), optionsApplier);
Glide.get(Robolectric.application), model, mock(ModelLoader.class), Object.class,
Object.class, mock(RequestTracker.class), mock(Lifecycle.class), optionsApplier);
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
import com.bumptech.glide.load.model.ModelLoader;
import com.bumptech.glide.load.resource.gif.GifDrawable;
import com.bumptech.glide.load.resource.transcode.ResourceTranscoder;
import com.bumptech.glide.manager.Lifecycle;
import com.bumptech.glide.manager.RequestTracker;
import com.bumptech.glide.provider.DataLoadProvider;
import com.bumptech.glide.provider.LoadProvider;
import com.bumptech.glide.tests.GlideShadowLooper;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -37,9 +36,15 @@ public class GifTypeRequestTest {
public void setUp() {
optionsApplier = mock(RequestManager.OptionsApplier.class);
when(optionsApplier.apply(anyObject(), any(GenericRequestBuilder.class))).thenAnswer(arg(1));

Glide glide = mock(Glide.class);
when(glide.buildTranscoder(any(Class.class), any(Class.class))).thenReturn(mock(ResourceTranscoder.class));
when(glide.buildDataProvider(any(Class.class), any(Class.class))).thenReturn(mock(DataLoadProvider.class));

model = "testModel";
request = new GifTypeRequest<String>(Robolectric.application, model, mock(ModelLoader.class),
Glide.get(Robolectric.application), mock(RequestTracker.class), mock(Lifecycle.class), optionsApplier);
GenericRequestBuilder original = new GenericRequestBuilder(Robolectric.application, model,
mock(LoadProvider.class), null, glide, null, null);
request = new GifTypeRequest<String>(original, mock(ModelLoader.class), optionsApplier);
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ public void testDoesNotThrowIfCleanupWithNullInputStream() {
public void testContainsAllRelevantPartsInId() {
String id = harness.get().getId();
assertThat(id, containsString(harness.uri.toString()));
assertThat(id, containsString(harness.mimeType));
assertThat(id, containsString(String.valueOf(harness.dateModified)));
assertThat(id, containsString(String.valueOf(harness.orientation)));
}

@SuppressWarnings("unchecked")
Expand All @@ -100,9 +97,6 @@ private static class Harness {
DataFetcher<InputStream> defaultFetcher = mock(DataFetcher.class);
int width = 123;
int height = 222;
String mimeType = "image/jpeg";
long dateModified = 1234123;
int orientation = 9;

MediaStoreThumbFetcher.ThumbnailStreamOpenerFactory factory = mock(
MediaStoreThumbFetcher.ThumbnailStreamOpenerFactory.class);
Expand All @@ -114,8 +108,7 @@ public Harness() {
}

public MediaStoreThumbFetcher get() {
return new MediaStoreThumbFetcher(Robolectric.application, uri, defaultFetcher, width, height, mimeType,
dateModified, orientation, factory);
return new MediaStoreThumbFetcher(Robolectric.application, uri, defaultFetcher, width, height, factory);
}
}
}
Loading