[NUI][NUI.Devel] Update nui line coverage TCs.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / Common / TSRenderTaskList.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
7 namespace Tizen.NUI.Devel.Tests
8 {
9     using tlog = Tizen.Log;
10
11     [TestFixture]
12     [Description("internal/Common/RenderTaskList")]
13     public class InternalRenderTaskListTest
14     {
15         private const string tag = "NUITEST";
16
17         [SetUp]
18         public void Init()
19         {
20             tlog.Info(tag, "Init() is called!");
21         }
22
23         [TearDown]
24         public void Destroy()
25         {
26             tlog.Info(tag, "Destroy() is called!");
27         }
28
29         [Test]
30         [Category("P1")]
31         [Description("RenderTaskList constructor.")]
32         [Property("SPEC", "Tizen.NUI.RenderTaskList.RenderTaskList C")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "CONSTR")]
35         [Property("AUTHOR", "guowei.wang@samsung.com")]
36         public void RenderTaskListConstructor()
37         {
38             tlog.Debug(tag, $"RenderTaskListConstructor START");
39
40             var testingTarget = new RenderTaskList();
41             Assert.IsInstanceOf<RenderTaskList>(testingTarget, "Should return RenderTaskList instance.");
42
43             testingTarget.Dispose();
44             tlog.Debug(tag, $"RenderTaskListConstructor END (OK)");
45         }
46
47         [Test]
48         [Category("P1")]
49         [Description("RenderTaskList DownCast.")]
50         [Property("SPEC", "Tizen.NUI.RenderTaskList.DownCast M")]
51         [Property("SPEC_URL", "-")]
52         [Property("CRITERIA", "MR")]
53         [Property("AUTHOR", "guowei.wang@samsung.com")]
54         public void RenderTaskListDownCast()
55         {
56             tlog.Debug(tag, $"RenderTaskListDownCast START");
57
58             using (RenderTask task = new RenderTask())
59             {
60                 try
61                 {
62                     RenderTaskList.DownCast(task);
63                 }
64                 catch (Exception e)
65                 {
66                     tlog.Debug(tag, e.Message.ToString());
67                     Assert.Fail("Caught Exception : Failed!");
68                 }
69             }
70
71             tlog.Debug(tag, $"RenderTaskListDownCast END (OK)");
72         }
73
74         [Test]
75         [Category("P1")]
76         [Description("RenderTaskList Assign.")]
77         [Property("SPEC", "Tizen.NUI.RenderTaskList.Assign M")]
78         [Property("SPEC_URL", "-")]
79         [Property("CRITERIA", "MR")]
80         [Property("AUTHOR", "guowei.wang@samsung.com")]
81         public void RenderTaskListAssign()
82         {
83             tlog.Debug(tag, $"RenderTaskListAssign START");
84
85             using (Animatable ani = new Animatable())
86             {
87                 using (RenderTaskList task = new RenderTaskList(ani.SwigCPtr.Handle, false))
88                 {
89                     var testingTarget = task.Assign(task);
90                     Assert.IsNotNull(testingTarget, "Can't create success object RenderTaskList.");
91                     Assert.IsInstanceOf<RenderTaskList>(testingTarget, "Should return RenderTaskList instance.");
92
93                     tlog.Debug(tag, "GetTaskCount :" + testingTarget.GetTaskCount());
94
95                     testingTarget.Dispose();
96                 }
97             }
98
99             tlog.Debug(tag, $"RenderTaskListAssign END (OK)");
100         }
101
102         [Test]
103         [Category("P1")]
104         [Description("RenderTaskList CreateTask.")]
105         [Property("SPEC", "Tizen.NUI.RenderTaskList.CreateTask M")]
106         [Property("SPEC_URL", "-")]
107         [Property("CRITERIA", "MR")]
108         [Property("AUTHOR", "guowei.wang@samsung.com")]
109         public void RenderTaskListCreateTask()
110         {
111             tlog.Debug(tag, $"RenderTaskListCreateTask START");
112
113             var testingTarget = Window.Instance.GetRenderTaskList();
114             Assert.IsInstanceOf<RenderTaskList>(testingTarget, "Should return RenderTaskList instance.");
115             tlog.Debug(tag, "TaskCount : " + testingTarget.GetTaskCount());
116             
117             try
118             {
119                 var task = testingTarget.CreateTask();
120                 Assert.IsInstanceOf<RenderTask>(testingTarget, "Should return RenderTask instance.");
121                 tlog.Debug(tag, "TaskCount : " + testingTarget.GetTaskCount());
122
123                 using (View view = new View() { Size = new Size(Window.Instance.WindowSize.Width, Window.Instance.WindowSize.Height) })
124                 {
125                     task.SetSourceView(view);
126                 }
127
128                 testingTarget.GetTask(0);
129                 testingTarget.RemoveTask(task);
130             }
131             catch (Exception e)
132             {
133                 tlog.Info(tag, e.Message.ToString());
134                 Assert.Fail("Caught Exception : Failed!");
135             }
136             testingTarget.Dispose();
137             tlog.Debug(tag, $"RenderTaskListCreateTask END (OK)");
138         }
139     }
140 }