68c88dd43cb4cdfb9d1c42ba25e43e16bd422aa0
[platform/core/csapi/tizenfx.git] /
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/ApplicationControlSignal")]
13     public class InternalApplicationControlSignalTest
14     {
15         private const string tag = "NUITEST";
16         private delegate bool dummyCallback(IntPtr application);
17         private bool OnDummyCallback(IntPtr data)
18         {
19             return false;
20         }
21
22         [SetUp]
23         public void Init()
24         {
25             tlog.Info(tag, "Init() is called!");
26         }
27
28         [TearDown]
29         public void Destroy()
30         {
31             tlog.Info(tag, "Destroy() is called!");
32         }
33
34         [Test]
35         [Description("ApplicationControlSignal constructor")]
36         [Property("AUTHOR", "guowei.wang@samsung.com")]
37         public void ApplicationControlSignalConstructor()
38         {
39             tlog.Debug(tag, $"ApplicationControlSignalConstructor START");
40
41             var testingTarget = new ApplicationControlSignal();
42
43             Assert.IsNotNull(testingTarget, "should be not null");
44             Assert.IsInstanceOf<ApplicationControlSignal>(testingTarget, "should be an instance of testing target class!");
45
46             testingTarget.Dispose();
47             tlog.Debug(tag, $"ApplicationControlSignalConstructor END (OK)");
48         }
49
50         [Test]
51         [Description("ApplicationControlSignal Empty")]
52         [Property("AUTHOR", "guowei.wang@samsung.com")]
53         public void ApplicationControlSignalEmpty()
54         {
55             tlog.Debug(tag, $"ApplicationControlSignalEmpty START");
56
57             var testingTarget = new ApplicationControlSignal();
58             Assert.IsNotNull(testingTarget, "should be not null");
59             Assert.IsInstanceOf<ApplicationControlSignal>(testingTarget, "should be an instance of testing target class!");
60
61             var result = testingTarget.Empty();
62             Assert.IsTrue(result);
63
64             testingTarget.Dispose();
65             tlog.Debug(tag, $"ApplicationControlSignalEmpty END (OK)");
66         }
67
68         [Test]
69         [Description("ApplicationControlSignal GetConnectionCount")]
70         [Property("AUTHOR", "guowei.wang@samsung.com")]
71         public void ApplicationControlSignalGetConnectionCount()
72         {
73             tlog.Debug(tag, $"ApplicationControlSignalGetConnectionCount START");
74
75             var testingTarget = new ApplicationControlSignal();
76             Assert.IsNotNull(testingTarget, "should be not null");
77             Assert.IsInstanceOf<ApplicationControlSignal>(testingTarget, "should be an instance of testing target class!");
78
79             var result = testingTarget.GetConnectionCount();
80             Assert.IsTrue(result == 0, "result should be 0");
81
82             testingTarget.Dispose();
83             tlog.Debug(tag, $"ApplicationControlSignalGetConnectionCount END (OK)");
84         }
85
86         [Test]
87         [Description("ApplicationControlSignal Connection")]
88         [Property("AUTHOR", "guowei.wang@samsung.com")]
89         public void ApplicationControlSignalConnection()
90         {
91             tlog.Debug(tag, $"ApplicationControlSignalConnection START");
92
93             var testingTarget = new ApplicationControlSignal();
94             Assert.IsNotNull(testingTarget, "should be not null");
95             Assert.IsInstanceOf<ApplicationControlSignal>(testingTarget, "should be an instance of testing target class!");
96
97             dummyCallback callback = OnDummyCallback;
98             testingTarget.Connect(callback);
99             testingTarget.Disconnect(callback);
100             testingTarget.Dispose();
101
102             tlog.Debug(tag, $"ApplicationControlSignalConnection END (OK)");
103         }
104
105         [Test]
106         [Description("ApplicationControlSignal Disconnection")]
107         [Property("AUTHOR", "guowei.wang@samsung.com")]
108         public void ApplicationControlSignalDisconnection()
109         {
110             tlog.Debug(tag, $"ApplicationControlSignalDisconnection START");
111
112             var testingTarget = new ApplicationControlSignal();
113             Assert.IsNotNull(testingTarget, "should be not null");
114             Assert.IsInstanceOf<ApplicationControlSignal>(testingTarget, "should be an instance of testing target class!");
115
116             dummyCallback callback = OnDummyCallback;
117             testingTarget.Connect(callback);
118             testingTarget.Disconnect(callback);
119             testingTarget.Dispose();
120
121             tlog.Debug(tag, $"ApplicationControlSignalDisconnection END (OK)");
122         }
123
124         [Test]
125         [Description("ApplicationControlSignal Emit")]
126         [Property("AUTHOR", "guowei.wang@samsung.com")]
127         public void ApplicationControlSignalEmit()
128         {
129             tlog.Debug(tag, $"ApplicationControlSignalEmit START");
130             var currentPid = global::System.Diagnostics.Process.GetCurrentProcess().Id;
131             var currentTid = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
132
133             tlog.Debug(tag, $"thread check! main pid={App.mainPid}, current pid={currentPid}, main tid={App.mainTid}, current tid={currentTid}");
134
135             var testingTarget = new ApplicationControlSignal();
136             Assert.IsNotNull(testingTarget, "should be not null");
137             Assert.IsInstanceOf<ApplicationControlSignal>(testingTarget, "should be an instance of testing target class!");
138
139             testingTarget.Emit(Application.Current, new global::System.IntPtr(0));
140
141             testingTarget.Dispose();
142             tlog.Debug(tag, $"ApplicationControlSignalEmit END (OK)");
143         }
144     }
145 }