use of com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser in project glide by bumptech.
the class ExifTest method testIssue387.
@Test
public void testIssue387() throws IOException {
InputStream is = TestResourceUtil.openResource(getClass(), "issue387_rotated_jpeg.jpg");
assertThat(new DefaultImageHeaderParser().getOrientation(is, byteArrayPool)).isEqualTo(6);
}
use of com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser in project glide by bumptech.
the class ByteBufferGifDecoderTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
gifHeader = Mockito.spy(new GifHeader());
when(parser.parseHeader()).thenReturn(gifHeader);
when(parserPool.obtain(isA(ByteBuffer.class))).thenReturn(parser);
when(decoderFactory.build(isA(GifDecoder.BitmapProvider.class), eq(gifHeader), isA(ByteBuffer.class), anyInt())).thenReturn(gifDecoder);
List<ImageHeaderParser> parsers = new ArrayList<ImageHeaderParser>();
parsers.add(new DefaultImageHeaderParser());
options = new Options();
decoder = new ByteBufferGifDecoder(RuntimeEnvironment.application, parsers, bitmapPool, new LruArrayPool(ARRAY_POOL_SIZE_BYTES), parserPool, decoderFactory);
}
use of com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser in project glide by bumptech.
the class ExifOrientationStreamTest method testIncludesGivenExifOrientation.
@Test
public void testIncludesGivenExifOrientation() throws IOException {
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
InputStream toWrap = openOrientationExample(true, /*isLandscape*/
j + 1);
InputStream wrapped = new ExifOrientationStream(toWrap, i);
DefaultImageHeaderParser parser = new DefaultImageHeaderParser();
assertThat(parser.getOrientation(wrapped, byteArrayPool)).isEqualTo(i);
toWrap = openOrientationExample(false, /*isLandscape*/
j + 1);
wrapped = new ExifOrientationStream(toWrap, i);
assertThat(parser.getOrientation(wrapped, byteArrayPool)).isEqualTo(i);
}
}
}
use of com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser in project glide by bumptech.
the class ExifTest method assertOrientation.
private void assertOrientation(String filePrefix, int expectedOrientation) {
InputStream is = null;
try {
is = open(filePrefix + "_" + expectedOrientation + ".jpg");
assertEquals(new DefaultImageHeaderParser().getOrientation(is, byteArrayPool), expectedOrientation);
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
// Do nothing.
}
}
}
}
use of com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser in project glide by bumptech.
the class StreamGifDecoderTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
List<ImageHeaderParser> parsers = new ArrayList<ImageHeaderParser>();
parsers.add(new DefaultImageHeaderParser());
decoder = new StreamGifDecoder(parsers, byteBufferDecoder, new LruArrayPool());
options = new Options();
}
Aggregations