3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 namespace Tizen.NUI.Devel.Tests
8 using tlog = Tizen.Log;
11 [Description("internal/Application/NUICoreBackend")]
12 public class InternalNUICoreBackendTest
14 private const string tag = "NUITEST";
15 private event EventHandler Created;
17 private delegate bool dummyCallback(IntPtr nuicorebackend);
18 private bool OnDummyCallback(IntPtr data)
23 protected virtual void OnCreate()
25 Created?.Invoke(this, EventArgs.Empty);
31 tlog.Info(tag, "Init() is called!");
37 tlog.Info(tag, "Destroy() is called!");
42 [Description("NUICoreBackend constructor.")]
43 [Property("SPEC", "Tizen.NUI.NUICoreBackend.NUICoreBackend C")]
44 [Property("SPEC_URL", "-")]
45 [Property("CRITERIA", "CONSTR")]
46 [Property("AUTHOR", "guowei.wang@samsung.com")]
47 public void NUICoreBackendConstructor()
49 tlog.Debug(tag, $"NUICoreBackendConstructor START");
51 var testingTarget = new NUICoreBackend();
52 Assert.IsNotNull(testingTarget, "should be not null");
53 Assert.IsInstanceOf<NUICoreBackend>(testingTarget, "should be an instance of testing target class!");
55 testingTarget.Dispose();
56 tlog.Debug(tag, $"NUICoreBackendConstructor END (OK)");
61 [Description("NUICoreBackend constructor. With stylesheet.")]
62 [Property("SPEC", "Tizen.NUI.NUICoreBackend.NUICoreBackend C")]
63 [Property("SPEC_URL", "-")]
64 [Property("CRITERIA", "CONSTR")]
65 [Property("AUTHOR", "guowei.wang@samsung.com")]
66 public void NUICoreBackendConstructorWithStylesheet()
68 tlog.Debug(tag, $"NUICoreBackendConstructorWithStylesheet START");
70 var dummy = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/style/Test_Style_Manager.json";
71 var testingTarget = new NUICoreBackend(dummy);
72 Assert.IsNotNull(testingTarget, "should be not null");
73 Assert.IsInstanceOf<NUICoreBackend>(testingTarget, "should be an instance of testing target class!");
75 testingTarget.Dispose();
76 tlog.Debug(tag, $"NUICoreBackendConstructorWithStylesheet END (OK)");
81 [Description("NUICoreBackend constructor. With stylesheet and windowMode.")]
82 [Property("SPEC", "Tizen.NUI.NUICoreBackend.NUICoreBackend C")]
83 [Property("SPEC_URL", "-")]
84 [Property("CRITERIA", "CONSTR")]
85 [Property("AUTHOR", "guowei.wang@samsung.com")]
86 public void NUICoreBackendConstructorWithStylesheetAndWindowmode()
88 tlog.Debug(tag, $"NUICoreBackendConstructorWithStylesheetAndWindowmode START");
90 var dummy = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/style/Test_Style_Manager.json";
91 var testingTarget = new NUICoreBackend(dummy, NUIApplication.WindowMode.Opaque);
92 Assert.IsNotNull(testingTarget, "should be not null");
93 Assert.IsInstanceOf<NUICoreBackend>(testingTarget, "should be an instance of testing target class!");
95 testingTarget.Dispose();
96 tlog.Debug(tag, $"NUICoreBackendConstructorWithStylesheetAndWindowmode END (OK)");
101 [Description("NUICoreBackend constructor. With stylesheet, mode, size, position")]
102 [Property("SPEC", "Tizen.NUI.NUICoreBackend.NUICoreBackend C")]
103 [Property("SPEC_URL", "-")]
104 [Property("CRITERIA", "CONSTR")]
105 [Property("AUTHOR", "guowei.wang@samsung.com")]
106 public void NUICoreBackendConstructorWithFourParameters()
108 tlog.Debug(tag, $"NUICoreBackendConstructorWithFourParameters START");
110 var dummy = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/style/Test_Style_Manager.json";
111 var testingTarget = new NUICoreBackend(dummy, NUIApplication.WindowMode.Opaque, new Size(400, 400), new Position(200, 300));
112 Assert.IsNotNull(testingTarget, "should be not null");
113 Assert.IsInstanceOf<NUICoreBackend>(testingTarget, "should be an instance of testing target class!");
115 testingTarget.Dispose();
116 tlog.Debug(tag, $"NUICoreBackendConstructorWithFourParameters END (OK)");
121 [Description("NUICoreBackend AddEventHandler")]
122 [Property("SPEC", "Tizen.NUI.NUICoreBackend.AddEventHandler M")]
123 [Property("SPEC_URL", "-")]
124 [Property("CRITERIA", "MR")]
125 [Property("AUTHOR", "guowei.wang@samsung.com")]
126 public void NUICoreBackendAddEventHandler()
128 tlog.Debug(tag, $"NUICoreBackendAddEventHandler START");
130 var testingTarget = new NUICoreBackend();
131 Assert.IsNotNull(testingTarget, "should be not null");
132 Assert.IsInstanceOf<NUICoreBackend>(testingTarget, "should be an instance of testing target class!");
134 testingTarget.AddEventHandler(Tizen.Applications.CoreBackend.EventType.Created, OnCreate);
136 testingTarget.Dispose();
137 tlog.Debug(tag, $"NUICoreBackendAddEventHandler END (OK)");
142 [Description("NUICoreBackend Dispose.")]
143 [Property("SPEC", "Tizen.NUI.NUICoreBackend.Dispose M")]
144 [Property("SPEC_URL", "-")]
145 [Property("CRITERIA", "MR")]
146 [Property("AUTHOR", "guowei.wang@samsung.com")]
147 public void NUICoreBackendDispose()
149 tlog.Debug(tag, $"NUICoreBackendDispose START");
151 var testingTarget = new NUICoreBackend();
152 Assert.IsNotNull(testingTarget, "should be not null");
153 Assert.IsInstanceOf<NUICoreBackend>(testingTarget, "should be an instance of testing target class!");
157 testingTarget.Dispose();
161 tlog.Error(tag, "Caught Exception" + e.ToString());
162 Assert.Fail("Caught Exception" + e.ToString());
165 tlog.Debug(tag, $"NUICoreBackendDispose END (OK)");
170 [Description("NUICoreBackend Exit.")]
171 [Property("SPEC", "Tizen.NUI.NUICoreBackend.Exit M")]
172 [Property("SPEC_URL", "-")]
173 [Property("CRITERIA", "MR")]
174 [Property("AUTHOR", "guowei.wang@samsung.com")]
175 public void NUICoreBackendExit()
177 tlog.Debug(tag, $"NUICoreBackendExit START");
179 var testingTarget = new NUICoreBackend();
180 Assert.IsNotNull(testingTarget, "should be not null");
181 Assert.IsInstanceOf<NUICoreBackend>(testingTarget, "should be an instance of testing target class!");
185 testingTarget.Exit();
189 tlog.Error(tag, "Caught Exception" + e.ToString());
190 Assert.Fail("Caught Exception" + e.ToString());
193 testingTarget.Dispose();
194 tlog.Debug(tag, $"NUICoreBackendExit END (OK)");
199 [Description("NUICoreBackend ApplicationHandle.")]
200 [Property("SPEC", "Tizen.NUI.NUICoreBackend.ApplicationHandle A")]
201 [Property("SPEC_URL", "-")]
202 [Property("CRITERIA", "PRO")]
203 [Property("AUTHOR", "guowei.wang@samsung.com")]
204 public void NUICoreBackendApplicationHandle()
206 tlog.Debug(tag, $"NUICoreBackendApplicationHandle START");
208 var testingTarget = new NUICoreBackend();
209 Assert.IsNotNull(testingTarget, "should be not null");
210 Assert.IsInstanceOf<NUICoreBackend>(testingTarget, "should be an instance of testing target class!");
214 var result = testingTarget.ApplicationHandle;
218 tlog.Debug(tag, e.Message.ToString());
219 Assert.Fail("Caught Exception: Failed!");
222 testingTarget.Dispose();
223 tlog.Debug(tag, $"NUICoreBackendApplicationHandle END (OK)");