[NUI] Update NUI.Devel to fix block and crash issues.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / Window / TSWindowEffectSignal.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/Window/WindowEffectSignal")]
14     public class InternalWindowEffectSignalTest
15     {
16         private const string tag = "NUITEST";
17
18         private delegate bool dummyCallback(IntPtr signal);
19         private bool OnDummyCallback(IntPtr data)
20         {
21             return false;
22         }
23
24         [SetUp]
25         public void Init()
26         {
27             tlog.Info(tag, "Init() is called!");
28         }
29
30         [TearDown]
31         public void Destroy()
32         {
33             tlog.Info(tag, "Destroy() is called!");
34         }
35
36         [Test]
37         [Category("P1")]
38         [Description("WindowTransitionEffectSignal constructor")]
39         [Property("SPEC", "Tizen.NUI.WindowEffectSignal.WindowTransitionEffectSignal C")]
40         [Property("SPEC_URL", "-")]
41         [Property("CRITERIA", "CONSTR")]
42         [Property("AUTHOR", "guowei.wang@samsung.com")]
43         public void WindowTransitionEffectSignalConstructor()
44         {
45             tlog.Debug(tag, $"WindowTransitionEffectSignalConstructor START");
46
47             var testingTarget = new WindowTransitionEffectSignal(Window.Instance);
48             Assert.IsNotNull(testingTarget, "should be not null");
49             Assert.IsInstanceOf<WindowTransitionEffectSignal>(testingTarget, "should be an instance of WindowTransitionEffectSignal class!");
50
51             testingTarget.Dispose();
52             tlog.Debug(tag, $"WindowTransitionEffectSignalConstructor END (OK)");
53         }
54
55         [Test]
56         [Category("P1")]
57         [Description("WindowTransitionEffectSignal Empty.")]
58         [Property("SPEC", "Tizen.NUI.WindowTransitionEffectSignal.Empty M")]
59         [Property("SPEC_URL", "-")]
60         [Property("CRITERIA", "MR")]
61         [Property("AUTHOR", "guowei.wang@samsung.com")]
62         public void WindowTransitionEffectSignalEmpty()
63         {
64             tlog.Debug(tag, $"WindowTransitionEffectSignalEmpty START");
65
66             var testingTarget = new WindowTransitionEffectSignal(Window.Instance);
67             Assert.IsNotNull(testingTarget, "Should be not null!");
68             Assert.IsInstanceOf<WindowTransitionEffectSignal>(testingTarget, "Should be an Instance of WindowTransitionEffectSignal!");
69
70             try
71             {
72                 testingTarget.Empty();
73             }
74             catch (Exception e)
75             {
76                 tlog.Debug(tag, e.Message.ToString());
77                 Assert.Fail("Caught Exception: Failed!");
78             }
79
80             testingTarget.Dispose();
81             tlog.Debug(tag, $"WindowTransitionEffectSignalEmpty END (OK)");
82         }
83
84         [Test]
85         [Category("P1")]
86         [Description("WindowTransitionEffectSignal GetConnectionCount.")]
87         [Property("SPEC", "Tizen.NUI.WindowTransitionEffectSignal.GetConnectionCount M")]
88         [Property("SPEC_URL", "-")]
89         [Property("CRITERIA", "MR")]
90         [Property("AUTHOR", "guowei.wang@samsung.com")]
91         public void WindowTransitionEffectSignalGetConnectionCount()
92         {
93             tlog.Debug(tag, $"WindowTransitionEffectSignalGetConnectionCount START");
94
95             var testingTarget = new WindowTransitionEffectSignal(Window.Instance);
96             Assert.IsNotNull(testingTarget, "Should be not null!");
97             Assert.IsInstanceOf<WindowTransitionEffectSignal>(testingTarget, "Should be an Instance of WindowTransitionEffectSignal!");
98
99             try
100             {
101                 testingTarget.GetConnectionCount();
102             }
103             catch (Exception e)
104             {
105                 tlog.Debug(tag, e.Message.ToString());
106                 Assert.Fail("Caught Exception: Failed!");
107             }
108
109             testingTarget.Dispose();
110
111             tlog.Debug(tag, $"WindowTransitionEffectSignalGetConnectionCount END (OK)");
112         }
113
114         [Test]
115         [Category("P1")]
116         [Description("WindowTransitionEffectSignal Connect.")]
117         [Property("SPEC", "Tizen.NUI.WindowTransitionEffectSignal.Connect M")]
118         [Property("SPEC_URL", "-")]
119         [Property("CRITERIA", "MR")]
120         [Property("AUTHOR", "guowei.wang@samsung.com")]
121         public void WindowTransitionEffectSignalConnect()
122         {
123             tlog.Debug(tag, $"WindowTransitionEffectSignalConnect START");
124
125             var testingTarget = new WindowTransitionEffectSignal(Window.Instance);
126             Assert.IsNotNull(testingTarget, "Should be not null!");
127             Assert.IsInstanceOf<WindowTransitionEffectSignal>(testingTarget, "Should be an Instance of WindowTransitionEffectSignal!");
128
129             try
130             {
131                 dummyCallback callback = OnDummyCallback;
132                 testingTarget.Connect(callback);
133                 testingTarget.Disconnect(callback);
134             }
135             catch (Exception e)
136             {
137                 tlog.Debug(tag, e.Message.ToString());
138                 Assert.Fail("Caught Exception: Failed!");
139             }
140
141             testingTarget.Dispose();
142
143             tlog.Debug(tag, $"WindowTransitionEffectSignalConnect END (OK)");
144         }
145
146         [Test]
147         [Category("P1")]
148         [Description("WindowTransitionEffectSignal Emit.")]
149         [Property("SPEC", "Tizen.NUI.WindowTransitionEffectSignal.Emit M")]
150         [Property("SPEC_URL", "-")]
151         [Property("CRITERIA", "MR")]
152         [Property("AUTHOR", "guowei.wang@samsung.com")]
153         public void WindowTransitionEffectSignalEmit()
154         {
155             tlog.Debug(tag, $"WindowTransitionEffectSignalEmit START");
156             var currentPid = global::System.Diagnostics.Process.GetCurrentProcess().Id;
157             var currentTid = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
158
159             tlog.Debug(tag, $"thread check! main pid={App.mainPid}, current pid={currentPid}, main tid={App.mainTid}, current tid={currentTid}");
160
161             using (Window window = new Window(new Rectangle(0, 0, 2, 2), false))
162             {
163                 var testingTarget = new WindowTransitionEffectSignal(Window.Instance);
164                 Assert.IsNotNull(testingTarget, "Should be not null!");
165                 Assert.IsInstanceOf<WindowTransitionEffectSignal>(testingTarget, "Should be an Instance of WindowTransitionEffectSignal!");
166
167                 try
168                 {
169                     testingTarget.Emit(window, 1, 1);
170                 }
171                 catch (Exception e)
172                 {
173                     tlog.Debug(tag, e.Message.ToString());
174                     Assert.Fail("Caught Exception: Failed!");
175                 }
176
177                 testingTarget.Dispose();
178             }
179
180             tlog.Debug(tag, $"WindowTransitionEffectSignalEmit END (OK)");
181         }
182     }
183 }