Search in sources :

Example 11 with MemoryFile

use of android.os.MemoryFile in project fresco by facebook.

the class WebpDecodingTest method test_webp_extended_decoding_filedescriptor_bitmap.

@Test
public void test_webp_extended_decoding_filedescriptor_bitmap() throws Throwable {
    final MemoryFile memoryFile = getMemoryFile("webp_e.webp");
    final Bitmap bitmap = mWebpBitmapFactory.decodeFileDescriptor(getMemoryFileDescriptor(memoryFile), null, null);
    memoryFile.close();
    assertBitmap(bitmap, 480, 320);
}
Also used : MemoryFile(android.os.MemoryFile) Bitmap(android.graphics.Bitmap) Test(org.junit.Test)

Example 12 with MemoryFile

use of android.os.MemoryFile in project robolectric by robolectric.

the class ShadowSensorManagerTest method createDirectChannel.

@Test
@Config(minSdk = Build.VERSION_CODES.O)
public void createDirectChannel() throws Exception {
    SensorDirectChannel channel = sensorManager.createDirectChannel(new MemoryFile("name", 10));
    assertThat(channel.isOpen()).isTrue();
    channel.close();
    assertThat(channel.isOpen()).isFalse();
}
Also used : MemoryFile(android.os.MemoryFile) SensorDirectChannel(android.hardware.SensorDirectChannel) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Aggregations

MemoryFile (android.os.MemoryFile)12 Bitmap (android.graphics.Bitmap)5 Test (org.junit.Test)5 IOException (java.io.IOException)3 InputStream (java.io.InputStream)2 OutputStream (java.io.OutputStream)2 AssetFileDescriptor (android.content.res.AssetFileDescriptor)1 Cursor (android.database.Cursor)1 SensorDirectChannel (android.hardware.SensorDirectChannel)1 PooledByteBufferInputStream (com.facebook.common.memory.PooledByteBufferInputStream)1 LimitedInputStream (com.facebook.common.streams.LimitedInputStream)1 FileDescriptor (java.io.FileDescriptor)1 FileNotFoundException (java.io.FileNotFoundException)1 Config (org.robolectric.annotation.Config)1