[NUI] Update TCs of NUI.Devel.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Widget / TSWidgetView.cs
1 using global::System;
2 using NUnit.Framework;
3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 using System.Collections.Generic;
7
8 namespace Tizen.NUI.Devel.Tests
9 {
10     using tlog = Tizen.Log;
11
12     [TestFixture]
13     [Description("public/Widget/WidgetView")]
14     public class PublicWidgetViewTest
15     {
16         private const string tag = "NUITEST";
17         private View view = null;
18         private WidgetView widgetView = null;
19
20         [SetUp]
21         public void Init()
22         {
23             tlog.Info(tag, "Init() is called!");
24
25             view = new View()
26             { 
27                 Size = new Size(100, 200),
28                 Color = Color.Cyan
29             };
30             widgetView = new WidgetView(view.SwigCPtr.Handle, false);
31             tlog.Error(tag, " widgetView.ID : " + widgetView.ID);
32         }
33
34         [TearDown]
35         public void Destroy()
36         {
37             view?.Dispose();
38             view = null;
39
40             widgetView?.Dispose();
41             widgetView = null;
42
43             tlog.Info(tag, "Destroy() is called!");
44         }
45
46         [Test]
47         [Category("P1")]
48         [Description("WidgetView Constructor. With WidgetView")]
49         [Property("SPEC", "Tizen.NUI.WidgetView.WidgetView C")]
50         [Property("SPEC_URL", "-")]
51         [Property("CRITERIA", "CONSTR")]
52         [Property("AUTHOR", "guowei.wang@samsung.com")]
53         public void WidgetViewConstructorWithWidgetView()
54         {
55             tlog.Debug(tag, $"WidgetViewConstructorWithWidgetView START");
56
57             var testingTarget = new WidgetView(widgetView);
58             Assert.IsNotNull(testingTarget, "Can't create success object WidgetView");
59             Assert.IsInstanceOf<WidgetView>(testingTarget, "Should be an instance of WidgetView type.");
60
61             testingTarget.Dispose();
62             tlog.Debug(tag, $"WidgetViewConstructorWithWidgetView END (OK)");
63         }
64
65         [Test]
66         [Category("P1")]
67         [Description("WidgetView WidgetAddedSignal.")]
68         [Property("SPEC", "Tizen.NUI.WidgetView.WidgetAddedSignal M")]
69         [Property("SPEC_URL", "-")]
70         [Property("CRITERIA", "MR")]
71         [Property("AUTHOR", "guowei.wang@samsung.com")]
72         public void WidgetViewWidgetAddedSignal()
73         {
74             tlog.Debug(tag, $"WidgetViewWidgetAddedSignal START");
75
76             try
77             {
78                 widgetView.WidgetAddedSignal();
79             }
80             catch (Exception e)
81             {
82                 tlog.Debug(tag, e.Message.ToString());
83                 Assert.Fail("Caught Exception: Failed!");
84             }
85
86             tlog.Debug(tag, $"WidgetViewWidgetAddedSignal END (OK)");
87         }
88
89         [Test]
90         [Category("P1")]
91         [Description("WidgetView WidgetDeletedSignal.")]
92         [Property("SPEC", "Tizen.NUI.WidgetView.WidgetDeletedSignal M")]
93         [Property("SPEC_URL", "-")]
94         [Property("CRITERIA", "MR")]
95         [Property("AUTHOR", "guowei.wang@samsung.com")]
96         public void WidgetViewWidgetDeletedSignal()
97         {
98             tlog.Debug(tag, $"WidgetViewWidgetDeletedSignal START");
99
100             try
101             {
102                 widgetView.WidgetDeletedSignal();
103             }
104             catch (Exception e)
105             {
106                 tlog.Debug(tag, e.Message.ToString());
107                 Assert.Fail("Caught Exception: Failed!");
108             }
109
110             tlog.Debug(tag, $"WidgetViewWidgetDeletedSignal END (OK)");
111         }
112
113         [Test]
114         [Category("P1")]
115         [Description("WidgetView WidgetCreationAbortedSignal.")]
116         [Property("SPEC", "Tizen.NUI.WidgetView.WidgetCreationAbortedSignal M")]
117         [Property("SPEC_URL", "-")]
118         [Property("CRITERIA", "MR")]
119         [Property("AUTHOR", "guowei.wang@samsung.com")]
120         public void WidgetViewWidgetCreationAbortedSignal()
121         {
122             tlog.Debug(tag, $"WidgetViewWidgetCreationAbortedSignal START");
123
124             try
125             {
126                 widgetView.WidgetCreationAbortedSignal();
127             }
128             catch (Exception e)
129             {
130                 tlog.Debug(tag, e.Message.ToString());
131                 Assert.Fail("Caught Exception: Failed!");
132             }
133
134             tlog.Debug(tag, $"WidgetViewWidgetCreationAbortedSignal END (OK)");
135         }
136
137         [Test]
138         [Category("P1")]
139         [Description("WidgetView WidgetContentUpdatedSignal.")]
140         [Property("SPEC", "Tizen.NUI.WidgetView.WidgetContentUpdatedSignal M")]
141         [Property("SPEC_URL", "-")]
142         [Property("CRITERIA", "MR")]
143         [Property("AUTHOR", "guowei.wang@samsung.com")]
144         public void WidgetViewWidgetContentUpdatedSignal()
145         {
146             tlog.Debug(tag, $"WidgetViewWidgetContentUpdatedSignal START");
147
148             try
149             {
150                 widgetView.WidgetContentUpdatedSignal();
151             }
152             catch (Exception e)
153             {
154                 tlog.Debug(tag, e.Message.ToString());
155                 Assert.Fail("Caught Exception: Failed!");
156             }
157
158             tlog.Debug(tag, $"WidgetViewWidgetContentUpdatedSignal END (OK)");
159         }
160
161         [Test]
162         [Category("P1")]
163         [Description("WidgetView WidgetUpdatePeriodChangedSignal.")]
164         [Property("SPEC", "Tizen.NUI.WidgetView.WidgetUpdatePeriodChangedSignal M")]
165         [Property("SPEC_URL", "-")]
166         [Property("CRITERIA", "MR")]
167         [Property("AUTHOR", "guowei.wang@samsung.com")]
168         public void WidgetViewWidgetUpdatePeriodChangedSignal()
169         {
170             tlog.Debug(tag, $"WidgetViewWidgetUpdatePeriodChangedSignal START");
171
172             try
173             {
174                 widgetView.WidgetUpdatePeriodChangedSignal();
175             }
176             catch (Exception e)
177             {
178                 tlog.Debug(tag, e.Message.ToString());
179                 Assert.Fail("Caught Exception: Failed!");
180             }
181
182             tlog.Debug(tag, $"WidgetViewWidgetUpdatePeriodChangedSignal END (OK)");
183         }
184
185         [Test]
186         [Category("P1")]
187         [Description("WidgetView WidgetFaultedSignal.")]
188         [Property("SPEC", "Tizen.NUI.WidgetView.WidgetFaultedSignal M")]
189         [Property("SPEC_URL", "-")]
190         [Property("CRITERIA", "MR")]
191         [Property("AUTHOR", "guowei.wang@samsung.com")]
192         public void WidgetViewWidgetFaultedSignal()
193         {
194             tlog.Debug(tag, $"WidgetViewWidgetFaultedSignal START");
195
196             try
197             {
198                 widgetView.WidgetFaultedSignal();
199             }
200             catch (Exception e)
201             {
202                 tlog.Debug(tag, e.Message.ToString());
203                 Assert.Fail("Caught Exception: Failed!");
204             }
205
206             tlog.Debug(tag, $"WidgetViewWidgetFaultedSignal END (OK)");
207         }
208
209         [Test]
210         [Category("P1")]
211         [Description("WidgetView WidgetID.")]
212         [Property("SPEC", "Tizen.NUI.WidgetView.WidgetID A")]
213         [Property("SPEC_URL", "-")]
214         [Property("CRITERIA", "PRO")]
215         [Property("AUTHOR", "guowei.wang@samsung.com")]
216         public void WidgetViewWidgetID()
217         {
218             tlog.Debug(tag, $"WidgetViewWidgetID START");
219
220             try
221             {
222                 tlog.Debug(tag, "widgetView.WidgetID : " + widgetView.WidgetID);
223             }
224             catch (Exception e)
225             {
226                 tlog.Debug(tag, e.Message.ToString());
227                 Assert.Fail("Caught Exception: Failed!");
228             }
229
230             tlog.Debug(tag, $"WidgetViewWidgetID END (OK)");
231         }
232
233         [Test]
234         [Category("P1")]
235         [Description("WidgetView InstanceID.")]
236         [Property("SPEC", "Tizen.NUI.WidgetView.InstanceID A")]
237         [Property("SPEC_URL", "-")]
238         [Property("CRITERIA", "PRO")]
239         [Property("AUTHOR", "guowei.wang@samsung.com")]
240         public void WidgetViewInstanceID()
241         {
242             tlog.Debug(tag, $"WidgetViewInstanceID START");
243
244             try
245             {
246                 tlog.Debug(tag, "widgetView.InstanceID : " + widgetView.InstanceID);
247             }
248             catch (Exception e)
249             {
250                 tlog.Debug(tag, e.Message.ToString());
251                 Assert.Fail("Caught Exception: Failed!");
252             }
253
254             tlog.Debug(tag, $"WidgetViewInstanceID END (OK)");
255         }
256
257         [Test]
258         [Category("P1")]
259         [Description("WidgetView ContentInfo.")]
260         [Property("SPEC", "Tizen.NUI.WidgetView.ContentInfo A")]
261         [Property("SPEC_URL", "-")]
262         [Property("CRITERIA", "PRO")]
263         [Property("AUTHOR", "guowei.wang@samsung.com")]
264         public void WidgetViewContentInfo()
265         {
266             tlog.Debug(tag, $"WidgetViewContentInfo START");
267
268             try
269             {
270                 tlog.Debug(tag, "widgetView.ContentInfo : " + widgetView.ContentInfo);
271             }
272             catch (Exception e)
273             {
274                 tlog.Debug(tag, e.Message.ToString());
275                 Assert.Fail("Caught Exception: Failed!");
276             }
277
278             tlog.Debug(tag, $"WidgetViewContentInfo END (OK)");
279         }
280
281         [Test]
282         [Category("P1")]
283         [Description("WidgetView Title.")]
284         [Property("SPEC", "Tizen.NUI.WidgetView.Title A")]
285         [Property("SPEC_URL", "-")]
286         [Property("CRITERIA", "PRO")]
287         [Property("AUTHOR", "guowei.wang@samsung.com")]
288         public void WidgetViewTitle()
289         {
290             tlog.Debug(tag, $"WidgetViewTitle START");
291
292             try
293             {
294                 tlog.Debug(tag, "widgetView.Title : " + widgetView.Title);
295             }
296             catch (Exception e)
297             {
298                 tlog.Debug(tag, e.Message.ToString());
299                 Assert.Fail("Caught Exception: Failed!");
300             }
301
302             tlog.Debug(tag, $"WidgetViewTitle END (OK)");
303         }
304
305         [Test]
306         [Category("P1")]
307         [Description("WidgetView UpdatePeriod.")]
308         [Property("SPEC", "Tizen.NUI.WidgetView.Title A")]
309         [Property("SPEC_URL", "-")]
310         [Property("CRITERIA", "PRO")]
311         [Property("AUTHOR", "guowei.wang@samsung.com")]
312         public void WidgetViewUpdatePeriod()
313         {
314             tlog.Debug(tag, $"WidgetViewUpdatePeriod START");
315
316             try
317             {
318                 tlog.Debug(tag, "widgetView.UpdatePeriod : " + widgetView.UpdatePeriod);
319             }
320             catch (Exception e)
321             {
322                 tlog.Debug(tag, e.Message.ToString());
323                 Assert.Fail("Caught Exception: Failed!");
324             }
325
326             tlog.Debug(tag, $"WidgetViewUpdatePeriod END (OK)");
327         }
328
329         [Test]
330         [Category("P1")]
331         [Description("WidgetView Preview.")]
332         [Property("SPEC", "Tizen.NUI.WidgetView.Preview A")]
333         [Property("SPEC_URL", "-")]
334         [Property("CRITERIA", "PRW")]
335         [Property("AUTHOR", "guowei.wang@samsung.com")]
336         public void WidgetViewPreview()
337         {
338             tlog.Debug(tag, $"WidgetViewPreview START");
339
340             try
341             {
342                 tlog.Debug(tag, "Default widgetView.Preview is : " + widgetView.Preview);
343
344                 widgetView.Preview = true;
345                 tlog.Debug(tag, "widgetView.Preview : " + widgetView.Preview);
346                 
347                 widgetView.Preview = false;
348                 tlog.Debug(tag, "widgetView.Preview : " + widgetView.Preview);
349             }
350             catch (Exception e)
351             {
352                 tlog.Debug(tag, e.Message.ToString());
353                 Assert.Fail("Caught Exception: Failed!");
354             }
355
356             tlog.Debug(tag, $"WidgetViewPreview END (OK)");
357         }
358
359         [Test]
360         [Category("P1")]
361         [Description("WidgetView LoadingText.")]
362         [Property("SPEC", "Tizen.NUI.WidgetView.LoadingText A")]
363         [Property("SPEC_URL", "-")]
364         [Property("CRITERIA", "PRW")]
365         [Property("AUTHOR", "guowei.wang@samsung.com")]
366         public void WidgetViewLoadingText()
367         {
368             tlog.Debug(tag, $"WidgetViewLoadingText START");
369
370             try
371             {
372                 tlog.Debug(tag, "Default widgetView.Preview is : " + widgetView.LoadingText);
373
374                 widgetView.LoadingText = true;
375                 tlog.Debug(tag, "widgetView.LoadingText : " + widgetView.LoadingText);
376
377                 widgetView.LoadingText = false;
378                 tlog.Debug(tag, "widgetView.LoadingText : " + widgetView.LoadingText);
379             }
380             catch (Exception e)
381             {
382                 tlog.Debug(tag, e.Message.ToString());
383                 Assert.Fail("Caught Exception: Failed!");
384             }
385
386             tlog.Debug(tag, $"WidgetViewLoadingText END (OK)");
387         }
388
389         [Test]
390         [Category("P1")]
391         [Description("WidgetView WidgetStateFaulted.")]
392         [Property("SPEC", "Tizen.NUI.WidgetView.WidgetStateFaulted A")]
393         [Property("SPEC_URL", "-")]
394         [Property("CRITERIA", "PRW")]
395         [Property("AUTHOR", "guowei.wang@samsung.com")]
396         public void WidgetViewWidgetStateFaulted()
397         {
398             tlog.Debug(tag, $"WidgetViewWidgetStateFaulted START");
399
400             try
401             {
402                 tlog.Debug(tag, "Default widgetView.Preview is : " + widgetView.WidgetStateFaulted);
403
404                 widgetView.WidgetStateFaulted = true;
405                 tlog.Debug(tag, "widgetView.WidgetStateFaulted : " + widgetView.WidgetStateFaulted);
406
407                 widgetView.WidgetStateFaulted = false;
408                 tlog.Debug(tag, "widgetView.WidgetStateFaulted : " + widgetView.WidgetStateFaulted);
409             }
410             catch (Exception e)
411             {
412                 tlog.Debug(tag, e.Message.ToString());
413                 Assert.Fail("Caught Exception: Failed!");
414             }
415
416             tlog.Debug(tag, $"WidgetViewWidgetStateFaulted END (OK)");
417         }
418
419         [Test]
420         [Category("P1")]
421         [Description("WidgetView PermanentDelete.")]
422         [Property("SPEC", "Tizen.NUI.WidgetView.PermanentDelete A")]
423         [Property("SPEC_URL", "-")]
424         [Property("CRITERIA", "PRW")]
425         [Property("AUTHOR", "guowei.wang@samsung.com")]
426         public void WidgetViewWidgetPermanentDelete()
427         {
428             tlog.Debug(tag, $"WidgetViewWidgetPermanentDelete START");
429
430             try
431             {
432                 tlog.Debug(tag, "Default widgetView.Preview is : " + widgetView.PermanentDelete);
433
434                 widgetView.PermanentDelete = true;
435                 tlog.Debug(tag, "widgetView.PermanentDelete : " + widgetView.PermanentDelete);
436
437                 widgetView.PermanentDelete = false;
438                 tlog.Debug(tag, "widgetView.PermanentDelete : " + widgetView.PermanentDelete);
439             }
440             catch (Exception e)
441             {
442                 tlog.Debug(tag, e.Message.ToString());
443                 Assert.Fail("Caught Exception: Failed!");
444             }
445
446             tlog.Debug(tag, $"WidgetViewWidgetPermanentDelete END (OK)");
447         }
448
449         [Test]
450         [Category("P1")]
451         [Description("WidgetView RetryText.")]
452         [Property("SPEC", "Tizen.NUI.WidgetView.RetryText A")]
453         [Property("SPEC_URL", "-")]
454         [Property("CRITERIA", "PRW")]
455         [Property("AUTHOR", "guowei.wang@samsung.com")]
456         public void WidgetViewRetryText()
457         {
458             tlog.Debug(tag, $"WidgetViewRetryText START");
459
460             try
461             {
462                 using (PropertyMap map = new PropertyMap())
463                 {
464                     map.Insert(WidgetView.Property.RetryText, new PropertyValue(1));
465
466                     widgetView.RetryText = map;
467
468                     var result = widgetView.RetryText;
469                     Assert.IsInstanceOf<PropertyMap>(result, "Should be an instance of PropertyMap type.");
470                 }
471             }
472             catch (Exception e)
473             {
474                 tlog.Debug(tag, e.Message.ToString());
475                 Assert.Fail("Caught Exception: Failed!");
476             }
477
478             tlog.Debug(tag, $"WidgetViewRetryText END (OK)");
479         }
480
481         [Test]
482         [Category("P1")]
483         [Description("WidgetView Effect.")]
484         [Property("SPEC", "Tizen.NUI.WidgetView.Effect A")]
485         [Property("SPEC_URL", "-")]
486         [Property("CRITERIA", "PRW")]
487         [Property("AUTHOR", "guowei.wang@samsung.com")]
488         public void WidgetViewEffect()
489         {
490             tlog.Debug(tag, $"WidgetViewEffect START");
491
492             try
493             {
494                 using (PropertyMap map = new PropertyMap())
495                 {
496                     map.Insert(WidgetView.Property.EFFECT, new PropertyValue(1));
497
498                     widgetView.Effect = map;
499
500                     var result = widgetView.Effect;
501                     Assert.IsInstanceOf<PropertyMap>(result, "Should be an instance of PropertyMap type.");
502                 }
503             }
504             catch (Exception e)
505             {
506                 tlog.Debug(tag, e.Message.ToString());
507                 Assert.Fail("Caught Exception: Failed!");
508             }
509
510             tlog.Debug(tag, $"WidgetViewEffect END (OK)");
511         }
512
513         [Test]
514         [Category("P1")]
515         [Description("WidgetView GetWidgetViewFromPtr.")]
516         [Property("SPEC", "Tizen.NUI.WidgetView.GetWidgetViewFromPtr M")]
517         [Property("SPEC_URL", "-")]
518         [Property("CRITERIA", "MR")]
519         [Property("AUTHOR", "guowei.wang@samsung.com")]
520         public void WidgetViewGetWidgetViewFromPtr()
521         {
522             tlog.Debug(tag, $"WidgetViewGetWidgetViewFromPtr START");
523
524             try
525             {
526                 WidgetView.GetWidgetViewFromPtr(widgetView.SwigCPtr.Handle);
527             }
528             catch (Exception e)
529             {
530                 tlog.Debug(tag, e.Message.ToString());
531                 Assert.Fail("Caught Exception: Failed!");
532             }
533
534             tlog.Debug(tag, $"WidgetViewGetWidgetViewFromPtr END (OK)");
535         }
536
537         [Test]
538         [Category("P1")]
539         [Description("WidgetView Assign.")]
540         [Property("SPEC", "Tizen.NUI.WidgetView.Assign M")]
541         [Property("SPEC_URL", "-")]
542         [Property("CRITERIA", "MR")]
543         [Property("AUTHOR", "guowei.wang@samsung.com")]
544         public void WidgetViewAssign()
545         {
546             tlog.Debug(tag, $"WidgetViewAssign START");
547
548             try
549             {
550                 widgetView.Assign(widgetView);
551             }
552             catch (Exception e)
553             {
554                 tlog.Debug(tag, e.Message.ToString());
555                 Assert.Fail("Caught Exception: Failed!");
556             }
557
558             tlog.Debug(tag, $"WidgetViewAssign END (OK)");
559         }
560
561         [Test]
562         [Category("P1")]
563         [Description("WidgetView.WidgetViewEventArgs.WidgetView.")]
564         [Property("SPEC", "Tizen.NUI.WidgetView.WidgetViewEventArgs.WidgetView M")]
565         [Property("SPEC_URL", "-")]
566         [Property("CRITERIA", "MR")]
567         [Property("AUTHOR", "guowei.wang@samsung.com")]
568         public void WidgetViewWidgetViewEventArgsWidgetView()
569         {
570             tlog.Debug(tag, $"WidgetViewWidgetViewEventArgsWidgetView START");
571
572             var testingTarget = new WidgetView.WidgetViewEventArgs();
573             tlog.Debug(tag, "Default testingTarget.WidgetView is : " + testingTarget.WidgetView);
574
575             testingTarget.WidgetView = widgetView;
576             tlog.Debug(tag, "testingTarget.WidgetView is : " + testingTarget.WidgetView);
577
578             tlog.Debug(tag, $"WidgetViewWidgetViewEventArgsWidgetView END (OK)");
579         }
580
581         [Test]
582         [Category("P1")]
583         [Description("WidgetView ActivateFaultedWidget.")]
584         [Property("SPEC", "Tizen.NUI.WidgetView.ActivateFaultedWidget M")]
585         [Property("SPEC_URL", "-")]
586         [Property("CRITERIA", "MR")]
587         [Property("AUTHOR", "guowei.wang@samsung.com")]
588         public void WidgetViewActivateFaultedWidget()
589         {
590             tlog.Debug(tag, $"WidgetViewActivateFaultedWidget START");
591
592             try
593             {
594                 widgetView.ActivateFaultedWidget();
595             }
596             catch (Exception e)
597             {
598                 tlog.Debug(tag, e.Message.ToString());
599                 Assert.Fail("Caught Exception: Failed!");
600             }
601
602             tlog.Debug(tag, $"WidgetViewActivateFaultedWidget END (OK)");
603         }
604     }
605 }