[NUI] Add Application(Internal & Public) TCs.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.TCT / testcase / internal / Application / TSComponentApplication.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
7 namespace Tizen.NUI.Devel.Tests
8 {
9     using tlog = Tizen.Log;
10
11     [TestFixture]
12     [Description("internal/Application/ComponentApplication")]
13     public class InternalComponentApplicationTest
14     {
15         private const string tag = "NUITEST";
16         private string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
17         private delegate bool dummyCallback(IntPtr application);
18         private bool OnDummyCallback(IntPtr data)
19         {
20             return false;
21         }
22
23         [SetUp]
24         public void Init()
25         {
26             tlog.Info(tag, "Init() is called!");
27         }
28
29         [TearDown]
30         public void Destroy()
31         {
32             tlog.Info(tag, "Destroy() is called!");
33         }
34
35         [Test]
36         [Description("ComponentApplication NewComponentApplication")]
37         [Property("AUTHOR", "guowei.wang@samsung.com")]
38         public void ComponentApplicationNewComponentApplication()
39         {
40             tlog.Debug(tag, $"ComponentApplicationNewComponentApplication START");
41
42             var args = new string[] { "Dali-demo" };
43             var stylesheet = resource + "/style/Test_Style_Manager.json";
44             var testingTarget = ComponentApplication.NewComponentApplication(args, stylesheet);
45             Assert.IsNotNull(testingTarget, "should be not null");
46             Assert.IsInstanceOf<ComponentApplication>(testingTarget, "should be an instance of testing target class!");
47
48             testingTarget.Dispose();
49             tlog.Debug(tag, $"ComponentApplicationNewComponentApplication END (OK)");
50         }
51
52         [Test]
53         [Description("ComponentApplication New")]
54         [Property("AUTHOR", "guowei.wang@samsung.com")]
55         public void ComponentApplicationNew()
56         {
57             tlog.Debug(tag, $"ComponentApplicationNew START");
58
59             var args = new string[] { "Dali-demo" };
60             var stylesheet = resource + "/style/Test_Style_Manager.json";
61             var testingTarget = ComponentApplication.New(args, stylesheet);
62             Assert.IsNotNull(testingTarget, "should be not null");
63             Assert.IsInstanceOf<ComponentApplication>(testingTarget, "should be an instance of testing target class!");
64
65             testingTarget.Dispose();
66             tlog.Debug(tag, $"ComponentApplicationNew END (OK)");
67         }
68
69         [Test]
70         [Description("ComponentApplication connection")]
71         [Property("AUTHOR", "guowei.wang@samsung.com")]
72         public void ComponentApplicationConnection()
73         {
74             tlog.Debug(tag, $"ComponentApplicationConnection START");
75
76             var args = new string[] { "Dali-demo" };
77             var stylesheet = resource + "/style/Test_Style_Manager.json";
78             var testingTarget = ComponentApplication.NewComponentApplication(args, stylesheet);
79             Assert.IsNotNull(testingTarget, "should be not null");
80             Assert.IsInstanceOf<ComponentApplication>(testingTarget, "should be an instance of testing target class!");
81
82             dummyCallback callback = OnDummyCallback;
83             testingTarget.Connect(callback);
84             testingTarget.Disconnect(callback);
85             testingTarget.Dispose();
86
87             tlog.Debug(tag, $"ComponentApplicationConnection END (OK)");
88         }
89
90         [Test]
91         [Description("ComponentApplication disconnection")]
92         [Property("AUTHOR", "guowei.wang@samsung.com")]
93         public void ComponentApplicationDisconnection()
94         {
95             tlog.Debug(tag, $"ComponentApplicationDisconnection START");
96
97             var args = new string[] { "Dali-demo" };
98             var stylesheet = resource + "/style/Test_Style_Manager.json";
99             var testingTarget = ComponentApplication.NewComponentApplication(args, stylesheet);
100             Assert.IsNotNull(testingTarget, "should be not null");
101             Assert.IsInstanceOf<ComponentApplication>(testingTarget, "should be an instance of testing target class!");
102
103             dummyCallback callback = OnDummyCallback;
104             testingTarget.Connect(callback);
105             testingTarget.Disconnect(callback);
106             testingTarget.Dispose();
107
108             tlog.Debug(tag, $"ComponentApplicationDisconnection END (OK)");
109         }
110     }
111 }