3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 using System.Collections.Generic;
7 using Tizen.Applications.CoreBackend;
9 namespace Tizen.NUI.Devel.Tests
11 using tlog = Tizen.Log;
14 [Description("internal/Application/NUIWidgetCoreBackend")]
15 public class InternalNUIWidgetCoreBackendTest
17 private const string tag = "NUITEST";
18 private string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
23 tlog.Info(tag, "Init() is called!");
29 tlog.Info(tag, "Destroy() is called!");
34 [Description("NUIWidgetCoreBackend constructor.")]
35 [Property("SPEC", "Tizen.NUI.NUIWidgetCoreBackend.NUIWidgetCoreBackend C")]
36 [Property("SPEC_URL", "-")]
37 [Property("CRITERIA", "CONSTR")]
38 [Property("AUTHOR", "guowei.wang@samsung.com")]
39 public void NUIWidgetCoreBackendConstructor()
41 tlog.Debug(tag, $"NUIWidgetCoreBackendConstructor START");
43 var testingTarget = new NUIWidgetCoreBackend();
44 Assert.IsNotNull(testingTarget, "should be not null");
45 Assert.IsInstanceOf<NUIWidgetCoreBackend>(testingTarget, "should be an instance of testing target class!");
47 testingTarget.Dispose();
48 tlog.Debug(tag, $"NUIWidgetCoreBackendConstructor END (OK)");
53 [Description("NUIWidgetCoreBackend AddEventHandler.")]
54 [Property("SPEC", "Tizen.NUI.NUIWidgetCoreBackend.AddEventHandler A")]
55 [Property("SPEC_URL", "-")]
56 [Property("CRITERIA", "PRW")]
57 [Property("AUTHOR", "guowei.wang@samsung.com")]
58 public void NUIWidgetCoreBackendAddEventHandler()
60 tlog.Debug(tag, $"NUIWidgetCoreBackendAddEventHandler START");
62 var testingTarget = new NUIWidgetCoreBackend();
63 Assert.IsNotNull(testingTarget, "should be not null");
64 Assert.IsInstanceOf<NUIWidgetCoreBackend>(testingTarget, "should be an instance of testing target class!");
68 testingTarget.AddEventHandler(EventType.PreCreated, MyOnPreCreate);
69 testingTarget.AddEventHandler<Tizen.Applications.LowBatteryEventArgs>(EventType.LowBattery, MyOnLowBattery);
73 tlog.Debug(tag, e.Message.ToString());
74 Assert.Fail("Caught Exception: Failed!");
77 testingTarget.Dispose();
78 tlog.Debug(tag, $"NUIWidgetCoreBackendAddEventHandler END (OK)");
81 private void MyOnLowBattery(Tizen.Applications.LowBatteryEventArgs obj) { }
82 private void MyOnPreCreate() { }
86 [Description("NUIWidgetCoreBackend constructor. With stylesheet")]
87 [Property("SPEC", "Tizen.NUI.NUIWidgetCoreBackend.NUIWidgetCoreBackend C")]
88 [Property("SPEC_URL", "-")]
89 [Property("CRITERIA", "CONSTR")]
90 [Property("AUTHOR", "guowei.wang@samsung.com")]
91 public void NUIWidgetCoreBackendConstructorWithStylesheet()
93 tlog.Debug(tag, $"NUIWidgetCoreBackendConstructorWithStylesheet START");
95 var dummy = resource + "style/Test_Style_Manager.json";
96 var testingTarget = new NUIWidgetCoreBackend(dummy);
97 Assert.IsNotNull(testingTarget, "should be not null");
98 Assert.IsInstanceOf<NUIWidgetCoreBackend>(testingTarget, "should be an instance of testing target class!");
100 testingTarget.Dispose();
101 tlog.Debug(tag, $"NUIWidgetCoreBackendConstructorWithStylesheet END (OK)");
106 [Description("NUIWidgetCoreBackend dispose.")]
107 [Property("SPEC", "Tizen.NUI.NUIWidgetCoreBackend.Dispose M")]
108 [Property("SPEC_URL", "-")]
109 [Property("CRITERIA", "MR")]
110 [Property("AUTHOR", "guowei.wang@samsung.com")]
111 public void NUIWidgetCoreBackendDispose()
113 tlog.Debug(tag, $"NUIWidgetCoreBackendDispose START");
115 var testingTarget = new NUIWidgetCoreBackend();
116 Assert.IsNotNull(testingTarget, "should be not null");
117 Assert.IsInstanceOf<NUIWidgetCoreBackend>(testingTarget, "should be an instance of testing target class!");
121 testingTarget.Dispose();
125 tlog.Error(tag, "Caught Exception" + e.ToString());
126 Assert.Fail("Caught Exception" + e.ToString());
129 tlog.Debug(tag, $"NUIWidgetCoreBackendDispose END (OK)");
134 [Description("NUIWidgetCoreBackend exit.")]
135 [Property("SPEC", "Tizen.NUI.NUIWidgetCoreBackend.Exit M")]
136 [Property("SPEC_URL", "-")]
137 [Property("CRITERIA", "MR")]
138 [Property("AUTHOR", "guowei.wang@samsung.com")]
139 public void NUIWidgetCoreBackendExit()
141 tlog.Debug(tag, $"NUIWidgetCoreBackendExit START");
143 var testingTarget = new NUIWidgetCoreBackend();
144 Assert.IsNotNull(testingTarget, "should be not null");
145 Assert.IsInstanceOf<NUIWidgetCoreBackend>(testingTarget, "should be an instance of testing target class!");
149 testingTarget.Exit();
153 tlog.Error(tag, "Caught Exception" + e.ToString());
154 Assert.Fail("Caught Exception" + e.ToString());
157 testingTarget.Dispose();
158 tlog.Debug(tag, $"NUIWidgetCoreBackendExit END (OK)");
163 [Description("NUIWidgetCoreBackend RegisterWidgetInfo.")]
164 [Property("SPEC", "Tizen.NUI.NUIWidgetCoreBackend.RegisterWidgetInfo M")]
165 [Property("SPEC_URL", "-")]
166 [Property("CRITERIA", "MR")]
167 [Property("AUTHOR", "guowei.wang@samsung.com")]
168 public void NUIWidgetCoreBackendRegisterWidgetInfo()
170 tlog.Debug(tag, $"NUIWidgetCoreBackendRegisterWidgetInfo START");
172 var testingTarget = new NUIWidgetCoreBackend();
173 Assert.IsNotNull(testingTarget, "should be not null");
174 Assert.IsInstanceOf<NUIWidgetCoreBackend>(testingTarget, "should be an instance of testing target class!");
176 var widgetInfo = new Dictionary<global::System.Type, string>();
177 testingTarget.RegisterWidgetInfo(widgetInfo);
179 testingTarget.Dispose();
180 tlog.Debug(tag, $"NUIWidgetCoreBackendRegisterWidgetInfo END (OK)");
185 [Description("NUIWidgetCoreBackend AddWidgetInfo.")]
186 [Property("SPEC", "Tizen.NUI.NUIWidgetCoreBackend.AddWidgetInfo M")]
187 [Property("SPEC_URL", "-")]
188 [Property("CRITERIA", "MR")]
189 [Property("AUTHOR", "guowei.wang@samsung.com")]
190 public void NUIWidgetCoreBackendAddWidgetInfo()
192 tlog.Debug(tag, $"NUIWidgetCoreBackendAddWidgetInfo START");
194 var testingTarget = new NUIWidgetCoreBackend();
195 Assert.IsNotNull(testingTarget, "should be not null");
196 Assert.IsInstanceOf<NUIWidgetCoreBackend>(testingTarget, "should be an instance of testing target class!");
198 var widgetInfo = new Dictionary<global::System.Type, string>();
199 testingTarget.AddWidgetInfo(widgetInfo);
201 testingTarget.Dispose();
202 tlog.Debug(tag, $"NUIWidgetCoreBackendAddWidgetInfo END (OK)");
207 [Description("NUIWidgetCoreBackend WidgetApplicationHandle.")]
208 [Property("SPEC", "Tizen.NUI.NUIWidgetCoreBackend.WidgetApplicationHandle A")]
209 [Property("SPEC_URL", "-")]
210 [Property("CRITERIA", "PRO")]
211 [Property("AUTHOR", "guowei.wang@samsung.com")]
212 public void NUIWidgetCoreBackendWidgetApplicationHandle()
214 tlog.Debug(tag, $"NUIWidgetCoreBackendWidgetApplicationHandle START");
216 var testingTarget = new NUIWidgetCoreBackend();
217 Assert.IsNotNull(testingTarget, "should be not null");
218 Assert.IsInstanceOf<NUIWidgetCoreBackend>(testingTarget, "should be an instance of testing target class!");
222 var result = testingTarget.WidgetApplicationHandle;
226 tlog.Debug(tag, e.Message.ToString());
227 Assert.Fail("Caught Exception: Failed!");
230 testingTarget.Dispose();
231 tlog.Debug(tag, $"NUIWidgetCoreBackendWidgetApplicationHandle END (OK)");