3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 using System.Globalization;
7 using System.Resources;
8 using Tizen.Applications;
10 namespace Tizen.NUI.Devel.Tests
12 using tlog = Tizen.Log;
15 [Description("public/Application/NUIApplication")]
16 class PublicNUIApplicationTest
18 private const string tag = "NUITEST";
19 private delegate bool dummyCallback(IntPtr NUIApplication);
20 private bool OnDummyCallback(IntPtr data)
28 tlog.Info(tag, "Init() is called!");
34 tlog.Info(tag, "Destroy() is called!");
39 [Description("NUIApplication constructor.")]
40 [Property("SPEC", "Tizen.NUI.NUIApplication.NUIApplication C")]
41 [Property("SPEC_URL", "-")]
42 [Property("CRITERIA", "CONSTR")]
43 [Property("AUTHOR", "guowei.wang@samsung.com")]
44 public void NUIApplicationConstructor()
46 tlog.Debug(tag, $"NUIApplicationConstructor START");
48 var testingTarget = new NUIApplication();
49 Assert.IsNotNull(testingTarget, "Should be not null.");
50 Assert.IsInstanceOf<NUIApplication>(testingTarget, "Should be an instance of NUIApplication type.");
52 testingTarget.Dispose();
53 tlog.Debug(tag, $"NUIApplicationConstructor END (OK)");
58 [Description("NUIApplication constructor. With window size and position")]
59 [Property("SPEC", "Tizen.NUI.NUIApplication.NUIApplication C")]
60 [Property("SPEC_URL", "-")]
61 [Property("CRITERIA", "CONSTR")]
62 [Property("AUTHOR", "guowei.wang@samsung.com")]
63 public void NUIApplicationConstructorWithWindowSizeAndPosition()
65 tlog.Debug(tag, $"NUIApplicationConstructorWithWindowSizeAndPosition START");
67 Size size = new Size(100, 200);
68 Position pos = new Position(200, 300);
69 var testingTarget = new NUIApplication(size, pos);
70 Assert.IsNotNull(testingTarget, "Should be not null.");
71 Assert.IsInstanceOf<NUIApplication>(testingTarget, "Should be an instance of NUIApplication type.");
75 testingTarget.Dispose();
76 tlog.Debug(tag, $"NUIApplicationConstructorWithWindowSizeAndPosition END (OK)");
81 [Description("NUIApplication constructor. With stylesheet.")]
82 [Property("SPEC", "Tizen.NUI.NUIApplication.NUIApplication C")]
83 [Property("SPEC_URL", "-")]
84 [Property("CRITERIA", "CONSTR")]
85 [Property("AUTHOR", "guowei.wang@samsung.com")]
86 public void NUIApplicationConstructorWithStyleSheet()
88 tlog.Debug(tag, $"NUIApplicationConstructorWithStyleSheet START");
90 var testingTarget = new NUIApplication("stylesheet");
91 Assert.IsNotNull(testingTarget, "Should be not null.");
92 Assert.IsInstanceOf<NUIApplication>(testingTarget, "Should be an instance of NUIApplication type.");
94 testingTarget.Dispose();
95 tlog.Debug(tag, $"NUIApplicationConstructorWithStyleSheet END (OK)");
100 [Description("NUIApplication constructor. With stylesheet, window size, position.")]
101 [Property("SPEC", "Tizen.NUI.NUIApplication.NUIApplication C")]
102 [Property("SPEC_URL", "-")]
103 [Property("CRITERIA", "CONSTR")]
104 [Property("AUTHOR", "guowei.wang@samsung.com")]
105 public void NUIApplicationConstructorWithStyleSheetAndWindowSizeAndPostion()
107 tlog.Debug(tag, $"NUIApplicationConstructorWithStyleSheetAndWindowSizeAndPostion START");
109 var testingTarget = new NUIApplication("stylesheet", new Size(100, 200), new Position(200, 300));
110 Assert.IsNotNull(testingTarget, "Should be not null.");
111 Assert.IsInstanceOf<NUIApplication>(testingTarget, "Should be an instance of NUIApplication type.");
113 testingTarget.Dispose();
114 tlog.Debug(tag, $"NUIApplicationConstructorWithStyleSheetAndWindowSizeAndPostion END (OK)");
119 [Description("NUIApplication constructor. With stylesheet and WindowMode.")]
120 [Property("SPEC", "Tizen.NUI.NUIApplication.NUIApplication C")]
121 [Property("SPEC_URL", "-")]
122 [Property("CRITERIA", "CONSTR")]
123 [Property("AUTHOR", "guowei.wang@samsung.com")]
124 public void NUIApplicationConstructorWithStringAndWindowMode()
126 tlog.Debug(tag, $"NUIApplicationConstructorWithStringAndWindowMode START");
128 var testingTarget = new NUIApplication("stylesheet", NUIApplication.WindowMode.Opaque);
129 Assert.IsNotNull(testingTarget, "Should be not null.");
130 Assert.IsNotNull(testingTarget, "NUIApplication Should return NUIApplication instance.");
132 testingTarget.Dispose();
133 tlog.Debug(tag, $"NUIApplicationConstructorWithStringAndWindowMode END (OK)");
138 [Description("NUIApplication constructor. With stylesheet, WindowMode, window size and position")]
139 [Property("SPEC", "Tizen.NUI.NUIApplication.NUIApplication C")]
140 [Property("SPEC_URL", "-")]
141 [Property("CRITERIA", "CONSTR")]
142 [Property("AUTHOR", "guowei.wang@samsung.com")]
143 public void NUIApplicationConstructorWithStringAndWindowModeAndWindowSizeAndPosition()
145 tlog.Debug(tag, $"NUIApplicationConstructorWithStringAndWindowModeAndWindowSizeAndPosition START");
147 var testingTarget = new NUIApplication("stylesheet", NUIApplication.WindowMode.Opaque, new Size(100, 200), new Position(200, 300));
148 Assert.IsNotNull(testingTarget, "Should be not null.");
149 Assert.IsNotNull(testingTarget, "NUIApplication Should return NUIApplication instance.");
151 testingTarget.Dispose();
152 tlog.Debug(tag, $"NUIApplicationConstructorWithStringAndWindowModeAndWindowSizeAndPosition END (OK)");
157 [Description("NUIApplication RegisterAssembly.")]
158 [Property("SPEC", "Tizen.NUI.NUIApplication.RegisterAssembly M")]
159 [Property("SPEC_URL", "-")]
160 [Property("CRITERIA", "MR")]
161 [Property("AUTHOR", "guowei.wang@samsung.com")]
162 public void NUIApplicationRegisterAssembly()
164 tlog.Debug(tag, $"NUIApplicationRegisterAssembly START");
168 NUIApplication.RegisterAssembly(typeof(NUIApplication).Assembly);
172 tlog.Error(tag, "Caught Exception" + e.ToString());
173 LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
174 Assert.Fail("Caught Exception" + e.ToString());
177 tlog.Debug(tag, $"NUIApplicationRegisterAssembly END (OK)");
182 [Description("NUIApplication MultilingualResourceManager.")]
183 [Property("SPEC", "Tizen.NUI.NUIApplication.MultilingualResourceManager A")]
184 [Property("SPEC_URL", "-")]
185 [Property("CRITERIA", "PRW")]
186 [Property("AUTHOR", "guowei.wang@samsung.com")]
187 public void NUIApplicationMultilingualResourceManager()
189 tlog.Debug(tag, $"NUIApplicationMultilingualResourceManager START");
191 NUIApplication.MultilingualResourceManager = Resource.ResourceManager;
192 Assert.IsNotNull(NUIApplication.MultilingualResourceManager, "Should be not null!");
195 str = NUIApplication.MultilingualResourceManager?.GetString("Test");
196 Assert.AreEqual("Test", str, "Picture should be Beeld in Dutch");
198 tlog.Debug(tag, $"NUIApplicationMultilingualResourceManager END (OK)");
203 [Description("NUIApplication AppId")]
204 [Property("SPEC", "Tizen.NUI.NUIApplication.AppId A")]
205 [Property("SPEC_URL", "-")]
206 [Property("CRITERIA", "PRO")]
207 [Property("AUTHOR", "guowei.wang@samsung.com")]
208 public void NUIApplicationAppId()
210 tlog.Debug(tag, $"NUIApplicationAppId START");
212 var testingTarget = new NUIApplication();
213 Assert.IsNotNull(testingTarget, "Should be not null.");
214 Assert.IsInstanceOf<NUIApplication>(testingTarget, "Should be an instance of NUIApplication type.");
216 var result = testingTarget.AppId;
217 Assert.IsNotNull(result, "Should be not null.");
219 tlog.Debug(tag, $"NUIApplicationAppId END (OK)");
224 [Description("NUIApplication GetDefaultWindow")]
225 [Property("SPEC", "Tizen.NUI.NUIApplication.GetDefaultWindow M")]
226 [Property("SPEC_URL", "-")]
227 [Property("CRITERIA", "MR")]
228 [Property("AUTHOR", "guowei.wang@samsung.com")]
229 public void NUIApplicationGetDefaultWindow()
231 tlog.Debug(tag, $"NUIApplicationGetDefaultWindow START");
233 var testingTarget = NUIApplication.GetDefaultWindow();
234 Assert.IsNotNull(testingTarget, "Should be not null.");
235 Assert.IsInstanceOf<Window>(testingTarget, "Should be an instance of Window type.");
237 testingTarget.Dispose();
238 tlog.Debug(tag, $"NUIApplicationGetDefaultWindow END (OK)");
243 [Description("NUIApplication AddIdle")]
244 [Property("SPEC", "Tizen.NUI.NUIApplication.AddIdle M")]
245 [Property("SPEC_URL", "-")]
246 [Property("CRITERIA", "MR")]
247 [Property("AUTHOR", "guowei.wang@samsung.com")]
248 public void NUIApplicationAddIdle()
250 tlog.Debug(tag, $"NUIApplicationAddIdle START");
252 dummyCallback callback = OnDummyCallback;
253 var result = Application.Instance.AddIdle(callback);
254 Assert.IsTrue(result);
256 tlog.Debug(tag, $"NUIApplicationAddIdle END (OK)");
261 [Description("NUIApplication SetRenderRefreshRate")]
262 [Property("SPEC", "Tizen.NUI.NUIApplication.SetRenderRefreshRate M")]
263 [Property("SPEC_URL", "-")]
264 [Property("CRITERIA", "MR")]
265 [Property("AUTHOR", "guowei.wang@samsung.com")]
266 public void NUIApplicationSetRenderRefreshRate()
268 tlog.Debug(tag, $"NUIApplicationSetRenderRefreshRate START");
272 NUIApplication.SetRenderRefreshRate(2);
276 tlog.Error(tag, "Caught Exception" + e.ToString());
277 LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
278 Assert.Fail("Caught Exception" + e.ToString());
281 tlog.Debug(tag, $"NUIApplicationSetRenderRefreshRate END (OK)");
286 [Description("NUIApplication TransitionOptions")]
287 [Property("SPEC", "Tizen.NUI.NUIApplication.TransitionOptions A")]
288 [Property("SPEC_URL", "-")]
289 [Property("CRITERIA", "PRW")]
290 [Property("AUTHOR", "guowei.wang@samsung.com")]
291 public void NUIApplicationTransitionOptions()
293 tlog.Debug(tag, $"NUIApplicationTransitionOptions START");
295 var testingTarget = new NUIApplication();
296 Assert.IsNotNull(testingTarget, "Should be not null.");
297 Assert.IsInstanceOf<NUIApplication>(testingTarget, "Should be an instance of Window type.");
299 TransitionOptions transitionOption = new TransitionOptions(Window.Instance);
300 testingTarget.TransitionOptions = transitionOption;
302 var result = testingTarget.TransitionOptions;
303 Assert.IsNotNull(result);
304 Assert.IsInstanceOf<TransitionOptions>(result, "Should be an instance of TransitionOptions type.");
307 transitionOption.Dispose();
308 testingTarget.Dispose();
309 tlog.Debug(tag, $"NUIApplicationTransitionOptions END (OK)");