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/NUIWidgetApplication")]
15 public class MyWidget : Widget
17 protected override void OnCreate(string contentInfo, Window window)
19 window.BackgroundColor = Color.White;
20 TextLabel textLabel = new TextLabel("Widget Works");
22 window.GetDefaultLayer().Add(textLabel);
23 base.OnCreate(contentInfo, window);
27 public class PublicNUIWidgetApplicationTest
29 private const string tag = "NUITEST";
34 tlog.Info(tag, "Init() is called!");
40 tlog.Info(tag, "Destroy() is called!");
45 [Description("NUIWidgetApplication constructor.")]
46 [Property("SPEC", "Tizen.NUI.NUIWidgetApplication.NUIWidgetApplication C")]
47 [Property("SPEC_URL", "-")]
48 [Property("CRITERIA", "CONSTR")]
49 [Property("AUTHOR", "guowei.wang@samsung.com")]
50 public void NUIWidgetApplicationConstructor()
52 tlog.Debug(tag, $"NUIWidgetApplicationConstructor START");
54 var testingTarget = new NUIWidgetApplication(typeof(MyWidget));
55 Assert.IsNotNull(testingTarget, "should be not null.");
56 Assert.IsInstanceOf<NUIWidgetApplication>(testingTarget, "Should be an instance of NUIWidgetApplication type.");
58 testingTarget.Dispose();
59 tlog.Debug(tag, $"NUIWidgetApplicationConstructor END (OK)");
64 [Description("NUIWidgetApplication constructor. With stylesheet.")]
65 [Property("SPEC", "Tizen.NUI.NUIWidgetApplication.NUIWidgetApplication C")]
66 [Property("SPEC_URL", "-")]
67 [Property("CRITERIA", "CONSTR")]
68 [Property("AUTHOR", "guowei.wang@partner.samsung.com")]
69 public void NUIWidgetApplicationConstructorWithStylesheet()
71 tlog.Debug(tag, $"NUIWidgetApplicationConstructorWithStylesheet START");
73 var testingTarget = new NUIWidgetApplication(typeof(MyWidget), "stylesheet");
74 Assert.IsNotNull(testingTarget, "should be not null.");
75 Assert.IsInstanceOf<NUIWidgetApplication>(testingTarget, "Should be an instance of NUIWidgetApplication type.");
77 testingTarget.Dispose();
78 tlog.Debug(tag, $"NUIWidgetApplicationConstructorWithStylesheet END (OK)");
83 [Description("NUIWidgetApplication constructor. With multi class.")]
84 [Property("SPEC", "Tizen.NUI.NUIWidgetApplication.NUIWidgetApplication C")]
85 [Property("SPEC_URL", "-")]
86 [Property("CRITERIA", "CONSTR")]
87 [Property("AUTHOR", "guowei.wang@samsung.com")]
88 public void NUIWidgetApplicationConstructorWithMultiClass()
90 tlog.Debug(tag, $"NUIWidgetApplicationConstructorWithMultiClass START");
92 Dictionary<Type, string> widgetSet = new Dictionary<Type, string>();
93 widgetSet.Add(typeof(MyWidget), "Tizen.NUI.Tests");
95 var testingTarget = new NUIWidgetApplication(widgetSet);
96 Assert.IsNotNull(testingTarget, "should be not null.");
97 Assert.IsInstanceOf<NUIWidgetApplication>(testingTarget, "Should be an instance of NUIWidgetApplication type.");
99 testingTarget.Dispose();
100 tlog.Debug(tag, $"NUIWidgetApplicationConstructorWithMultiClass END (OK)");
105 [Description("NUIWidgetApplication constructor. With invalid value.")]
106 [Property("SPEC", "Tizen.NUI.NUIWidgetApplication.NUIWidgetApplication C")]
107 [Property("SPEC_URL", "-")]
108 [Property("CRITERIA", "CONSTR")]
109 [Property("AUTHOR", "guowei.wang@samsung.com")]
110 public void NUIWidgetApplicationConstructorWithNullValue()
112 tlog.Debug(tag, $"NUIWidgetApplicationConstructorWithNullValue START");
116 Dictionary<Type, string> widgetSet = null;
117 var testingTarget = new NUIWidgetApplication(widgetSet);
119 catch (InvalidOperationException e)
121 Assert.Pass("Create a NUIWidgetApplication with invalid Dictionary");
124 tlog.Debug(tag, $"NUIWidgetApplicationConstructorWithNullValue END (OK)");
129 [Description("NUIWidgetApplication Dispose.")]
130 [Property("SPEC", "Tizen.NUI.NUIWidgetApplication.Dispose M")]
131 [Property("SPEC_URL", "-")]
132 [Property("CRITERIA", "MR")]
133 [Property("AUTHOR", "guowei.wang@partner.samsung.com")]
134 public void NUIWidgetApplicationDispose()
136 tlog.Debug(tag, $"NUIWidgetApplicationDispose START");
140 var testingTarget = new NUIWidgetApplication(typeof(MyWidget));
141 Assert.IsNotNull(testingTarget, "should be not null.");
142 Assert.IsInstanceOf<NUIWidgetApplication>(testingTarget, "Should be an instance of NUIWidgetApplication type.");
144 testingTarget.Dispose();
148 tlog.Error(tag, "Caught Exception" + e.ToString());
149 LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
150 Assert.Fail("Caught Exception" + e.ToString());
153 tlog.Debug(tag, $"NUIWidgetApplicationDispose END (OK)");