3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 using System.Collections.Generic;
8 namespace Tizen.NUI.Devel.Tests
10 using tlog = Tizen.Log;
13 [Description("Internal/Widget/WidgetApplication")]
14 public class InternalWidgetApplicationTest
16 private const string tag = "NUITEST";
18 internal class MyWidgetApplication : WidgetApplication
20 public MyWidgetApplication(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
23 public void OnReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr)
25 base.ReleaseSwigCPtr(swigCPtr);
32 tlog.Info(tag, "Init() is called!");
38 tlog.Info(tag, "Destroy() is called!");
43 [Description("WidgetApplication Constructor.")]
44 [Property("SPEC", "Tizen.NUI.WidgetApplication.WidgetApplication C")]
45 [Property("SPEC_URL", "-")]
46 [Property("CRITERIA", "CONSTR")]
47 [Property("AUTHOR", "guowei.wang@samsung.com")]
48 public void WidgetApplicationConstructor()
50 tlog.Debug(tag, $"WidgetApplicationConstructor START");
52 Widget widget = new Widget();
54 var testingTarget = new WidgetApplication(widget.GetIntPtr(), false);
55 Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication");
56 Assert.IsInstanceOf<WidgetApplication>(testingTarget, "Should be an instance of WidgetApplication type.");
61 testingTarget.Dispose();
63 tlog.Debug(tag, $"WidgetApplicationConstructor END (OK)");
68 [Description("WidgetApplication Constructor. With WidgetApplication.")]
69 [Property("SPEC", "Tizen.NUI.WidgetApplication.WidgetApplication C")]
70 [Property("SPEC_URL", "-")]
71 [Property("CRITERIA", "CONSTR")]
72 [Property("AUTHOR", "guowei.wang@samsung.com")]
73 public void WidgetApplicationConstructorWithWidgetApplication()
75 tlog.Debug(tag, $"WidgetApplicationConstructorWithWidgetApplication START");
77 Widget widget = new Widget();
79 WidgetApplication widgetApplication = new WidgetApplication(widget.GetIntPtr(), false);
80 Assert.IsNotNull(widgetApplication, "Can't create success object WidgetApplication");
81 Assert.IsInstanceOf<WidgetApplication>(widgetApplication, "Should be an instance of WidgetApplication type.");
83 var testingTarget = new WidgetApplication(widgetApplication);
84 Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication");
85 Assert.IsInstanceOf<WidgetApplication>(testingTarget, "Should be an instance of WidgetApplication type.");
90 widgetApplication.Dispose();
91 widgetApplication = null;
93 testingTarget.Dispose();
95 tlog.Debug(tag, $"WidgetApplicationConstructorWithWidgetApplication END (OK)");
100 [Description("WidgetApplication Assign.")]
101 [Property("SPEC", "Tizen.NUI.WidgetApplication.Assign M")]
102 [Property("SPEC_URL", "-")]
103 [Property("CRITERIA", "MR")]
104 [Property("AUTHOR", "guowei.wang@samsung.com")]
105 public void WidgetApplicationAssign()
107 tlog.Debug(tag, $"WidgetApplicationAssign START");
109 Widget widget = new Widget();
111 WidgetApplication widgetApplication = new WidgetApplication(widget.GetIntPtr(), false);
112 Assert.IsNotNull(widgetApplication, "Can't create success object WidgetApplication");
113 Assert.IsInstanceOf<WidgetApplication>(widgetApplication, "Should be an instance of WidgetApplication type.");
115 var testingTarget = widgetApplication.Assign(widgetApplication);
116 Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication");
117 Assert.IsInstanceOf<WidgetApplication>(testingTarget, "Should be an instance of WidgetApplication type.");
122 widgetApplication.Dispose();
123 widgetApplication = null;
125 testingTarget.Dispose();
126 testingTarget = null;
127 tlog.Debug(tag, $"WidgetApplicationAssign END (OK)");
132 [Description("WidgetApplication getCPtr.")]
133 [Property("SPEC", "Tizen.NUI.WidgetApplication.getCPtr M")]
134 [Property("SPEC_URL", "-")]
135 [Property("CRITERIA", "MR")]
136 [Property("AUTHOR", "guowei.wang@samsung.com")]
137 public void WidgetApplicationgetCPtr()
139 tlog.Debug(tag, $"WidgetApplicationgetCPtr START");
141 Widget widget = new Widget();
143 var testingTarget = new WidgetApplication(widget.GetIntPtr(), false);
144 Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication");
145 Assert.IsInstanceOf<WidgetApplication>(testingTarget, "Should be an instance of WidgetApplication type.");
149 WidgetApplication.getCPtr(testingTarget);
153 tlog.Debug(tag, e.Message.ToString());
154 Assert.Fail("Caught Exception: Failed!");
160 testingTarget.Dispose();
161 testingTarget = null;
162 tlog.Debug(tag, $"WidgetApplicationgetCPtr END (OK)");
167 [Description("WidgetApplication ReleaseSwigCPtr.")]
168 [Property("SPEC", "Tizen.NUI.WidgetApplication.ReleaseSwigCPtr M")]
169 [Property("SPEC_URL", "-")]
170 [Property("CRITERIA", "MR")]
171 [Property("AUTHOR", "guowei.wang@samsung.com")]
172 public void WidgetApplicationReleaseSwigCPtr()
174 tlog.Debug(tag, $"WidgetApplicationReleaseSwigCPtr START");
176 Widget widget = new Widget();
178 var testingTarget = new MyWidgetApplication(widget.GetIntPtr(), false);
179 Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication");
180 Assert.IsInstanceOf<WidgetApplication>(testingTarget, "Should be an instance of WidgetApplication type.");
184 testingTarget.OnReleaseSwigCPtr(widget.SwigCPtr);
188 tlog.Debug(tag, e.Message.ToString());
189 Assert.Fail("Caught Exception: Failed!");
192 testingTarget.Dispose();
193 testingTarget = null;
194 tlog.Debug(tag, $"WidgetApplicationReleaseSwigCPtr END (OK)");
199 [Description("WidgetApplication RegisterWidgetCreatingFunction.")]
200 [Property("SPEC", "Tizen.NUI.WidgetApplication.RegisterWidgetCreatingFunction M")]
201 [Property("SPEC_URL", "-")]
202 [Property("CRITERIA", "MR")]
203 [Property("AUTHOR", "guowei.wang@samsung.com")]
204 public void WidgetApplicationRegisterWidgetCreatingFunction()
206 tlog.Debug(tag, $"WidgetApplicationRegisterWidgetCreatingFunction START");
208 Widget widget = new Widget();
210 var testingTarget = new MyWidgetApplication(widget.GetIntPtr(), false);
211 Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication");
212 Assert.IsInstanceOf<WidgetApplication>(testingTarget, "Should be an instance of WidgetApplication type.");
214 global::System.Collections.Generic.Dictionary<Type, string> widgetInfo = new global::System.Collections.Generic.Dictionary<Type, string>(){
215 { typeof(Widget), "w1@org.tizen.WidgetApp"} };
217 testingTarget.RegisterWidgetInfo(widgetInfo);
221 testingTarget.RegisterWidgetCreatingFunction();
225 tlog.Debug(tag, e.Message.ToString());
226 Assert.Fail("Caught Exception: Failed!");
232 testingTarget.Dispose();
233 testingTarget = null;
234 tlog.Debug(tag, $"WidgetApplicationRegisterWidgetCreatingFunction END (OK)");
239 [Description("WidgetApplication AddWidgetInstance.")]
240 [Property("SPEC", "Tizen.NUI.WidgetApplication.AddWidgetInstance M")]
241 [Property("SPEC_URL", "-")]
242 [Property("CRITERIA", "MR")]
243 [Property("AUTHOR", "guowei.wang@samsung.com")]
244 public void WidgetApplicationAddWidgetInstance()
246 tlog.Debug(tag, $"WidgetApplicationAddWidgetInstance START");
248 Widget widget = new Widget();
250 var testingTarget = new WidgetApplication(widget.GetIntPtr(), false);
251 Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication");
252 Assert.IsInstanceOf<WidgetApplication>(testingTarget, "Should be an instance of WidgetApplication type.");
256 testingTarget.AddWidgetInstance(widget);
260 tlog.Debug(tag, e.Message.ToString());
261 Assert.Fail("Caught Exception: Failed!");
267 testingTarget.Dispose();
268 testingTarget = null;
269 tlog.Debug(tag, $"WidgetApplicationAddWidgetInstance END (OK)");
274 [Description("WidgetApplication RegisterWidgetInfo.")]
275 [Property("SPEC", "Tizen.Applications.WidgetApplication.RegisterWidgetInfo M")]
276 [Property("SPEC_URL", "-")]
277 [Property("CRITERIA", "MR")]
278 [Property("AUTHOR", "guowei.wang@samsung.com")]
279 public void WidgetApplicationRegisterWidgetInfo()
281 tlog.Debug(tag, $"WidgetApplicationRegisterWidgetInfo START");
283 Widget widget = new Widget();
285 var testingTarget = new WidgetApplication(widget.GetIntPtr(), false);
286 Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication");
287 Assert.IsInstanceOf<WidgetApplication>(testingTarget, "Should be an instance of WidgetApplication type.");
289 global::System.Collections.Generic.Dictionary<Type, string> widgetInfo = new global::System.Collections.Generic.Dictionary<Type, string>(){
290 { typeof(Widget), "w1@org.tizen.WidgetApp"} };
294 testingTarget.RegisterWidgetInfo(widgetInfo);
298 tlog.Debug(tag, e.Message.ToString());
299 Assert.Fail("Caught Exception: Failed!");
305 testingTarget.Dispose();
306 testingTarget = null;
307 tlog.Debug(tag, $"WidgetApplicationRegisterWidgetInfo END (OK)");
312 [Description("WidgetApplication AddWidgetInfo.")]
313 [Property("SPEC", "Tizen.Applications.WidgetApplication.AddWidgetInfo M")]
314 [Property("SPEC_URL", "-")]
315 [Property("CRITERIA", "MR")]
316 [Property("AUTHOR", "guowei.wang@samsung.com")]
317 public void WidgetApplicationAddWidgetInfo()
319 tlog.Debug(tag, $"WidgetApplicationAddWidgetInfo START");
321 Widget widget = new Widget();
323 var testingTarget = new WidgetApplication(widget.GetIntPtr(), false);
324 Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication");
325 Assert.IsInstanceOf<WidgetApplication>(testingTarget, "Should be an instance of WidgetApplication type.");
327 global::System.Collections.Generic.Dictionary<Type, string> widgetInfo = new global::System.Collections.Generic.Dictionary<Type, string>(){
328 { typeof(Widget), "w1@org.tizen.WidgetApp"} };
329 testingTarget.RegisterWidgetInfo(widgetInfo);
333 testingTarget.AddWidgetInfo(new global::System.Collections.Generic.Dictionary<Type, string>(){
334 { typeof(WidgetApplication), "w2@org.tizen.WidgetApp"} });
338 tlog.Debug(tag, e.Message.ToString());
339 Assert.Fail("Caught Exception: Failed!");
345 testingTarget.Dispose();
346 testingTarget = null;
347 tlog.Debug(tag, $"WidgetApplicationAddWidgetInfo END (OK)");
352 [Description("WidgetApplication WidgetCreateFunction.")]
353 [Property("SPEC", "Tizen.Applications.WidgetApplication.WidgetCreateFunction M")]
354 [Property("SPEC_URL", "-")]
355 [Property("CRITERIA", "MR")]
356 [Property("AUTHOR", "guowei.wang@samsung.com")]
357 public void WidgetApplicationWidgetCreateFunction()
359 tlog.Debug(tag, $"WidgetApplicationWidgetCreateFunction START");
361 tlog.Debug(tag, "WidgetApplication.Instance : " + WidgetApplication.Instance);
365 string widgetName = null;
366 WidgetApplication.WidgetCreateFunction(ref widgetName);
370 tlog.Debug(tag, e.Message.ToString());
371 Assert.Fail("Caught Exception: Failed!");
374 tlog.Debug(tag, $"WidgetApplicationWidgetCreateFunction END (OK)");
379 [Description("WidgetApplication WidgetInfo.")]
380 [Property("SPEC", "Tizen.Applications.WidgetApplication.WidgetInfo M")]
381 [Property("SPEC_URL", "-")]
382 [Property("CRITERIA", "MR")]
383 [Property("AUTHOR", "guowei.wang@samsung.com")]
384 public void WidgetApplicationWidgetInfo()
386 tlog.Debug(tag, $"WidgetApplicationWidgetInfo START");
388 Widget widget = new Widget();
390 var testingTarget = new WidgetApplication(widget.GetIntPtr(), false);
391 Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication");
392 Assert.IsInstanceOf<WidgetApplication>(testingTarget, "Should be an instance of WidgetApplication type.");
394 global::System.Collections.Generic.Dictionary<Type, string> widgetInfo = new global::System.Collections.Generic.Dictionary<Type, string>(){
395 { typeof(Widget), "w1@org.tizen.WidgetApp"} };
396 testingTarget.RegisterWidgetInfo(widgetInfo);
398 tlog.Debug(tag, "testingTarget.WidgetInfo : " + testingTarget.WidgetInfo);
403 testingTarget.Dispose();
404 testingTarget = null;
406 tlog.Debug(tag, $"WidgetApplicationWidgetInfo END (OK)");