Release 9.0.0.16429
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / Application / TSNUIWidgetCoreBackend.cs
1 using global::System;
2 using NUnit.Framework;
3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 using System.Collections.Generic;
7
8 namespace Tizen.NUI.Devel.Tests
9 {
10     using tlog = Tizen.Log;
11
12     [TestFixture]
13     [Description("internal/Application/NUIWidgetCoreBackend")]
14     public class InternalNUIWidgetCoreBackendTest
15     {
16         private const string tag = "NUITEST";
17         private string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
18
19         [SetUp]
20         public void Init()
21         {
22             tlog.Info(tag, "Init() is called!");
23         }
24
25         [TearDown]
26         public void Destroy()
27         {
28             tlog.Info(tag, "Destroy() is called!");
29         }
30
31         [Test]
32         [Description("NUIWidgetCoreBackend constructor")]
33         [Property("AUTHOR", "guowei.wang@samsung.com")]
34         public void NUIWidgetCoreBackendConstructor()
35         {
36             tlog.Debug(tag, $"NUIWidgetCoreBackendConstructor START");
37
38             var testingTarget = new NUIWidgetCoreBackend();
39             Assert.IsNotNull(testingTarget, "should be not null");
40             Assert.IsInstanceOf<NUIWidgetCoreBackend>(testingTarget, "should be an instance of testing target class!");
41
42             testingTarget.Dispose();
43             tlog.Debug(tag, $"NUIWidgetCoreBackendConstructor END (OK)");
44         }
45
46         [Test]
47         [Description("NUIWidgetCoreBackend constructor with stylesheet")]
48         [Property("AUTHOR", "guowei.wang@samsung.com")]
49         public void NUIWidgetCoreBackendConstructorWithStylesheet()
50         {
51             tlog.Debug(tag, $"NUIWidgetCoreBackendConstructorWithStylesheet START");
52
53             var dummy = resource + "/style/Test_Style_Manager.json";
54             var testingTarget = new NUIWidgetCoreBackend(dummy);
55             Assert.IsNotNull(testingTarget, "should be not null");
56             Assert.IsInstanceOf<NUIWidgetCoreBackend>(testingTarget, "should be an instance of testing target class!");
57
58             testingTarget.Dispose();
59             tlog.Debug(tag, $"NUIWidgetCoreBackendConstructorWithStylesheet END (OK)");
60         }
61
62         [Test]
63         [Description("NUIWidgetCoreBackend dispose")]
64         [Property("AUTHOR", "guowei.wang@samsung.com")]
65         public void NUIWidgetCoreBackendDispose()
66         {
67             tlog.Debug(tag, $"NUIWidgetCoreBackendDispose START");
68
69             var testingTarget = new NUIWidgetCoreBackend();
70             Assert.IsNotNull(testingTarget, "should be not null");
71             Assert.IsInstanceOf<NUIWidgetCoreBackend>(testingTarget, "should be an instance of testing target class!");
72
73             try
74             {
75                 testingTarget.Dispose();
76             }
77             catch (Exception e)
78             {
79                 tlog.Error(tag, "Caught Exception" + e.ToString());
80                 Assert.Fail("Caught Exception" + e.ToString());
81             }
82
83             tlog.Debug(tag, $"NUIWidgetCoreBackendDispose END (OK)");
84         }
85
86         [Test]
87         [Description("NUIWidgetCoreBackend exit")]
88         [Property("AUTHOR", "guowei.wang@samsung.com")]
89         public void NUIWidgetCoreBackendExit()
90         {
91             tlog.Debug(tag, $"NUIWidgetCoreBackendExit START");
92
93             var testingTarget = new NUIWidgetCoreBackend();
94             Assert.IsNotNull(testingTarget, "should be not null");
95             Assert.IsInstanceOf<NUIWidgetCoreBackend>(testingTarget, "should be an instance of testing target class!");
96
97             try
98             {
99                 testingTarget.Exit();
100             }
101             catch (Exception e)
102             {
103                 tlog.Error(tag, "Caught Exception" + e.ToString());
104                 Assert.Fail("Caught Exception" + e.ToString());
105             }
106
107             testingTarget.Dispose();
108             tlog.Debug(tag, $"NUIWidgetCoreBackendExit END (OK)");
109         }
110
111         [Test]
112         [Description("NUIWidgetCoreBackend register widget info")]
113         [Property("AUTHOR", "guowei.wang@samsung.com")]
114         public void NUIWidgetCoreBackendRegisterWidgetInfo()
115         {
116             tlog.Debug(tag, $"NUIWidgetCoreBackendRegisterWidgetInfo START");
117
118             var testingTarget = new NUIWidgetCoreBackend();
119             Assert.IsNotNull(testingTarget, "should be not null");
120             Assert.IsInstanceOf<NUIWidgetCoreBackend>(testingTarget, "should be an instance of testing target class!");
121
122             var widgetInfo = new Dictionary<global::System.Type, string>();
123             testingTarget.RegisterWidgetInfo(widgetInfo);
124
125             testingTarget.Dispose();
126             tlog.Debug(tag, $"NUIWidgetCoreBackendRegisterWidgetInfo END (OK)");
127         }
128
129         [Test]
130         [Description("NUIWidgetCoreBackend add widget info")]
131         [Property("AUTHOR", "guowei.wang@samsung.com")]
132         public void NUIWidgetCoreBackendAddWidgetInfo()
133         {
134             tlog.Debug(tag, $"NUIWidgetCoreBackendAddWidgetInfo START");
135
136             var testingTarget = new NUIWidgetCoreBackend();
137             Assert.IsNotNull(testingTarget, "should be not null");
138             Assert.IsInstanceOf<NUIWidgetCoreBackend>(testingTarget, "should be an instance of testing target class!");
139
140             var widgetInfo = new Dictionary<global::System.Type, string>();
141             testingTarget.AddWidgetInfo(widgetInfo);
142
143             testingTarget.Dispose();
144             tlog.Debug(tag, $"NUIWidgetCoreBackendAddWidgetInfo END (OK)");
145         }
146     }
147 }