use of com.facebook.imagepipeline.testing.TrivialPooledByteBuffer in project fresco by facebook.
the class ProgressiveJpegParserTest method testOnShortestJpeg.
@Test
public void testOnShortestJpeg() {
final TrivialPooledByteBuffer shortByteBuffer = new TrivialPooledByteBuffer(new byte[] { (byte) 0xff, (byte) 0xd8 });
assertFalse(mProgressiveJpegParser.parseMoreData(buildEncodedImage(shortByteBuffer)));
assertTrue(mProgressiveJpegParser.isJpeg());
assertEquals(0, mProgressiveJpegParser.getBestScanEndOffset());
assertEquals(0, mProgressiveJpegParser.getBestScanNumber());
}
use of com.facebook.imagepipeline.testing.TrivialPooledByteBuffer in project fresco by facebook.
the class ProgressiveJpegParserTest method testOnTooShortImage.
@Test
public void testOnTooShortImage() {
final TrivialPooledByteBuffer shortByteBuffer = new TrivialPooledByteBuffer(new byte[] { (byte) 0xff });
assertFalse(mProgressiveJpegParser.isJpeg());
assertFalse(mProgressiveJpegParser.parseMoreData(buildEncodedImage(shortByteBuffer)));
assertFalse(mProgressiveJpegParser.isJpeg());
assertEquals(0, mProgressiveJpegParser.getBestScanEndOffset());
assertEquals(0, mProgressiveJpegParser.getBestScanNumber());
}
use of com.facebook.imagepipeline.testing.TrivialPooledByteBuffer in project fresco by facebook.
the class ProgressiveJpegParserTest method testOnWebp.
@Test
public void testOnWebp() {
final TrivialPooledByteBuffer byteBuffer = new TrivialPooledByteBuffer(mWebpBytes);
mProgressiveJpegParser.parseMoreData(buildEncodedImage(byteBuffer));
assertFalse(mProgressiveJpegParser.isJpeg());
}
use of com.facebook.imagepipeline.testing.TrivialPooledByteBuffer in project fresco by facebook.
the class PooledByteBufferInputStreamTest method testCreatingStreamAfterClose.
@Test(expected = IllegalArgumentException.class)
public void testCreatingStreamAfterClose() {
PooledByteBuffer buffer = new TrivialPooledByteBuffer(new byte[] {});
buffer.close();
new PooledByteBufferInputStream(buffer);
}
use of com.facebook.imagepipeline.testing.TrivialPooledByteBuffer in project fresco by facebook.
the class PooledByteBufferInputStreamTest method testCreateEmptyStream.
@Test
public void testCreateEmptyStream() throws Exception {
PooledByteBufferInputStream is = new PooledByteBufferInputStream(new TrivialPooledByteBuffer(new byte[] {}));
assertEquals(-1, is.read());
}
Aggregations