Merge remote-tracking branch 'origin/master' into tizen
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Widget / TSWidgetViewManager.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/WidgetViewManager")]
14     public class PublicWidgetViewManagerTest
15     {
16         private const string tag = "NUITEST";
17         private Widget widget = null;
18
19         [SetUp]
20         public void Init()
21         {
22             tlog.Info(tag, "Init() is called!");
23
24             widget = new Widget();
25             tlog.Debug(tag, "widget.Id : " + widget.Id);
26         }
27
28         [TearDown]
29         public void Destroy()
30         {
31             widget.Dispose();
32             widget = null;
33
34             tlog.Info(tag, "Destroy() is called!");
35         }
36
37         [Test]
38         [Category("P1")]
39         [Description("WidgetViewManager constructor.")]
40         [Property("SPEC", "Tizen.NUI.WidgetViewManager.WidgetViewManager C")]
41         [Property("SPEC_URL", "-")]
42         [Property("CRITERIA", "CONSTR")]
43         [Property("AUTHOR", "guowei.wang@samsung.com")]
44         public void WidgetViewManagerConstructor()
45         {
46             tlog.Debug(tag, $"WidgetViewManagerConstructor START");
47
48             var testingTarget = new WidgetViewManager(widget.GetIntPtr(), false);
49             Assert.IsNotNull(testingTarget, "Can't create success object WidgetViewManager");
50             Assert.IsInstanceOf<WidgetViewManager>(testingTarget, "Should be an instance of WidgetViewManager type.");
51
52             testingTarget.Dispose();
53             tlog.Debug(tag, $"WidgetViewManagerConstructor END (OK)");
54         }
55
56         [Test]
57         [Category("P1")]
58         [Description("WidgetViewManager constructor. With WidgetViewManager.")]
59         [Property("SPEC", "Tizen.NUI.WidgetViewManager.WidgetViewManager C")]
60         [Property("SPEC_URL", "-")]
61         [Property("CRITERIA", "CONSTR")]
62         [Property("AUTHOR", "guowei.wang@samsung.com")]
63         public void WidgetViewManagerConstructorWithWidgetViewManager()
64         {
65             tlog.Debug(tag, $"WidgetViewManagerConstructorWithWidgetViewManager START");
66
67             WidgetViewManager manager = new WidgetViewManager(widget.GetIntPtr(), false);
68             Assert.IsNotNull(manager, "Can't create success object WidgetViewManager");
69             Assert.IsInstanceOf<WidgetViewManager>(manager, "Should be an instance of WidgetViewManager type.");
70
71             var testingTarget = new WidgetViewManager(manager);
72             Assert.IsNotNull(testingTarget, "Can't create success object WidgetViewManager");
73             Assert.IsInstanceOf<WidgetViewManager>(testingTarget, "Should be an instance of WidgetViewManager type.");
74
75             manager.Dispose();
76             testingTarget.Dispose();
77             tlog.Debug(tag, $"WidgetViewManagerConstructorWithWidgetViewManager END (OK)");
78         }
79
80         [Test]
81         [Category("P1")]
82         [Description("WidgetViewManager Instance.")]
83         [Property("SPEC", "Tizen.NUI.WidgetViewManager.Instance A")]
84         [Property("SPEC_URL", "-")]
85         [Property("CRITERIA", "PRO")]
86         [Property("AUTHOR", "guowei.wang@samsung.com")]
87         public void WidgetViewManagerInstance()
88         {
89             tlog.Debug(tag, $"WidgetViewManagerInstance START");
90
91             try
92             {
93                 tlog.Debug(tag, "WidgetViewManager.Instance : " + WidgetViewManager.Instance);
94             }
95             catch (Exception e)
96             {
97                 tlog.Debug(tag, e.Message.ToString());
98                 Assert.Fail("Caught Exception: Failed!");
99             }
100
101             tlog.Debug(tag, $"WidgetViewManagerInstance END (OK)");
102         }
103
104         //[Test]
105         //[Category("P1")]
106         //[Description("WidgetViewManager AddWidget.")]
107         //[Property("SPEC", "Tizen.NUI.WidgetViewManager.AddWidget M")]
108         //[Property("SPEC_URL", "-")]
109         //[Property("CRITERIA", "MR")]
110         //[Property("AUTHOR", "guowei.wang@samsung.com")]
111         //public void WidgetViewManagerAddWidget()
112         //{
113         //    tlog.Debug(tag, $"WidgetViewManagerAddWidget START");
114
115         //    var testingTarget = new WidgetViewManager(widget.GetIntPtr(), false);
116
117         //    var result = testingTarget.AddWidget(widget.Id.ToString(), "WidgetView", 100, 200, 50.0f);
118         //    Assert.IsNotNull(result, "Can't create success object WidgetView");
119         //    Assert.IsInstanceOf<WidgetView>(result, "Should be an instance of WidgetView type.");
120
121         //    testingTarget.Dispose();
122
123         //    tlog.Debug(tag, $"WidgetViewManagerAddWidget END (OK)");
124         //}
125
126         [Test]
127         [Category("P1")]
128         [Description("WidgetViewManager getCPtr.")]
129         [Property("SPEC", "Tizen.NUI.WidgetViewManager.getCPtr A")]
130         [Property("SPEC_URL", "-")]
131         [Property("CRITERIA", "PRO")]
132         [Property("AUTHOR", "guowei.wang@samsung.com")]
133         public void WidgetViewManagergetCPtr()
134         {
135             tlog.Debug(tag, $"WidgetViewManagergetCPtr START");
136
137             var testingTarget = new WidgetViewManager(widget.GetIntPtr(), false);
138             Assert.IsNotNull(testingTarget, "Can't create success object WidgetViewManager");
139             Assert.IsInstanceOf<WidgetViewManager>(testingTarget, "Should be an instance of WidgetViewManager type.");
140
141             try
142             {
143
144                 WidgetViewManager.getCPtr(testingTarget);
145             }
146             catch (Exception e)
147             {
148                 tlog.Debug(tag, e.Message.ToString());
149                 Assert.Fail("Caught Exception: Failed!");
150             }
151
152             tlog.Debug(tag, $"WidgetViewManagergetCPtr END (OK)");
153         }
154
155         [Test]
156         [Category("P1")]
157         [Description("WidgetViewManager DownCast.")]
158         [Property("SPEC", "Tizen.NUI.WidgetViewManager.DownCast A")]
159         [Property("SPEC_URL", "-")]
160         [Property("CRITERIA", "PRO")]
161         [Property("AUTHOR", "guowei.wang@samsung.com")]
162         public void WidgetViewManagerDownCast()
163         {
164             tlog.Debug(tag, $"WidgetViewManagerDownCast START");
165
166             var testingTarget = new WidgetViewManager(widget.GetIntPtr(), false);
167             Assert.IsNotNull(testingTarget, "Can't create success object WidgetViewManager");
168             Assert.IsInstanceOf<WidgetViewManager>(testingTarget, "Should be an instance of WidgetViewManager type.");
169
170             try
171             {
172
173                 WidgetViewManager.DownCast(testingTarget);
174             }
175             catch (Exception e)
176             {
177                 tlog.Debug(tag, e.Message.ToString());
178                 Assert.Fail("Caught Exception: Failed!");
179             }
180
181             tlog.Debug(tag, $"WidgetViewManagerDownCast END (OK)");
182         }
183
184         [Test]
185         [Category("P1")]
186         [Description("WidgetViewManager Assign.")]
187         [Property("SPEC", "Tizen.NUI.WidgetViewManager.Assign A")]
188         [Property("SPEC_URL", "-")]
189         [Property("CRITERIA", "PRO")]
190         [Property("AUTHOR", "guowei.wang@samsung.com")]
191         public void WidgetViewManagerAssign()
192         {
193             tlog.Debug(tag, $"WidgetViewManagerAssign START");
194
195             var testingTarget = new WidgetViewManager(widget.GetIntPtr(), false);
196             Assert.IsNotNull(testingTarget, "Can't create success object WidgetViewManager");
197             Assert.IsInstanceOf<WidgetViewManager>(testingTarget, "Should be an instance of WidgetViewManager type.");
198
199             try
200             {
201                 WidgetViewManager.Instance.Assign(testingTarget);
202             }
203             catch (Exception e)
204             {
205                 tlog.Debug(tag, e.Message.ToString());
206                 Assert.Fail("Caught Exception: Failed!");
207             }
208
209             tlog.Debug(tag, $"WidgetViewManagerAssign END (OK)");
210         }
211     }
212 }