Example #1
0
 public void Open_Uri_Async_Fail_Bad_Uri()
 {
     Assert.CatchAsync(async() =>
     {
         DotLottie lottie = await DotLottie.OpenAsync(sampleFakeDotLottie);
     });
 }
Example #2
0
        public async Task Open_Uri_Async()
        {
            //Try parse a lottie
            DotLottie lottie = await DotLottie.OpenAsync(sampleDotLottie);

            Assert.Pass();
        }
Example #3
0
        public async Task Open_Uri_Sync()
        {
            //Try parse a lottie
            DotLottie lottie = DotLottie.Open(sampleDotLottie);

            Assert.Pass();
        }
Example #4
0
        public async Task Open_File_Async()
        {
            //Try parse a lottie
            var       stream = File.OpenRead("Lotties/animation-external-image.lottie");
            DotLottie lottie = await DotLottie.OpenAsync(stream);

            Assert.Pass();
        }
Example #5
0
        public async Task Temp_Open_Dotlottie_And_Save()
        {
            var stream = File.OpenRead("Lotties/animation-external-image.lottie");
            var ms     = new MemoryStream();

            stream.CopyTo(ms);

            DotLottie lottie = await DotLottie.OpenAsync(stream);

            var existingData = ms.GetBuffer();
            var exportedData = lottie.GetData();

            File.WriteAllBytes("temp.lottie", exportedData);
        }
Example #6
0
        public async Task Add_Animation_Check_Images_Parsed()
        {
            var lottie = await DotLottie.OpenAsync(sampleDotLottie);

            var filename   = "Lotties/animation-inline-image.json";
            var jsonLottie = File.ReadAllText(filename);

            var localFileName = Path.GetFileName(filename);
            var nakedFileName = Path.GetFileNameWithoutExtension(localFileName);

            lottie.AddAnimation(localFileName, true, 1.5f, "ffffff", jsonLottie);

            Assert.True(lottie.Animations.ContainsKey(localFileName));
            Assert.True(lottie.Manifest.Animations.Any(x => x.Id == nakedFileName));
        }