[NUI] Update TCs of NUI.Devel.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / Layouting / TSLayoutController.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/Layouting/LayoutController")]
13     public class InternalLayoutControllerTest
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("LayoutController GetId.")]
32         [Property("SPEC", "Tizen.NUI.LayoutController.GetId M")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "MR")]
35         [Property("AUTHOR", "guowei.wang@samsung.com")]
36         public void LayoutControllerGetId()
37         {
38             tlog.Debug(tag, $"LayoutControllerGetId START");
39
40             var testingTarget = new LayoutController(Window.Instance);
41             Assert.IsNotNull(testingTarget, "Can't create success object LayoutController");
42             Assert.IsInstanceOf<LayoutController>(testingTarget, "Should be an instance of LayoutController type.");
43
44             tlog.Debug(tag, testingTarget.GetId().ToString());
45
46             testingTarget.Dispose();
47             // disposed
48             testingTarget.Dispose();
49             tlog.Debug(tag, $"LayoutControllerGetId END (OK)");
50         }
51
52         [Test]
53         [Category("P1")]
54         [Description("LayoutController RequestLayout.")]
55         [Property("SPEC", "Tizen.NUI.LayoutController.RequestLayout M")]
56         [Property("SPEC_URL", "-")]
57         [Property("CRITERIA", "MR")]
58         [Property("AUTHOR", "guowei.wang@samsung.com")]
59         public void LayoutControllerRequestLayout()
60         {
61             tlog.Debug(tag, $"LayoutControllerRequestLayout START");
62
63             var testingTarget = new LayoutController(Window.Instance);
64             Assert.IsNotNull(testingTarget, "Can't create success object LayoutController");
65             Assert.IsInstanceOf<LayoutController>(testingTarget, "Should be an instance of LayoutController type.");
66
67             using (LayoutItem layoutItem = new LayoutItem())
68             {
69                 using (View view = new View())
70                 {
71                     view.Name = "parentView";
72                     layoutItem.AttachToOwner(view);
73
74                     try
75                     {
76                         testingTarget.RequestLayout(layoutItem);
77                     }
78                     catch (Exception e)
79                     {
80                         tlog.Debug(tag, e.Message.ToString());
81                         Assert.Fail("Caught Exception : Failed!");
82                     }
83                 }
84
85             }
86
87             testingTarget.Dispose();
88             tlog.Debug(tag, $"LayoutControllerRequestLayout END (OK)");
89         }
90
91         [Test]
92         [Category("P1")]
93         [Description("LayoutController RequestLayout.")]
94         [Property("SPEC", "Tizen.NUI.LayoutController.RequestLayout M")]
95         [Property("SPEC_URL", "-")]
96         [Property("CRITERIA", "MR")]
97         [Property("AUTHOR", "guowei.wang@samsung.com")]
98         public void LayoutControllerRequestLayoutParentNotNUll()
99         {
100             tlog.Debug(tag, $"LayoutControllerRequestLayoutParentNotNUll START");
101
102             var testingTarget = new LayoutController(Window.Instance);
103             Assert.IsNotNull(testingTarget, "Can't create success object LayoutController");
104             Assert.IsInstanceOf<LayoutController>(testingTarget, "Should be an instance of LayoutController type.");
105
106             using (LayoutGroup group = new LayoutGroup())
107             {
108                 using (LayoutItem layoutItem = new LayoutItem())
109                 {
110                     group.Add(layoutItem);
111                     try
112                     {
113                         testingTarget.RequestLayout(layoutItem);
114                     }
115                     catch (Exception e)
116                     {
117                         tlog.Debug(tag, e.Message.ToString());
118                         Assert.Fail("Caught Exception : Failed!");
119                     }
120                 }
121             }
122
123             testingTarget.Dispose();
124             tlog.Debug(tag, $"LayoutControllerRequestLayoutParentNotNUll END (OK)");
125         }
126
127         [Test]
128         [Category("P1")]
129         [Description("LayoutController GetCoreAnimation.")]
130         [Property("SPEC", "Tizen.NUI.LayoutController.GetCoreAnimation M")]
131         [Property("SPEC_URL", "-")]
132         [Property("CRITERIA", "MR")]
133         [Property("AUTHOR", "guowei.wang@samsung.com")]
134         public void LayoutControllerGetCoreAnimation()
135         {
136             tlog.Debug(tag, $"LayoutControllerGetCoreAnimation START");
137
138             var testingTarget = new LayoutController(Window.Instance);
139             Assert.IsNotNull(testingTarget, "Can't create success object LayoutController");
140             Assert.IsInstanceOf<LayoutController>(testingTarget, "Should be an instance of LayoutController type.");
141
142             var result = testingTarget.GetCoreAnimation();
143             tlog.Debug(tag, "Get core animation : " + result);
144
145             testingTarget.Dispose();
146             tlog.Debug(tag, $"LayoutControllerGetCoreAnimation END (OK)");
147         }
148     }
149 }