use of com.bumptech.glide.load.Options in project glide by bumptech.
the class StreamEncoderTest method testWritesDataFromInputStreamToOutputStream.
@Test
public void testWritesDataFromInputStreamToOutputStream() throws IOException {
String fakeData = "SomeRandomFakeData";
ByteArrayInputStream is = new ByteArrayInputStream(fakeData.getBytes("UTF-8"));
encoder.encode(is, file, new Options());
byte[] data = ByteBufferUtil.toBytes(ByteBufferUtil.fromFile(file));
assertEquals(fakeData, new String(data, "UTF-8"));
}
use of com.bumptech.glide.load.Options in project glide by bumptech.
the class AssetUriLoaderTest method testHandlesAssetUris.
@Test
public void testHandlesAssetUris() {
Uri assetUri = Uri.parse("file:///android_asset/assetName");
when(factory.buildFetcher(any(AssetManager.class), eq("assetName"))).thenReturn(fetcher);
assertTrue(loader.handles(assetUri));
assertEquals(fetcher, Preconditions.checkNotNull(loader.buildLoadData(assetUri, IMAGE_SIDE, IMAGE_SIDE, new Options())).fetcher);
}
use of com.bumptech.glide.load.Options in project glide by bumptech.
the class DataUrlLoaderTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
DataUrlLoader.StreamFactory<String> factory = new DataUrlLoader.StreamFactory<>();
options = new Options();
dataUrlLoader = (DataUrlLoader<String, InputStream>) factory.build(multiFactory);
fetcher = dataUrlLoader.buildLoadData(VALID_PNG, -1, -1, options).fetcher;
}
use of com.bumptech.glide.load.Options in project glide by bumptech.
the class ResourceLoaderTest method testCanHandleId.
@Test
public void testCanHandleId() {
int id = android.R.drawable.star_off;
Uri contentUri = Uri.parse("android.resource://android/drawable/star_off");
when(uriLoader.buildLoadData(eq(contentUri), anyInt(), anyInt(), any(Options.class))).thenReturn(new ModelLoader.LoadData<>(key, fetcher));
assertTrue(loader.handles(id));
assertEquals(fetcher, Preconditions.checkNotNull(loader.buildLoadData(id, 100, 100, new Options())).fetcher);
}
use of com.bumptech.glide.load.Options in project glide by bumptech.
the class StringLoaderTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
options = new Options();
when(uriLoader.handles(any(Uri.class))).thenReturn(true);
loader = new StringLoader<>(uriLoader);
}
Aggregations