use of com.airbnb.lottie.parser.moshi.JsonReader in project lottie-android by airbnb.
the class LottieCompositionFactoryTest method testZeroCacheWorks.
@Test
public void testZeroCacheWorks() {
JsonReader reader = JsonReader.of(buffer(source(getNeverCompletingInputStream())));
LottieCompositionFactory.setMaxCacheSize(1);
LottieResult<LottieComposition> taskFoo1 = LottieCompositionFactory.fromJsonReaderSync(reader, "foo");
LottieResult<LottieComposition> taskFoo2 = LottieCompositionFactory.fromJsonReaderSync(reader, "foo");
assertNotSame(taskFoo1, taskFoo2);
}
use of com.airbnb.lottie.parser.moshi.JsonReader in project lottie-android by airbnb.
the class LottieCompositionFactoryTest method testLoadJsonReader.
@Test
public void testLoadJsonReader() {
JsonReader reader = JsonReader.of(buffer(source(new ByteArrayInputStream(JSON.getBytes()))));
LottieResult<LottieComposition> result = LottieCompositionFactory.fromJsonReaderSync(reader, "json");
assertNull(result.getException());
assertNotNull(result.getValue());
}
use of com.airbnb.lottie.parser.moshi.JsonReader in project lottie-android by airbnb.
the class LottieCompositionFactoryTest method testNullMultipleTimesAsync.
@Test
public void testNullMultipleTimesAsync() {
JsonReader reader = JsonReader.of(buffer(source(getNeverCompletingInputStream())));
LottieTask<LottieComposition> task1 = LottieCompositionFactory.fromJsonReader(reader, null);
LottieTask<LottieComposition> task2 = LottieCompositionFactory.fromJsonReader(reader, null);
assertNotSame(task1, task2);
}
use of com.airbnb.lottie.parser.moshi.JsonReader in project lottie-android by airbnb.
the class LottieCompositionFactoryTest method testLoadInvalidJsonReader.
@Test
public void testLoadInvalidJsonReader() {
JsonReader reader = JsonReader.of(buffer(source(new ByteArrayInputStream(NOT_JSON.getBytes()))));
LottieResult<LottieComposition> result = LottieCompositionFactory.fromJsonReaderSync(reader, "json");
assertNotNull(result.getException());
assertNull(result.getValue());
}
use of com.airbnb.lottie.parser.moshi.JsonReader in project lottie-android by airbnb.
the class LottieCompositionFactoryTest method testNullMultipleTimesSync.
@Test
public void testNullMultipleTimesSync() {
JsonReader reader = JsonReader.of(buffer(source(getNeverCompletingInputStream())));
LottieResult<LottieComposition> task1 = LottieCompositionFactory.fromJsonReaderSync(reader, null);
LottieResult<LottieComposition> task2 = LottieCompositionFactory.fromJsonReaderSync(reader, null);
assertNotSame(task1, task2);
}
Aggregations