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 ReleaseSwigCPtr.")]
133 [Property("SPEC", "Tizen.NUI.WidgetApplication.ReleaseSwigCPtr M")]
134 [Property("SPEC_URL", "-")]
135 [Property("CRITERIA", "MR")]
136 [Property("AUTHOR", "guowei.wang@samsung.com")]
137 public void WidgetApplicationReleaseSwigCPtr()
139 tlog.Debug(tag, $"WidgetApplicationReleaseSwigCPtr START");
141 Widget widget = new Widget();
143 var testingTarget = new MyWidgetApplication(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 testingTarget.OnReleaseSwigCPtr(widget.SwigCPtr);
153 tlog.Debug(tag, e.Message.ToString());
154 Assert.Fail("Caught Exception: Failed!");
157 testingTarget.Dispose();
158 testingTarget = null;
159 tlog.Debug(tag, $"WidgetApplicationReleaseSwigCPtr END (OK)");
164 [Description("WidgetApplication AddWidgetInstance.")]
165 [Property("SPEC", "Tizen.NUI.WidgetApplication.AddWidgetInstance M")]
166 [Property("SPEC_URL", "-")]
167 [Property("CRITERIA", "MR")]
168 [Property("AUTHOR", "guowei.wang@samsung.com")]
169 public void WidgetApplicationAddWidgetInstance()
171 tlog.Debug(tag, $"WidgetApplicationAddWidgetInstance START");
173 Widget widget = new Widget();
175 var testingTarget = new WidgetApplication(widget.GetIntPtr(), false);
176 Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication");
177 Assert.IsInstanceOf<WidgetApplication>(testingTarget, "Should be an instance of WidgetApplication type.");
181 testingTarget.AddWidgetInstance(widget);
185 tlog.Debug(tag, e.Message.ToString());
186 Assert.Fail("Caught Exception: Failed!");
192 testingTarget.Dispose();
193 testingTarget = null;
194 tlog.Debug(tag, $"WidgetApplicationAddWidgetInstance END (OK)");
199 [Description("WidgetApplication RegisterWidgetInfo.")]
200 [Property("SPEC", "Tizen.Applications.WidgetApplication.RegisterWidgetInfo M")]
201 [Property("SPEC_URL", "-")]
202 [Property("CRITERIA", "MR")]
203 [Property("AUTHOR", "guowei.wang@samsung.com")]
204 public void WidgetApplicationRegisterWidgetInfo()
206 tlog.Debug(tag, $"WidgetApplicationRegisterWidgetInfo START");
208 Widget widget = new Widget();
210 var testingTarget = new WidgetApplication(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"} };
219 testingTarget.RegisterWidgetInfo(widgetInfo);
223 tlog.Debug(tag, e.Message.ToString());
224 Assert.Fail("Caught Exception: Failed!");
230 testingTarget.Dispose();
231 testingTarget = null;
232 tlog.Debug(tag, $"WidgetApplicationRegisterWidgetInfo END (OK)");
237 [Description("WidgetApplication WidgetCreateFunction.")]
238 [Property("SPEC", "Tizen.Applications.WidgetApplication.WidgetCreateFunction M")]
239 [Property("SPEC_URL", "-")]
240 [Property("CRITERIA", "MR")]
241 [Property("AUTHOR", "guowei.wang@samsung.com")]
242 public void WidgetApplicationWidgetCreateFunction()
244 tlog.Debug(tag, $"WidgetApplicationWidgetCreateFunction START");
246 tlog.Debug(tag, "WidgetApplication.Instance : " + WidgetApplication.Instance);
250 Widget widget = new Widget();
251 global::System.IntPtr widgetPtr = widget.GetIntPtr();
252 WidgetApplication.WidgetCreateFunction(ref widgetPtr);
256 tlog.Debug(tag, e.Message.ToString());
257 Assert.Fail("Caught Exception: Failed!");
260 tlog.Debug(tag, $"WidgetApplicationWidgetCreateFunction END (OK)");
265 [Description("WidgetApplication WidgetInfo.")]
266 [Property("SPEC", "Tizen.Applications.WidgetApplication.WidgetInfo M")]
267 [Property("SPEC_URL", "-")]
268 [Property("CRITERIA", "MR")]
269 [Property("AUTHOR", "guowei.wang@samsung.com")]
270 public void WidgetApplicationWidgetInfo()
272 tlog.Debug(tag, $"WidgetApplicationWidgetInfo START");
274 Widget widget = new Widget();
276 var testingTarget = new WidgetApplication(widget.GetIntPtr(), false);
277 Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication");
278 Assert.IsInstanceOf<WidgetApplication>(testingTarget, "Should be an instance of WidgetApplication type.");
280 global::System.Collections.Generic.Dictionary<Type, string> widgetInfo = new global::System.Collections.Generic.Dictionary<Type, string>(){
281 { typeof(Widget), "w1@org.tizen.WidgetApp"} };
282 testingTarget.RegisterWidgetInfo(widgetInfo);
284 tlog.Debug(tag, "testingTarget.WidgetInfo : " + testingTarget.WidgetInfo);
289 testingTarget.Dispose();
290 testingTarget = null;
292 tlog.Debug(tag, $"WidgetApplicationWidgetInfo END (OK)");