3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 using System.Collections.Generic;
8 namespace Tizen.NUI.Devel.Tests
10 using tlog = Tizen.Log;
13 [Description("public/BaseComponents/LottieAnimationView")]
14 public class PublicLottieAnimationViewTest
16 private const string tag = "NUITEST";
17 private string url = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/picture.png";
18 private string lottieFilePath = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/lottie.json";
23 tlog.Info(tag, "Init() is called!");
29 tlog.Info(tag, "Destroy() is called!");
34 [Description("LottieAnimationView URL.")]
35 [Property("SPEC", "Tizen.NUI.LottieAnimationView.URL A")]
36 [Property("SPEC_URL", "-")]
37 [Property("CRITERIA", "PRW")]
38 [Property("AUTHOR", "guowei.wang@samsung.com")]
39 public void LottieAnimationViewURL()
41 tlog.Debug(tag, $"LottieAnimationViewURL START");
43 using (Uint16Pair size = new Uint16Pair(40, 60))
45 var testingTarget = new LottieAnimationView(1.0f, true);
46 Assert.IsNotNull(testingTarget, "Can't create success object LottieAnimationView");
47 Assert.IsInstanceOf<LottieAnimationView>(testingTarget, "Should be an instance of LottieAnimationView type.");
49 testingTarget.URL = lottieFilePath;
53 var result = testingTarget.URL;
57 tlog.Debug(tag, e.Message.ToString());
58 Assert.Fail("Caught Exception: Failed!");
61 testingTarget.Dispose();
64 tlog.Debug(tag, $"LottieAnimationViewURL END (OK)");
69 [Description("LottieAnimationView RedrawInScalingDown.")]
70 [Property("SPEC", "Tizen.NUI.LottieAnimationView.RedrawInScalingDown A")]
71 [Property("SPEC_URL", "-")]
72 [Property("CRITERIA", "PRW")]
73 [Property("AUTHOR", "guowei.wang@samsung.com")]
74 public void LottieAnimationViewRedrawInScalingDown()
76 tlog.Debug(tag, $"LottieAnimationViewRedrawInScalingDown START");
78 using (Uint16Pair size = new Uint16Pair(40, 60))
80 var testingTarget = new LottieAnimationView(1.0f, true);
81 Assert.IsNotNull(testingTarget, "Can't create success object LottieAnimationView");
82 Assert.IsInstanceOf<LottieAnimationView>(testingTarget, "Should be an instance of LottieAnimationView type.");
84 testingTarget.URL = lottieFilePath;
86 PropertyMap map = new PropertyMap();
87 map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image))
88 .Add(ImageVisualProperty.URL, new PropertyValue(url))
89 .Add(ImageVisualProperty.LoopCount, new PropertyValue(2));
90 testingTarget.Image = map;
92 testingTarget.RedrawInScalingDown = true;
93 Assert.IsTrue(testingTarget.RedrawInScalingDown);
95 testingTarget.Dispose();
98 tlog.Debug(tag, $"LottieAnimationViewRedrawInScalingDown END (OK)");
103 [Description("LottieAnimationView SetMinMaxFrameByMarker.")]
104 [Property("SPEC", "Tizen.NUI.LottieAnimationView.SetMinMaxFrameByMarker M")]
105 [Property("SPEC_URL", "-")]
106 [Property("CRITERIA", "MR")]
107 [Property("AUTHOR", "guowei.wang@samsung.com")]
108 public void LottieAnimationViewSetMinMaxFrameByMarker()
110 tlog.Debug(tag, $"LottieAnimationViewSetMinMaxFrameByMarker START");
112 var testingTarget = new LottieAnimationView();
113 Assert.IsNotNull(testingTarget, "Can't create success object LottieAnimationView");
114 Assert.IsInstanceOf<LottieAnimationView>(testingTarget, "Should be an instance of LottieAnimationView type.");
116 testingTarget.URL = lottieFilePath;
118 string maker = "startframe: 1; endframe: 10";
122 testingTarget.SetMinMaxFrameByMarker(maker, null);
126 tlog.Debug(tag, e.Message.ToString());
127 Assert.Fail("Caught Exception: Failed!");
130 tlog.Debug(tag, $"LottieAnimationViewSetMinMaxFrameByMarker END (OK)");
135 [Description("LottieAnimationView GetMinMaxFrame.")]
136 [Property("SPEC", "Tizen.NUI.LottieAnimationView.GetMinMaxFrame M")]
137 [Property("SPEC_URL", "-")]
138 [Property("CRITERIA", "MR")]
139 [Property("AUTHOR", "guowei.wang@samsung.com")]
140 public void LottieAnimationViewGetMinMaxFrame()
142 tlog.Debug(tag, $"LottieAnimationViewGetMinMaxFrame START");
144 var testingTarget = new LottieAnimationView();
145 Assert.IsNotNull(testingTarget, "Can't create success object LottieAnimationView");
146 Assert.IsInstanceOf<LottieAnimationView>(testingTarget, "Should be an instance of LottieAnimationView type.");
148 testingTarget.URL = lottieFilePath;
150 PropertyMap map = new PropertyMap();
151 map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image))
152 .Add(ImageVisualProperty.URL, new PropertyValue(url))
153 .Add(ImageVisualProperty.LoopCount, new PropertyValue(2))
154 .Add(ImageVisualProperty.PlayRange, new PropertyValue(50));
155 testingTarget.Image = map;
157 string maker = "startframe: 1; endframe: 10";
158 testingTarget.SetMinMaxFrameByMarker(maker, null);
162 testingTarget.GetMinMaxFrame();
166 tlog.Debug(tag, e.Message.ToString());
167 Assert.Fail("Caught Exception: Failed!");
170 tlog.Debug(tag, $"LottieAnimationViewGetMinMaxFrame END (OK)");
175 [Description("LottieAnimationView Finished.")]
176 [Property("SPEC", "Tizen.NUI.LottieAnimationView.Finished M")]
177 [Property("SPEC_URL", "-")]
178 [Property("CRITERIA", "MR")]
179 [Property("AUTHOR", "guowei.wang@samsung.com")]
180 public void LottieAnimationViewFinished()
182 tlog.Debug(tag, $"LottieAnimationViewFinished START");
184 var testingTarget = new LottieAnimationView();
185 Assert.IsNotNull(testingTarget, "Can't create success object LottieAnimationView");
186 Assert.IsInstanceOf<LottieAnimationView>(testingTarget, "Should be an instance of LottieAnimationView type.");
188 testingTarget.URL = lottieFilePath;
189 NUIApplication.GetDefaultWindow().GetDefaultLayer().Add(testingTarget);
191 testingTarget.Finished += OnFinishedEvent;
192 testingTarget.Finished -= OnFinishedEvent;
194 NUIApplication.GetDefaultWindow().GetDefaultLayer().Remove(testingTarget);
196 testingTarget.Dispose();
197 tlog.Debug(tag, $"LottieAnimationViewFinished END (OK)");
200 public void OnFinishedEvent(object sender, EventArgs e)