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 string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
17 private delegate bool dummyCallback(IntPtr application);
19 private bool OnDummyCallback(IntPtr data)
24 internal class MyComponentApplication : ComponentApplication
26 public MyComponentApplication(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
29 public void OnDispose(DisposeTypes type)
38 tlog.Info(tag, "Init() is called!");
44 tlog.Info(tag, "Destroy() is called!");
49 [Description("ComponentApplication constructor.")]
50 [Property("SPEC", "Tizen.NUI.ComponentApplication.ComponentApplication C")]
51 [Property("SPEC_URL", "-")]
52 [Property("CRITERIA", "CONSTR")]
53 [Property("AUTHOR", "guowei.wang@samsung.com")]
54 public void ComponentApplicationConstructor()
56 tlog.Debug(tag, $"ComponentApplicationConstructor START");
58 ImageView view = new ImageView();
59 var testingTarget = new ComponentApplication(view.SwigCPtr.Handle, false);
60 Assert.IsNotNull(testingTarget, "should be not null");
61 Assert.IsInstanceOf<ComponentApplication>(testingTarget, "should be an instance of testing target class!");
64 testingTarget.Dispose();
65 tlog.Debug(tag, $"ComponentApplicationConstructor END (OK)");
70 [Description("ComponentApplication constructor. With ComponentApplication.")]
71 [Property("SPEC", "Tizen.NUI.ComponentApplication.ComponentApplication C")]
72 [Property("SPEC_URL", "-")]
73 [Property("CRITERIA", "CONSTR")]
74 [Property("AUTHOR", "guowei.wang@samsung.com")]
75 public void ComponentApplicationConstructorWithComponentApplication()
77 tlog.Debug(tag, $"ComponentApplicationConstructorWithComponentApplication START");
79 ImageView view = new ImageView();
80 ComponentApplication componentApplication = new ComponentApplication(view.SwigCPtr.Handle, false);
81 Assert.IsNotNull(componentApplication, "should be not null");
82 Assert.IsInstanceOf<ComponentApplication>(componentApplication, "should be an instance of testing target class!");
84 var testingTarget = new ComponentApplication(componentApplication);
85 Assert.IsNotNull(testingTarget, "should be not null");
86 Assert.IsInstanceOf<ComponentApplication>(testingTarget, "should be an instance of testing target class!");
89 testingTarget.Dispose();
90 tlog.Debug(tag, $"ComponentApplicationConstructorWithComponentApplication END (OK)");
95 [Description("ComponentApplication CreateNativeSignal.")]
96 [Property("SPEC", "Tizen.NUI.ComponentApplication.CreateNativeSignal M")]
97 [Property("SPEC_URL", "-")]
98 [Property("CRITERIA", "MR")]
99 [Property("AUTHOR", "guowei.wang@samsung.com")]
100 public void ComponentApplicationCreateNativeSignal()
102 tlog.Debug(tag, $"ComponentApplicationCreateNativeSignal START");
104 ImageView view = new ImageView();
105 var testingTarget = new ComponentApplication(view.SwigCPtr.Handle, false);
106 Assert.IsNotNull(testingTarget, "should be not null");
107 Assert.IsInstanceOf<ComponentApplication>(testingTarget, "should be an instance of testing target class!");
111 var result = testingTarget.CreateNativeSignal();
112 Assert.IsNotNull(result, "should be not null");
113 Assert.IsInstanceOf<ApplicationSignal>(result, "should be an instance of ApplicationSignal class!");
117 tlog.Debug(tag, e.Message.ToString());
118 Assert.Fail("Caught Exception: Failed!");
122 testingTarget.Dispose();
123 tlog.Debug(tag, $"ComponentApplicationCreateNativeSignal END (OK)");
128 [Description("ComponentApplication Dispose.")]
129 [Property("SPEC", "Tizen.NUI.ComponentApplication.Dispose M")]
130 [Property("SPEC_URL", "-")]
131 [Property("CRITERIA", "MR")]
132 [Property("AUTHOR", "guowei.wang@samsung.com")]
133 public void ComponentApplicationDispose()
135 tlog.Debug(tag, $"ComponentApplicationDispose START");
137 ImageView view = new ImageView();
138 var testingTarget = new MyComponentApplication(view.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!");
154 tlog.Debug(tag, $"ComponentApplicationDispose END (OK)");
159 [Description("ComponentApplication Assign.")]
160 [Property("SPEC", "Tizen.NUI.ComponentApplication.Assign M")]
161 [Property("SPEC_URL", "-")]
162 [Property("CRITERIA", "MR")]
163 [Property("AUTHOR", "guowei.wang@samsung.com")]
164 public void ComponentApplicationAssign()
166 tlog.Debug(tag, $"ComponentApplicationAssign START");
168 ImageView view = new ImageView();
169 var testingTarget = new ComponentApplication(view.SwigCPtr.Handle, false);
170 Assert.IsNotNull(testingTarget, "should be not null");
171 Assert.IsInstanceOf<ComponentApplication>(testingTarget, "should be an instance of testing target class!");
175 testingTarget.Assign(testingTarget);
179 tlog.Debug(tag, e.Message.ToString());
180 Assert.Fail("Caught Exception: Failed!");
183 tlog.Debug(tag, $"ComponentApplicationAssign END (OK)");