3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
7 namespace Tizen.NUI.Devel.Tests
9 using tlog = Tizen.Log;
12 [Description("internal/Application/ComponentApplication")]
13 public class InternalComponentApplicationTest
15 private const string tag = "NUITEST";
16 private Widget widget = null;
17 private string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
18 private delegate bool dummyCallback(IntPtr application);
20 private bool OnDummyCallback(IntPtr data)
25 internal class MyComponentApplication : ComponentApplication
27 public MyComponentApplication(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
30 public void OnDispose(DisposeTypes type)
39 tlog.Info(tag, "Init() is called!");
41 widget = new Widget();
42 tlog.Debug(tag, "widget.Id : " + widget.Id);
51 tlog.Info(tag, "Destroy() is called!");
56 [Description("ComponentApplication constructor.")]
57 [Property("SPEC", "Tizen.NUI.ComponentApplication.ComponentApplication C")]
58 [Property("SPEC_URL", "-")]
59 [Property("CRITERIA", "CONSTR")]
60 [Property("AUTHOR", "guowei.wang@samsung.com")]
61 public void ComponentApplicationConstructor()
63 tlog.Debug(tag, $"ComponentApplicationConstructor START");
65 var testingTarget = new ComponentApplication(widget.SwigCPtr.Handle, false);
66 Assert.IsNotNull(testingTarget, "should be not null");
67 Assert.IsInstanceOf<ComponentApplication>(testingTarget, "should be an instance of testing target class!");
69 testingTarget.Dispose();
70 tlog.Debug(tag, $"ComponentApplicationConstructor END (OK)");
75 [Description("ComponentApplication constructor. With ComponentApplication.")]
76 [Property("SPEC", "Tizen.NUI.ComponentApplication.ComponentApplication C")]
77 [Property("SPEC_URL", "-")]
78 [Property("CRITERIA", "CONSTR")]
79 [Property("AUTHOR", "guowei.wang@samsung.com")]
80 public void ComponentApplicationConstructorWithComponentApplication()
82 tlog.Debug(tag, $"ComponentApplicationConstructorWithComponentApplication START");
84 ComponentApplication componentApplication = new ComponentApplication(widget.SwigCPtr.Handle, false);
85 Assert.IsNotNull(componentApplication, "should be not null");
86 Assert.IsInstanceOf<ComponentApplication>(componentApplication, "should be an instance of testing target class!");
88 var testingTarget = new ComponentApplication(componentApplication);
89 Assert.IsNotNull(testingTarget, "should be not null");
90 Assert.IsInstanceOf<ComponentApplication>(testingTarget, "should be an instance of testing target class!");
92 testingTarget.Dispose();
93 tlog.Debug(tag, $"ComponentApplicationConstructorWithComponentApplication END (OK)");
98 [Description("ComponentApplication CreateNativeSignal.")]
99 [Property("SPEC", "Tizen.NUI.ComponentApplication.CreateNativeSignal M")]
100 [Property("SPEC_URL", "-")]
101 [Property("CRITERIA", "MR")]
102 [Property("AUTHOR", "guowei.wang@samsung.com")]
103 public void ComponentApplicationCreateNativeSignal()
105 tlog.Debug(tag, $"ComponentApplicationCreateNativeSignal START");
107 var testingTarget = new ComponentApplication(widget.SwigCPtr.Handle, false);
108 Assert.IsNotNull(testingTarget, "should be not null");
109 Assert.IsInstanceOf<ComponentApplication>(testingTarget, "should be an instance of testing target class!");
113 var result = testingTarget.CreateNativeSignal();
114 Assert.IsNotNull(result, "should be not null");
115 Assert.IsInstanceOf<ApplicationSignal>(result, "should be an instance of ApplicationSignal class!");
119 tlog.Debug(tag, e.Message.ToString());
120 Assert.Fail("Caught Exception: Failed!");
123 testingTarget.Dispose();
124 tlog.Debug(tag, $"ComponentApplicationCreateNativeSignal END (OK)");
129 [Description("ComponentApplication Dispose.")]
130 [Property("SPEC", "Tizen.NUI.ComponentApplication.Dispose M")]
131 [Property("SPEC_URL", "-")]
132 [Property("CRITERIA", "MR")]
133 [Property("AUTHOR", "guowei.wang@samsung.com")]
134 public void ComponentApplicationDispose()
136 tlog.Debug(tag, $"ComponentApplicationDispose START");
138 var testingTarget = new MyComponentApplication(widget.SwigCPtr.Handle, false);
139 Assert.IsNotNull(testingTarget, "should be not null");
140 Assert.IsInstanceOf<ComponentApplication>(testingTarget, "should be an instance of testing target class!");
144 testingTarget.OnDispose(DisposeTypes.Explicit);
145 testingTarget.OnDispose(DisposeTypes.Explicit);
149 tlog.Debug(tag, e.Message.ToString());
150 Assert.Fail("Caught Exception: Failed!");
153 tlog.Debug(tag, $"ComponentApplicationDispose END (OK)");
158 [Description("ComponentApplication Assign.")]
159 [Property("SPEC", "Tizen.NUI.ComponentApplication.Assign M")]
160 [Property("SPEC_URL", "-")]
161 [Property("CRITERIA", "MR")]
162 [Property("AUTHOR", "guowei.wang@samsung.com")]
163 public void ComponentApplicationAssign()
165 tlog.Debug(tag, $"ComponentApplicationAssign START");
167 var testingTarget = new ComponentApplication(widget.SwigCPtr.Handle, false);
168 Assert.IsNotNull(testingTarget, "should be not null");
169 Assert.IsInstanceOf<ComponentApplication>(testingTarget, "should be an instance of testing target class!");
173 testingTarget.Assign(testingTarget);
177 tlog.Debug(tag, e.Message.ToString());
178 Assert.Fail("Caught Exception: Failed!");
181 testingTarget.Dispose();
182 tlog.Debug(tag, $"ComponentApplicationAssign END (OK)");