04ecfc6a3739ed77007769791108c2546a02e0aa
[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 LayoutControllerRequestLayoutParentIsNUll()
99         {
100             tlog.Debug(tag, $"LayoutControllerRequestLayoutParentIsNUll 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 (LayoutItem layoutItem = new LayoutItem())
107             {
108                 try
109                 {
110                     testingTarget.RequestLayout(layoutItem);
111                 }
112                 catch (Exception e)
113                 {
114                     tlog.Debug(tag, e.Message.ToString());
115                     Assert.Fail("Caught Exception : Failed!");
116                 }
117             }
118
119             testingTarget.Dispose();
120             tlog.Debug(tag, $"LayoutControllerRequestLayoutParentIsNUll END (OK)");
121         }
122
123         [Test]
124         [Category("P1")]
125         [Description("LayoutController GetCoreAnimation.")]
126         [Property("SPEC", "Tizen.NUI.LayoutController.GetCoreAnimation M")]
127         [Property("SPEC_URL", "-")]
128         [Property("CRITERIA", "MR")]
129         [Property("AUTHOR", "guowei.wang@samsung.com")]
130         public void LayoutControllerGetCoreAnimation()
131         {
132             tlog.Debug(tag, $"LayoutControllerGetCoreAnimation START");
133
134             var testingTarget = new LayoutController(Window.Instance);
135             Assert.IsNotNull(testingTarget, "Can't create success object LayoutController");
136             Assert.IsInstanceOf<LayoutController>(testingTarget, "Should be an instance of LayoutController type.");
137
138             var result = testingTarget.GetCoreAnimation();
139             tlog.Debug(tag, "Get core animation : " + result);
140
141             testingTarget.Dispose();
142             tlog.Debug(tag, $"LayoutControllerGetCoreAnimation END (OK)");
143         }
144     }
145 }