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/AnimatedImageView")]
14 public class PublicAnimatedImageViewTest
16 private const string tag = "NUITEST";
17 private string url = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png";
19 internal class MyAnimatedImageView : AnimatedImageView
21 public MyAnimatedImageView()
24 public void OnDispose(DisposeTypes type)
33 tlog.Info(tag, "Init() is called!");
39 tlog.Info(tag, "Destroy() is called!");
44 [Description("AnimatedImageView constructor.")]
45 [Property("SPEC", "Tizen.NUI.AnimatedImageView.AnimatedImageView C")]
46 [Property("SPEC_URL", "-")]
47 [Property("CRITERIA", "CONSTR")]
48 [Property("AUTHOR", "guowei.wang@samsung.com")]
49 public void AnimatedImageViewConstructor()
51 tlog.Debug(tag, $"AnimatedImageViewConstructor START");
53 var testingTarget = new AnimatedImageView();
54 Assert.IsNotNull(testingTarget, "Can't create success object AnimatedImageView");
55 Assert.IsInstanceOf<AnimatedImageView>(testingTarget, "Should be an instance of AnimatedImageView type.");
57 testingTarget.Dispose();
58 tlog.Debug(tag, $"AnimatedImageViewConstructor END (OK)");
63 [Description("AnimatedImageView Dispose.")]
64 [Property("SPEC", "Tizen.NUI.AnimatedImageView.Dispose M")]
65 [Property("SPEC_URL", "-")]
66 [Property("CRITERIA", "MR")]
67 [Property("AUTHOR", "guowei.wang@samsung.com")]
68 public void AnimatedImageViewDispose()
70 tlog.Debug(tag, $"AnimatedImageViewDispose START");
72 var testingTarget = new MyAnimatedImageView();
73 Assert.IsNotNull(testingTarget, "Can't create success object AnimatedImageView");
74 Assert.IsInstanceOf<AnimatedImageView>(testingTarget, "Should be an instance of AnimatedImageView type.");
78 testingTarget.OnDispose(DisposeTypes.Explicit);
82 tlog.Debug(tag, e.Message.ToString());
83 Assert.Fail("Caught Exception: Failed!");
86 tlog.Debug(tag, $"AnimatedImageViewDispose END (OK)");
91 [Description("AnimatedImageView ResourceUrl.")]
92 [Property("SPEC", "Tizen.NUI.AnimatedImageView.ResourceUrl A")]
93 [Property("SPEC_URL", "-")]
94 [Property("CRITERIA", "PRW")]
95 [Property("AUTHOR", "guowei.wang@samsung.com")]
96 public void AnimatedImageViewResourceUrl()
98 tlog.Debug(tag, $"AnimatedImageViewResourceUrl START");
100 var testingTarget = new AnimatedImageView();
101 Assert.IsNotNull(testingTarget, "Can't create success object AnimatedImageView");
102 Assert.IsInstanceOf<AnimatedImageView>(testingTarget, "Should be an instance of AnimatedImageView type.");
104 testingTarget.ResourceUrl = url;
105 Assert.AreEqual(url, testingTarget.ResourceUrl, "Should be equal");
107 testingTarget.Dispose();
108 tlog.Debug(tag, $"AnimatedImageViewResourceUrl END (OK)");
113 [Description("AnimatedImageView URLs.")]
114 [Property("SPEC", "Tizen.NUI.AnimatedImageView.URLs A")]
115 [Property("SPEC_URL", "-")]
116 [Property("CRITERIA", "PRO")]
117 [Property("AUTHOR", "guowei.wang@samsung.com")]
118 public void AnimatedImageViewURLs()
120 tlog.Debug(tag, $"AnimatedImageViewURLs START");
122 var testingTarget = new AnimatedImageView();
123 Assert.IsNotNull(testingTarget, "Can't create success object AnimatedImageView");
124 Assert.IsInstanceOf<AnimatedImageView>(testingTarget, "Should be an instance of AnimatedImageView type.");
126 Assert.IsNotNull(testingTarget.URLs);
128 testingTarget.Dispose();
129 tlog.Debug(tag, $"AnimatedImageViewURLs END (OK)");
134 [Description("AnimatedImageView BatchSize.")]
135 [Property("SPEC", "Tizen.NUI.AnimatedImageView.BatchSize A")]
136 [Property("SPEC_URL", "-")]
137 [Property("CRITERIA", "PRW")]
138 [Property("AUTHOR", "guowei.wang@samsung.com")]
139 public void AnimatedImageViewBatchSize()
141 tlog.Debug(tag, $"AnimatedImageViewBatchSize START");
143 var testingTarget = new AnimatedImageView();
144 Assert.IsNotNull(testingTarget, "Can't create success object AnimatedImageView");
145 Assert.IsInstanceOf<AnimatedImageView>(testingTarget, "Should be an instance of AnimatedImageView type.");
147 Assert.AreEqual(1, testingTarget.BatchSize, "Should be equal!");
149 testingTarget.BatchSize = 2;
150 Assert.AreEqual(2, testingTarget.BatchSize, "Should be equal!");
152 testingTarget.Dispose();
153 tlog.Debug(tag, $"AnimatedImageViewBatchSize END (OK)");
158 [Description("AnimatedImageView CacheSize.")]
159 [Property("SPEC", "Tizen.NUI.AnimatedImageView.CacheSize A")]
160 [Property("SPEC_URL", "-")]
161 [Property("CRITERIA", "PRW")]
162 [Property("AUTHOR", "guowei.wang@samsung.com")]
163 public void AnimatedImageViewCacheSize()
165 tlog.Debug(tag, $"AnimatedImageViewCacheSize START");
167 var testingTarget = new AnimatedImageView();
168 Assert.IsNotNull(testingTarget, "Can't create success object AnimatedImageView");
169 Assert.IsInstanceOf<AnimatedImageView>(testingTarget, "Should be an instance of AnimatedImageView type.");
171 Assert.AreEqual(1, testingTarget.CacheSize, "Should be equal!");
173 testingTarget.CacheSize = 2;
174 Assert.AreEqual(2, testingTarget.CacheSize, "Should be equal!");
176 testingTarget.Dispose();
177 tlog.Debug(tag, $"AnimatedImageViewCacheSize END (OK)");
182 [Description("AnimatedImageView FrameDelay.")]
183 [Property("SPEC", "Tizen.NUI.AnimatedImageView.FrameDelay A")]
184 [Property("SPEC_URL", "-")]
185 [Property("CRITERIA", "PRW")]
186 [Property("AUTHOR", "guowei.wang@samsung.com")]
187 public void AnimatedImageViewFrameDelay()
189 tlog.Debug(tag, $"AnimatedImageViewFrameDelay START");
191 var testingTarget = new AnimatedImageView();
192 Assert.IsNotNull(testingTarget, "Can't create success object AnimatedImageView");
193 Assert.IsInstanceOf<AnimatedImageView>(testingTarget, "Should be an instance of AnimatedImageView type.");
195 testingTarget.FrameDelay = 300;
196 Assert.AreEqual(300, testingTarget.FrameDelay, "Should be equal!");
198 testingTarget.Dispose();
199 tlog.Debug(tag, $"AnimatedImageViewFrameDelay END (OK)");
204 [Description("AnimatedImageView LoopCount.")]
205 [Property("SPEC", "Tizen.NUI.AnimatedImageView.LoopCount A")]
206 [Property("SPEC_URL", "-")]
207 [Property("CRITERIA", "PRW")]
208 [Property("AUTHOR", "guowei.wang@samsung.com")]
209 public void AnimatedImageViewLoopCount()
211 tlog.Debug(tag, $"AnimatedImageViewLoopCount START");
213 var testingTarget = new AnimatedImageView();
214 Assert.IsNotNull(testingTarget, "Can't create success object AnimatedImageView");
215 Assert.IsInstanceOf<AnimatedImageView>(testingTarget, "Should be an instance of AnimatedImageView type.");
217 testingTarget.LoopCount = 3;
218 Assert.AreEqual(3, testingTarget.LoopCount, "Should be equal!");
220 testingTarget.Dispose();
221 tlog.Debug(tag, $"AnimatedImageViewLoopCount END (OK)");
226 [Description("AnimatedImageView StopBehavior.")]
227 [Property("SPEC", "Tizen.NUI.AnimatedImageView.StopBehavior A")]
228 [Property("SPEC_URL", "-")]
229 [Property("CRITERIA", "PRW")]
230 [Property("AUTHOR", "guowei.wang@samsung.com")]
231 public void AnimatedImageViewStopBehavior()
233 tlog.Debug(tag, $"AnimatedImageViewStopBehavior START");
235 var testingTarget = new AnimatedImageView();
236 Assert.IsNotNull(testingTarget, "Can't create success object AnimatedImageView");
237 Assert.IsInstanceOf<AnimatedImageView>(testingTarget, "Should be an instance of AnimatedImageView type.");
239 testingTarget.StopBehavior = AnimatedImageView.StopBehaviorType.MinimumFrame;
240 Assert.AreEqual(AnimatedImageView.StopBehaviorType.MinimumFrame, testingTarget.StopBehavior, "Should be equal!");
242 testingTarget.Dispose();
243 tlog.Debug(tag, $"AnimatedImageViewStopBehavior END (OK)");
248 [Description("AnimatedImageView TotalFrame.")]
249 [Property("SPEC", "Tizen.NUI.AnimatedImageView.TotalFrame A")]
250 [Property("SPEC_URL", "-")]
251 [Property("CRITERIA", "PR")]
252 [Property("AUTHOR", "guowei.wang@samsung.com")]
253 public void AnimatedImageViewTotalFrame()
255 tlog.Debug(tag, $"AnimatedImageViewTotalFrame START");
257 var testingTarget = new AnimatedImageView();
258 Assert.IsNotNull(testingTarget, "Can't create success object AnimatedImageView");
259 Assert.IsInstanceOf<AnimatedImageView>(testingTarget, "Should be an instance of AnimatedImageView type.");
261 using (PropertyMap map = new PropertyMap())
263 map.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
264 map.Insert(ImageVisualProperty.URL, new PropertyValue(url));
265 map.Insert(ImageVisualProperty.Border, new PropertyValue(new Extents(4, 4, 4, 4)));
266 map.Insert(ImageVisualProperty.TotalFrameNumber, new PropertyValue(ImageVisualProperty.TotalFrameNumber));
268 testingTarget.Image = map;
272 var resutl = testingTarget.TotalFrame;
276 tlog.Debug(tag, e.Message.ToString());
277 Assert.Fail("Caught Exception: Failed!");
281 testingTarget.Dispose();
282 tlog.Debug(tag, $"AnimatedImageViewTotalFrame END (OK)");
287 [Description("AnimatedImageView CurrentFrame.")]
288 [Property("SPEC", "Tizen.NUI.AnimatedImageView.CurrentFrame A")]
289 [Property("SPEC_URL", "-")]
290 [Property("CRITERIA", "PRW")]
291 [Property("AUTHOR", "guowei.wang@samsung.com")]
292 public void AnimatedImageViewCurrentFrame()
294 tlog.Debug(tag, $"AnimatedImageViewCurrentFrame START");
296 var testingTarget = new AnimatedImageView();
297 Assert.IsNotNull(testingTarget, "Can't create success object AnimatedImageView");
298 Assert.IsInstanceOf<AnimatedImageView>(testingTarget, "Should be an instance of AnimatedImageView type.");
300 using (PropertyMap map = new PropertyMap())
302 map.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
303 map.Insert(ImageVisualProperty.URL, new PropertyValue(url));
304 map.Insert(ImageVisualProperty.Border, new PropertyValue(new Extents(4, 4, 4, 4)));
305 map.Insert(ImageVisualProperty.TotalFrameNumber, new PropertyValue(30));
306 map.Insert(ImageVisualProperty.CurrentFrameNumber, new PropertyValue(0));
308 testingTarget.Image = map;
312 testingTarget.CurrentFrame = 15;
313 var resutl = testingTarget.CurrentFrame;
317 tlog.Debug(tag, e.Message.ToString());
318 Assert.Fail("Caught Exception: Failed!");
322 testingTarget.Dispose();
323 tlog.Debug(tag, $"AnimatedImageViewCurrentFrame END (OK)");
328 [Description("AnimatedImageView Play.")]
329 [Property("SPEC", "Tizen.NUI.AnimatedImageView.Play M")]
330 [Property("SPEC_URL", "-")]
331 [Property("CRITERIA", "MR")]
332 [Property("AUTHOR", "guowei.wang@samsung.com")]
333 public void AnimatedImageViewPlay()
335 tlog.Debug(tag, $"AnimatedImageViewPlay START");
337 var testingTarget = new AnimatedImageView();
338 Assert.IsNotNull(testingTarget, "Can't create success object AnimatedImageView");
339 Assert.IsInstanceOf<AnimatedImageView>(testingTarget, "Should be an instance of AnimatedImageView type.");
341 using (PropertyMap map = new PropertyMap())
343 map.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
344 map.Insert(ImageVisualProperty.URL, new PropertyValue(url));
345 map.Insert(ImageVisualProperty.AlphaMaskURL, new PropertyValue(url));
346 map.Insert(ImageVisualProperty.AuxiliaryImageURL, new PropertyValue(url));
347 map.Insert(ImageVisualProperty.Border, new PropertyValue(new Extents(4, 4, 4, 4)));
348 map.Insert(ImageVisualProperty.TotalFrameNumber, new PropertyValue(30));
349 map.Insert(ImageVisualProperty.CurrentFrameNumber, new PropertyValue(0));
351 testingTarget.Image = map;
353 testingTarget.BatchSize = 2;
354 testingTarget.CacheSize = 2;
355 testingTarget.LoopCount = 3;
356 testingTarget.StopBehavior = AnimatedImageView.StopBehaviorType.MinimumFrame;
360 testingTarget.Play();
364 testingTarget.Dispose();
365 tlog.Debug(tag, e.Message.ToString());
366 tlog.Debug(tag, $"AnimatedImageViewPlay END (OK)");
367 Assert.Pass("Passed!");
370 testingTarget?.Dispose();
371 tlog.Debug(tag, $"AnimatedImageViewPlay END (OK)");