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!");
62 tlog.Debug(tag, $"LottieAnimationViewURL END (OK)");
67 [Description("LottieAnimationView RedrawInScalingDown.")]
68 [Property("SPEC", "Tizen.NUI.LottieAnimationView.RedrawInScalingDown A")]
69 [Property("SPEC_URL", "-")]
70 [Property("CRITERIA", "PRW")]
71 [Property("AUTHOR", "guowei.wang@samsung.com")]
72 public void LottieAnimationViewRedrawInScalingDown()
74 tlog.Debug(tag, $"LottieAnimationViewRedrawInScalingDown START");
76 using (Uint16Pair size = new Uint16Pair(40, 60))
78 var testingTarget = new LottieAnimationView(1.0f, true);
79 Assert.IsNotNull(testingTarget, "Can't create success object LottieAnimationView");
80 Assert.IsInstanceOf<LottieAnimationView>(testingTarget, "Should be an instance of LottieAnimationView type.");
82 testingTarget.URL = lottieFilePath;
84 PropertyMap map = new PropertyMap();
85 map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image))
86 .Add(ImageVisualProperty.URL, new PropertyValue(url))
87 .Add(ImageVisualProperty.LoopCount, new PropertyValue(2));
88 testingTarget.Image = map;
90 testingTarget.RedrawInScalingDown = true;
91 Assert.IsTrue(testingTarget.RedrawInScalingDown);
94 tlog.Debug(tag, $"LottieAnimationViewRedrawInScalingDown END (OK)");
99 [Description("LottieAnimationView SetMinMaxFrameByMarker.")]
100 [Property("SPEC", "Tizen.NUI.LottieAnimationView.SetMinMaxFrameByMarker M")]
101 [Property("SPEC_URL", "-")]
102 [Property("CRITERIA", "MR")]
103 [Property("AUTHOR", "guowei.wang@samsung.com")]
104 public void LottieAnimationViewSetMinMaxFrameByMarker()
106 tlog.Debug(tag, $"LottieAnimationViewSetMinMaxFrameByMarker START");
108 var testingTarget = new LottieAnimationView();
109 Assert.IsNotNull(testingTarget, "Can't create success object LottieAnimationView");
110 Assert.IsInstanceOf<LottieAnimationView>(testingTarget, "Should be an instance of LottieAnimationView type.");
112 testingTarget.URL = lottieFilePath;
114 string maker = "startframe: 1; endframe: 10";
118 testingTarget.SetMinMaxFrameByMarker(maker, null);
122 tlog.Debug(tag, e.Message.ToString());
123 Assert.Fail("Caught Exception: Failed!");
126 tlog.Debug(tag, $"LottieAnimationViewSetMinMaxFrameByMarker END (OK)");
131 [Description("LottieAnimationView GetMinMaxFrame.")]
132 [Property("SPEC", "Tizen.NUI.LottieAnimationView.GetMinMaxFrame M")]
133 [Property("SPEC_URL", "-")]
134 [Property("CRITERIA", "MR")]
135 [Property("AUTHOR", "guowei.wang@samsung.com")]
136 public void LottieAnimationViewGetMinMaxFrame()
138 tlog.Debug(tag, $"LottieAnimationViewGetMinMaxFrame START");
140 var testingTarget = new LottieAnimationView();
141 Assert.IsNotNull(testingTarget, "Can't create success object LottieAnimationView");
142 Assert.IsInstanceOf<LottieAnimationView>(testingTarget, "Should be an instance of LottieAnimationView type.");
144 testingTarget.URL = lottieFilePath;
146 PropertyMap map = new PropertyMap();
147 map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image))
148 .Add(ImageVisualProperty.URL, new PropertyValue(url))
149 .Add(ImageVisualProperty.LoopCount, new PropertyValue(2))
150 .Add(ImageVisualProperty.PlayRange, new PropertyValue(50));
151 testingTarget.Image = map;
153 string maker = "startframe: 1; endframe: 10";
154 testingTarget.SetMinMaxFrameByMarker(maker, null);
158 testingTarget.GetMinMaxFrame();
162 tlog.Debug(tag, e.Message.ToString());
163 Assert.Fail("Caught Exception: Failed!");
166 tlog.Debug(tag, $"LottieAnimationViewGetMinMaxFrame END (OK)");
171 [Description("LottieAnimationView Finished.")]
172 [Property("SPEC", "Tizen.NUI.LottieAnimationView.Finished M")]
173 [Property("SPEC_URL", "-")]
174 [Property("CRITERIA", "MR")]
175 [Property("AUTHOR", "guowei.wang@samsung.com")]
176 public void LottieAnimationViewFinished()
178 tlog.Debug(tag, $"LottieAnimationViewFinished START");
180 var testingTarget = new LottieAnimationView();
181 Assert.IsNotNull(testingTarget, "Can't create success object LottieAnimationView");
182 Assert.IsInstanceOf<LottieAnimationView>(testingTarget, "Should be an instance of LottieAnimationView type.");
184 testingTarget.URL = lottieFilePath;
185 NUIApplication.GetDefaultWindow().GetDefaultLayer().Add(testingTarget);
187 testingTarget.Finished += OnFinishedEvent;
188 testingTarget.Finished -= OnFinishedEvent;
190 NUIApplication.GetDefaultWindow().GetDefaultLayer().Remove(testingTarget);
192 tlog.Debug(tag, $"LottieAnimationViewFinished END (OK)");
197 [Description("LottieAnimationView VisualEvent.")]
198 [Property("SPEC", "Tizen.NUI.LottieAnimationView.VisualEvent M")]
199 [Property("SPEC_URL", "-")]
200 [Property("CRITERIA", "MR")]
201 [Property("AUTHOR", "guowei.wang@samsung.com")]
202 public void LottieAnimationViewVisualEvent()
204 tlog.Debug(tag, $"LottieAnimationViewVisualEvent START");
206 var testingTarget = new LottieAnimationView();
207 Assert.IsNotNull(testingTarget, "Can't create success object LottieAnimationView");
208 Assert.IsInstanceOf<LottieAnimationView>(testingTarget, "Should be an instance of LottieAnimationView type.");
210 testingTarget.URL = lottieFilePath;
211 NUIApplication.GetDefaultWindow().GetDefaultLayer().Add(testingTarget);
213 testingTarget.VisualEvent += OnVisualEvent;
214 testingTarget.VisualEvent -= OnVisualEvent;
216 NUIApplication.GetDefaultWindow().GetDefaultLayer().Remove(testingTarget);
218 tlog.Debug(tag, $"LottieAnimationViewVisualEvent END (OK)");
223 [Description("LottieFrameInfo constructor.")]
224 [Property("SPEC", "Tizen.NUI.LottieFrameInfo.LottieFrameInfo C")]
225 [Property("SPEC_URL", "-")]
226 [Property("CRITERIA", "CONSTR")]
227 [Property("AUTHOR", "guowei.wang@samsung.com")]
228 public void LottieFrameInfoConstructor()
230 tlog.Debug(tag, $"LottieFrameInfoConstructor START");
232 var testingTarget = new LottieFrameInfo(0, 10);
233 Assert.IsNotNull(testingTarget, "Can't create success object LottieFrameInfo");
234 Assert.IsInstanceOf<LottieFrameInfo>(testingTarget, "Should be an instance of LottieFrameInfo type.");
236 var result = testingTarget.StartFrame;
237 Assert.AreEqual(0, result, "should be equal!");
239 result = testingTarget.EndFrame;
240 Assert.AreEqual(10, result, "should be equal!");
242 tlog.Debug(tag, $"LottieFrameInfoConstructor END (OK)");
247 [Description("LottieFrameInfo constructor.")]
248 [Property("SPEC", "Tizen.NUI.LottieFrameInfo.LottieFrameInfo C")]
249 [Property("SPEC_URL", "-")]
250 [Property("CRITERIA", "CONSTR")]
251 [Property("AUTHOR", "guowei.wang@samsung.com")]
252 public void LottieFrameInfoConstructorWithStillImageFrame()
254 tlog.Debug(tag, $"LottieFrameInfoConstructorWithStillImageFrame START");
256 var testingTarget = new LottieFrameInfo(300);
257 Assert.IsNotNull(testingTarget, "Can't create success object LottieFrameInfo");
258 Assert.IsInstanceOf<LottieFrameInfo>(testingTarget, "Should be an instance of LottieFrameInfo type.");
260 var result = testingTarget.IsStillImage();
261 tlog.Debug(tag, "IsStillImage : " + result);
263 tlog.Debug(tag, $"LottieFrameInfoConstructorWithStillImageFrame END (OK)");
268 [Description("LottieFrameInfo constructor.")]
269 [Property("SPEC", "Tizen.NUI.LottieFrameInfo.LottieFrameInfo C")]
270 [Property("SPEC_URL", "-")]
271 [Property("CRITERIA", "CONSTR")]
272 [Property("AUTHOR", "guowei.wang@samsung.com")]
273 public void LottieFrameInfoConstructorWithPair()
275 tlog.Debug(tag, $"LottieFrameInfoConstructorWithPair START");
277 LottieFrameInfo testingTarget = (0, 10);
278 Assert.IsNotNull(testingTarget, "Can't create success object LottieFrameInfo");
279 Assert.IsInstanceOf<LottieFrameInfo>(testingTarget, "Should be an instance of LottieFrameInfo type.");
281 tlog.Debug(tag, $"LottieFrameInfoConstructorWithPair END (OK)");
286 [Description("LottieFrameInfo constructor.")]
287 [Property("SPEC", "Tizen.NUI.LottieFrameInfo.LottieFrameInfo C")]
288 [Property("SPEC_URL", "-")]
289 [Property("CRITERIA", "CONSTR")]
290 [Property("AUTHOR", "guowei.wang@samsung.com")]
291 public void LottieFrameInfoConstructorWithString()
293 tlog.Debug(tag, $"LottieFrameInfoConstructorWithString START");
295 LottieFrameInfo dummy1 = "0, 10";
296 Assert.IsNotNull(dummy1, "Can't create success object LottieFrameInfo");
297 Assert.IsInstanceOf<LottieFrameInfo>(dummy1, "Should be an instance of LottieFrameInfo type.");
300 LottieFrameInfo dummy2 = "10";
301 Assert.IsNotNull(dummy2, "Can't create success object LottieFrameInfo");
302 Assert.IsInstanceOf<LottieFrameInfo>(dummy2, "Should be an instance of LottieFrameInfo type.");
304 tlog.Debug(tag, $"LottieFrameInfoConstructorWithString END (OK)");
307 public void OnFinishedEvent(object sender, EventArgs e) { }
309 private void OnVisualEvent(object sender, LottieAnimationView.VisualEventSignalArgs e) { }