Merge remote-tracking branch 'origin/master' into tizen
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / Common / TSAny.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/Any")]
13     public class InternalAnyTest
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("Any constructor.")]
32         [Property("SPEC", "Tizen.NUI.Any.Any C")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "CONSTR")]
35         [Property("AUTHOR", "guowei.wang@samsung.com")]
36         public void AnyConstructor()
37         {
38             tlog.Debug(tag, $"AnyConstructor START");
39
40             var testingTarget = new Any();
41             Assert.IsNotNull(testingTarget, "Can't create success object Any");
42             Assert.IsInstanceOf<Any>(testingTarget, "Should be an instance of Any type.");
43
44             testingTarget.Dispose();
45             tlog.Debug(tag, $"AnyConstructor END (OK)");
46         }
47
48         [Test]
49         [Category("P1")]
50         [Description("Any constructor. With Any.")]
51         [Property("SPEC", "Tizen.NUI.Any.Any C")]
52         [Property("SPEC_URL", "-")]
53         [Property("CRITERIA", "CONSTR")]
54         [Property("AUTHOR", "guowei.wang@samsung.com")]
55         public void AnyConstructorWithAny()
56         {
57             tlog.Debug(tag, $"AnyConstructorWithAny START");
58
59             using (Any any = new Any())
60             {
61                 var testingTarget = new Any(any);
62                 Assert.IsNotNull(testingTarget, "Can't create success object Any");
63                 Assert.IsInstanceOf<Any>(testingTarget, "Should be an instance of Any type.");
64
65                 testingTarget.Dispose();
66             }
67
68             tlog.Debug(tag, $"AnyConstructorWithAny END (OK)");
69         }
70
71         [Test]
72         [Category("P1")]
73         [Description("Any Assign.")]
74         [Property("SPEC", "Tizen.NUI.Any.Assign M")]
75         [Property("SPEC_URL", "-")]
76         [Property("CRITERIA", "MR")]
77         [Property("AUTHOR", "guowei.wang@samsung.com")]
78         public void AnyAssign()
79         {
80             tlog.Debug(tag, $"AnyAssign START");
81
82             using (Any any = new Any())
83             {
84                 var testingTarget = new Any(any);
85                 Assert.IsNotNull(testingTarget, "Can't create success object Any");
86                 Assert.IsInstanceOf<Any>(testingTarget, "Should be an instance of Any type.");
87
88                 try
89                 {
90                     any.Assign(testingTarget);
91                 }
92                 catch (Exception e)
93                 {
94                     tlog.Debug(tag, e.Message.ToString());
95                     Assert.Fail("Caught Exception: Failed!");
96                 }
97
98                 testingTarget.Dispose();
99             }
100
101             tlog.Debug(tag, $"AnyAssign END (OK)");
102         }
103
104         //[Test]
105         //[Category("P1")]
106         //[Description("Any AssertAlways.")]
107         //[Property("SPEC", "Tizen.NUI.Any.AssertAlways M")]
108         //[Property("SPEC_URL", "-")]
109         //[Property("CRITERIA", "MR")]
110         //[Property("AUTHOR", "guowei.wang@samsung.com")]
111         //public void AnyAssertAlways()
112         //{
113         //    tlog.Debug(tag, $"AnyAssertAlways START");
114
115         //    try
116         //    {
117         //        Any.AssertAlways("This is the test for Any class.");
118         //    }
119         //    catch (Exception e)
120         //    {
121         //        tlog.Debug(tag, e.Message.ToString());
122         //        Assert.Fail("Caught Exception: Failed!");
123         //    }
124            
125         //    tlog.Debug(tag, $"AnyAssertAlways END (OK)");
126         //}
127
128         [Test]
129         [Category("P1")]
130         [Description("Any GetType.")]
131         [Property("SPEC", "Tizen.NUI.Any.GetType M")]
132         [Property("SPEC_URL", "-")]
133         [Property("CRITERIA", "MR")]
134         [Property("AUTHOR", "guowei.wang@samsung.com")]
135         public void AnyGetType()
136         {
137             tlog.Debug(tag, $"AnyGetType START");
138
139             using (Any any = new Any())
140             {
141                 var testingTarget = new Any(any);
142                 Assert.IsNotNull(testingTarget, "Can't create success object Any");
143                 Assert.IsInstanceOf<Any>(testingTarget, "Should be an instance of Any type.");
144
145                 try
146                 {
147                     testingTarget.GetType();
148                 }
149                 catch (Exception e)
150                 {
151                     tlog.Debug(tag, e.Message.ToString());
152                     Assert.Fail("Caught Exception: Failed!");
153                 }
154
155                 testingTarget.Dispose();
156             }
157
158             tlog.Debug(tag, $"AnyGetType END (OK)");
159         }
160
161         [Test]
162         [Category("P1")]
163         [Description("Any Empty.")]
164         [Property("SPEC", "Tizen.NUI.Any.Empty M")]
165         [Property("SPEC_URL", "-")]
166         [Property("CRITERIA", "MR")]
167         [Property("AUTHOR", "guowei.wang@samsung.com")]
168         public void AnyEmpty()
169         {
170             tlog.Debug(tag, $"AnyEmpty START");
171
172             using (Any any = new Any())
173             {
174                 var testingTarget = new Any(any);
175                 Assert.IsNotNull(testingTarget, "Can't create success object Any");
176                 Assert.IsInstanceOf<Any>(testingTarget, "Should be an instance of Any type.");
177
178                 try
179                 {
180                     var result = testingTarget.Empty();
181                     tlog.Debug(tag, "result :" + result);
182                 }
183                 catch (Exception e)
184                 {
185                     tlog.Debug(tag, e.Message.ToString());
186                     Assert.Fail("Caught Exception: Failed!");
187                 }
188
189                 testingTarget.Dispose();
190             }
191
192             tlog.Debug(tag, $"AnyEmpty END (OK)");
193         }
194
195         [Test]
196         [Category("P1")]
197         [Description("Any.AnyContainerBase constructor.")]
198         [Property("SPEC", "Tizen.NUI.Any.AnyContainerBase.AnyContainerBase C")]
199         [Property("SPEC_URL", "-")]
200         [Property("CRITERIA", "CONSTR")]
201         [Property("AUTHOR", "guowei.wang@samsung.com")]
202         public void AnyContainerBaseConstructor()
203         {
204             tlog.Debug(tag, $"AnyContainerBaseConstructor START");
205
206             SWIGTYPE_p_std__type_info type = new SWIGTYPE_p_std__type_info(new View().SwigCPtr.Handle);
207             SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase cloneFunc = new SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase(new ImageView().SwigCPtr.Handle);
208             SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void deleteFunc = new SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void(new TextLabel().SwigCPtr.Handle);
209
210             var testingTarget = new Any.AnyContainerBase(type, cloneFunc, deleteFunc);
211             Assert.IsNotNull(testingTarget, "Can't create success object AnyContainerBase");
212             Assert.IsInstanceOf<Any.AnyContainerBase>(testingTarget, "Should be an instance of AnyContainerBase type.");
213
214             testingTarget.Dispose();
215             tlog.Debug(tag, $"AnyContainerBaseConstructor END (OK)");
216         }
217
218         [Test]
219         [Category("P1")]
220         [Description("Any.AnyContainerBase GetType.")]
221         [Property("SPEC", "Tizen.NUI.Any.AnyContainerBase.GetType M")]
222         [Property("SPEC_URL", "-")]
223         [Property("CRITERIA", "MR")]
224         [Property("AUTHOR", "guowei.wang@samsung.com")]
225         public void AnyContainerBaseGetType()
226         {
227             tlog.Debug(tag, $"AnyContainerBaseGetType START");
228
229             SWIGTYPE_p_std__type_info type = new SWIGTYPE_p_std__type_info(new View().SwigCPtr.Handle);
230             SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase cloneFunc = new SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase(new ImageView().SwigCPtr.Handle);
231             SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void deleteFunc = new SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void(new TextLabel().SwigCPtr.Handle);
232
233             var testingTarget = new Any.AnyContainerBase(type, cloneFunc, deleteFunc);
234             Assert.IsNotNull(testingTarget, "Can't create success object AnyContainerBase");
235             Assert.IsInstanceOf<Any.AnyContainerBase>(testingTarget, "Should be an instance of AnyContainerBase type.");
236
237             try
238             {
239                 testingTarget.GetType();
240             }
241             catch (Exception e)
242             {
243                 tlog.Debug(tag, e.Message.ToString());
244                 Assert.Fail("Caught Exception: Failed!");
245             }
246
247             testingTarget.Dispose();
248             tlog.Debug(tag, $"AnyContainerBaseGetType END (OK)");
249         }
250
251         [Test]
252         [Category("P1")]
253         [Description("Any.AnyContainerBase mType.")]
254         [Property("SPEC", "Tizen.NUI.Any.AnyContainerBase.mType A")]
255         [Property("SPEC_URL", "-")]
256         [Property("CRITERIA", "PRO")]
257         [Property("AUTHOR", "guowei.wang@samsung.com")]
258         public void AnyContainerBasemType()
259         {
260             tlog.Debug(tag, $"AnyContainerBasemType START");
261
262             SWIGTYPE_p_std__type_info type = new SWIGTYPE_p_std__type_info(new View().SwigCPtr.Handle);
263             SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase cloneFunc = new SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase(new ImageView().SwigCPtr.Handle);
264             SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void deleteFunc = new SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void(new TextLabel().SwigCPtr.Handle);
265
266             var testingTarget = new Any.AnyContainerBase(type, cloneFunc, deleteFunc);
267             Assert.IsNotNull(testingTarget, "Can't create success object AnyContainerBase");
268             Assert.IsInstanceOf<Any.AnyContainerBase>(testingTarget, "Should be an instance of AnyContainerBase type.");
269
270             tlog.Debug(tag, "mType : " + testingTarget.mType);
271
272             testingTarget.Dispose();
273             tlog.Debug(tag, $"AnyContainerBasemType END (OK)");
274         }
275
276         [Test]
277         [Category("P1")]
278         [Description("Any.AnyContainerBase mCloneFunc.")]
279         [Property("SPEC", "Tizen.NUI.Any.AnyContainerBase.mCloneFunc A")]
280         [Property("SPEC_URL", "-")]
281         [Property("CRITERIA", "PRO")]
282         [Property("AUTHOR", "guowei.wang@samsung.com")]
283         public void AnyContainerBasemCloneFunc()
284         {
285             tlog.Debug(tag, $"AnyContainerBasemCloneFunc START");
286
287             SWIGTYPE_p_std__type_info type = new SWIGTYPE_p_std__type_info(new View().SwigCPtr.Handle);
288             SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase cloneFunc = new SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase(new ImageView().SwigCPtr.Handle);
289             SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void deleteFunc = new SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void(new TextLabel().SwigCPtr.Handle);
290
291             var testingTarget = new Any.AnyContainerBase(type, cloneFunc, deleteFunc);
292             Assert.IsNotNull(testingTarget, "Can't create success object AnyContainerBase");
293             Assert.IsInstanceOf<Any.AnyContainerBase>(testingTarget, "Should be an instance of AnyContainerBase type.");
294
295             tlog.Debug(tag, "mType : " + testingTarget.mCloneFunc);
296
297             testingTarget.mCloneFunc = new SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase(new TextLabel().SwigCPtr.Handle);
298             tlog.Debug(tag, "mType : " + testingTarget.mCloneFunc);
299
300             testingTarget.Dispose();
301             tlog.Debug(tag, $"AnyContainerBasemCloneFunc END (OK)");
302         }
303
304         [Test]
305         [Category("P1")]
306         [Description("Any.AnyContainerBase mDeleteFunc.")]
307         [Property("SPEC", "Tizen.NUI.Any.AnyContainerBase.mDeleteFunc A")]
308         [Property("SPEC_URL", "-")]
309         [Property("CRITERIA", "PRO")]
310         [Property("AUTHOR", "guowei.wang@samsung.com")]
311         public void AnyContainerBasemDeleteFunc()
312         {
313             tlog.Debug(tag, $"AnyContainerBasemDeleteFunc START");
314
315             SWIGTYPE_p_std__type_info type = new SWIGTYPE_p_std__type_info(new View().SwigCPtr.Handle);
316             SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase cloneFunc = new SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase(new ImageView().SwigCPtr.Handle);
317             SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void deleteFunc = new SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void(new TextLabel().SwigCPtr.Handle);
318
319             var testingTarget = new Any.AnyContainerBase(type, cloneFunc, deleteFunc);
320             Assert.IsNotNull(testingTarget, "Can't create success object AnyContainerBase");
321             Assert.IsInstanceOf<Any.AnyContainerBase>(testingTarget, "Should be an instance of AnyContainerBase type.");
322
323             tlog.Debug(tag, "mType : " + testingTarget.mDeleteFunc);
324
325             testingTarget.mDeleteFunc = new SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void(new ImageView().SwigCPtr.Handle);
326             tlog.Debug(tag, "mType : " + testingTarget.mDeleteFunc);
327
328             testingTarget.Dispose();
329             tlog.Debug(tag, $"AnyContainerBasemDeleteFunc END (OK)");
330         }
331
332         [Test]
333         [Category("P1")]
334         [Description("Any.AnyContainerBase mContainer.")]
335         [Property("SPEC", "Tizen.NUI.Any.AnyContainerBase.mContainer A")]
336         [Property("SPEC_URL", "-")]
337         [Property("CRITERIA", "PRO")]
338         [Property("AUTHOR", "guowei.wang@samsung.com")]
339         public void AnyContainerBasemContainer()
340         {
341             tlog.Debug(tag, $"AnyContainerBasemContainer START");
342
343             using (Any any = new Any())
344             {
345                 var testingTarget = new Any(any);
346                 Assert.IsNotNull(testingTarget, "Can't create success object Any");
347                 Assert.IsInstanceOf<Any>(testingTarget, "Should be an instance of Any type.");
348
349                 tlog.Debug(tag, "mContainer : " + testingTarget.mContainer);
350
351                 SWIGTYPE_p_std__type_info type = new SWIGTYPE_p_std__type_info(new View().SwigCPtr.Handle);
352                 SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase cloneFunc = new SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase(new ImageView().SwigCPtr.Handle);
353                 SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void deleteFunc = new SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void(new TextLabel().SwigCPtr.Handle);
354                 Any.AnyContainerBase container = new Any.AnyContainerBase(type, cloneFunc, deleteFunc);
355
356                 try
357                 {
358                     testingTarget.mContainer = container;
359                     tlog.Debug(tag, "mContainer : " + testingTarget.mContainer);
360                 }
361                 catch (Exception e)
362                 {
363                     tlog.Debug(tag, e.Message.ToString());
364                     Assert.Fail("Caught Exception: Failed!");
365                 }
366             }
367
368             tlog.Debug(tag, $"AnyContainerBasemContainer END (OK)");
369         }
370     }
371 }