3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 using System.Collections.Generic;
8 namespace Tizen.NUI.Devel.Tests
10 using tlog = Tizen.Log;
13 [Description("public/Application/NUIComponentApplication")]
14 class PublicNUIComponentApplicationTest
16 private const string tag = "NUITEST";
18 internal class MyNUIComponentApplication : NUIComponentApplication
20 public MyNUIComponentApplication(IDictionary<Type, string> typeInfo) : base(typeInfo)
23 public void MyOnCreate() { base.OnCreate(); }
25 public void MyOnTerminate() { base.OnTerminate(); }
27 public void MyExit() { base.Exit(); }
33 tlog.Info(tag, "Init() is called!");
39 tlog.Info(tag, "Destroy() is called!");
44 [Description("NUIComponentApplication constructor.")]
45 [Property("SPEC", "Tizen.NUI.NUIComponentApplication.NUIComponentApplication M")]
46 [Property("SPEC_URL", "-")]
47 [Property("CRITERIA", "MR")]
48 [Property("AUTHOR", "guowei.wang@samsung.com")]
49 public void NUIComponentApplicationConstructor()
51 tlog.Debug(tag, $"NUIComponentApplicationConstructor START");
53 IDictionary<Type, string> typeInfo = new Dictionary<Type, string>();
54 typeInfo.Add(typeof(Applications.ComponentBased.Common.FrameComponent), "FrameComponent");
55 typeInfo.Add(typeof(Applications.ComponentBased.Common.ServiceComponent), "ServiceComponent");
56 var testingTarget = new NUIComponentApplication(typeInfo);
57 Assert.IsNotNull(testingTarget, "Should be not null.");
58 Assert.IsInstanceOf<NUIComponentApplication>(testingTarget, "Should be an instance of NUIComponentApplication type.");
60 testingTarget.Dispose();
61 tlog.Debug(tag, $"NUIComponentApplicationConstructor END (OK)");
66 [Description("NUIComponentApplication constructor. With illegal type.")]
67 [Property("SPEC", "Tizen.NUI.NUIComponentApplication.NUIComponentApplication M")]
68 [Property("SPEC_URL", "-")]
69 [Property("CRITERIA", "MR")]
70 [Property("AUTHOR", "guowei.wang@samsung.com")]
71 public void NUIComponentApplicationConstructorWithIllegalType()
73 tlog.Debug(tag, $"NUIComponentApplicationConstructorWithIllegalType START");
75 IDictionary<Type, string> typeInfo = new Dictionary<Type, string>();
76 typeInfo.Add(typeof(Widget), "Widget");
80 new NUIComponentApplication(typeInfo);
82 catch (ArgumentException e)
84 tlog.Debug(tag, e.Message.ToString());
85 tlog.Debug(tag, $"NUIComponentApplicationConstructorWithIllegalType END (OK)");
86 Assert.Pass("Caught ArgumentException: Passed!");
92 [Description("NUIComponentApplication constructor. With null parameter.")]
93 [Property("SPEC", "Tizen.NUI.NUIComponentApplication.NUIComponentApplication M")]
94 [Property("SPEC_URL", "-")]
95 [Property("CRITERIA", "MR")]
96 [Property("AUTHOR", "guowei.wang@samsung.com")]
97 public void NUIComponentApplicationConstructorWithNull()
99 tlog.Debug(tag, $"NUIComponentApplicationConstructorWithNull START");
101 var testingTarget = new NUIComponentApplication(null);
102 Assert.IsNotNull(testingTarget, "Should be not null.");
103 Assert.IsInstanceOf<NUIComponentApplication>(testingTarget, "Should be an instance of NUIComponentApplication type.");
105 testingTarget.Dispose();
106 tlog.Debug(tag, $"NUIComponentApplicationConstructorWithNull END (OK)");
111 [Description("NUIComponentApplication OnCreate.")]
112 [Property("SPEC", "Tizen.NUI.NUIComponentApplication.OnCreate M")]
113 [Property("SPEC_URL", "-")]
114 [Property("CRITERIA", "MR")]
115 [Property("AUTHOR", "guowei.wang@samsung.com")]
116 public void NUIComponentApplicationOnCreate()
118 tlog.Debug(tag, $"NUIComponentApplicationOnCreate START");
120 IDictionary<Type, string> typeInfo = new Dictionary<Type, string>();
121 typeInfo.Add(typeof(Applications.ComponentBased.Common.FrameComponent), "FrameComponent");
122 var testingTarget = new MyNUIComponentApplication(typeInfo);
123 Assert.IsNotNull(testingTarget, "Should be not null.");
124 Assert.IsInstanceOf<NUIComponentApplication>(testingTarget, "Should be an instance of NUIComponentApplication type.");
128 testingTarget.MyOnCreate();
132 tlog.Debug(tag, e.Message.ToString());
133 Assert.Fail("Caught Exception: Failed!");
136 testingTarget.Dispose();
137 tlog.Debug(tag, $"NUIComponentApplicationOnCreate END (OK)");
142 [Description("NUIComponentApplication OnTerminate.")]
143 [Property("SPEC", "Tizen.NUI.NUIComponentApplication.OnTerminate M")]
144 [Property("SPEC_URL", "-")]
145 [Property("CRITERIA", "MR")]
146 [Property("AUTHOR", "guowei.wang@samsung.com")]
147 public void NUIComponentApplicationOnTerminate()
149 tlog.Debug(tag, $"NUIComponentApplicationOnCreate START");
151 IDictionary<Type, string> typeInfo = new Dictionary<Type, string>();
152 typeInfo.Add(typeof(Applications.ComponentBased.Common.FrameComponent), "FrameComponent");
153 var testingTarget = new MyNUIComponentApplication(typeInfo);
154 Assert.IsNotNull(testingTarget, "Should be not null.");
155 Assert.IsInstanceOf<NUIComponentApplication>(testingTarget, "Should be an instance of NUIComponentApplication type.");
159 testingTarget.MyOnTerminate();
163 tlog.Debug(tag, e.Message.ToString());
164 Assert.Fail("Caught Exception: Failed!");
167 testingTarget.Dispose();
168 tlog.Debug(tag, $"NUIComponentApplicationOnCreate END (OK)");
173 [Description("NUIComponentApplication Exit.")]
174 [Property("SPEC", "Tizen.NUI.NUIComponentApplication.Exit M")]
175 [Property("SPEC_URL", "-")]
176 [Property("CRITERIA", "MR")]
177 [Property("AUTHOR", "guowei.wang@samsung.com")]
178 public void NUIComponentApplicationExit()
180 tlog.Debug(tag, $"NUIComponentApplicationExit START");
182 IDictionary<Type, string> typeInfo = new Dictionary<Type, string>();
183 typeInfo.Add(typeof(Applications.ComponentBased.Common.FrameComponent), "FrameComponent");
184 var testingTarget = new MyNUIComponentApplication(typeInfo);
185 Assert.IsNotNull(testingTarget, "Should be not null.");
186 Assert.IsInstanceOf<NUIComponentApplication>(testingTarget, "Should be an instance of NUIComponentApplication type.");
190 testingTarget.MyExit();
194 tlog.Debug(tag, e.Message.ToString());
195 Assert.Fail("Caught Exception: Failed!");
198 testingTarget.Dispose();
199 tlog.Debug(tag, $"NUIComponentApplicationExit END (OK)");