Merge remote-tracking branch 'origin/master' into tizen
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / Application / TSWatchBoolSignal.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/WatchBoolSignal")]
13     public class InternalWatchBoolSignalTest
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         internal class MyWatchBoolSignal : WatchBoolSignal
23         {
24             public MyWatchBoolSignal(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
25             { }
26
27             public void OnReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr)
28             {
29                 base.ReleaseSwigCPtr(swigCPtr);
30             }
31         }
32
33         [SetUp]
34         public void Init()
35         {
36             tlog.Info(tag, "Init() is called!");
37         }
38
39         [TearDown]
40         public void Destroy()
41         {
42             tlog.Info(tag, "Destroy() is called!");
43         }
44
45         [Test]
46         [Category("P1")]
47         [Description("WatchBoolSignal constructor.")]
48         [Property("SPEC", "Tizen.NUI.WatchBoolSignal.WatchBoolSignal C")]
49         [Property("SPEC_URL", "-")]
50         [Property("CRITERIA", "CONSTR")]
51         [Property("AUTHOR", "guowei.wang@samsung.com")]
52         public void WatchBoolSignalConstructor()
53         {
54             tlog.Debug(tag, $"WatchBoolSignalConstructor START");
55
56             using (ImageView imageView = new ImageView())
57             {
58                 var testingTarget = new WatchBoolSignal(imageView.SwigCPtr.Handle, false);
59                 Assert.IsNotNull(testingTarget, "should be not null");
60                 Assert.IsInstanceOf<WatchBoolSignal>(testingTarget, "should be an instance of testing target class!");
61
62                 testingTarget.Dispose();
63             }
64
65             tlog.Debug(tag, $"WatchBoolSignalConstructor END (OK)");
66         }
67
68         //[Test]
69         //[Category("P1")]
70         //[Description("WatchApplication ReleaseSwigCPtr.")]
71         //[Property("SPEC", "Tizen.NUI.WatchApplication.ReleaseSwigCPtr M")]
72         //[Property("SPEC_URL", "-")]
73         //[Property("CRITERIA", "MR")]
74         //[Property("AUTHOR", "guowei.wang@samsung.com")]
75         //public void WatchApplicationReleaseSwigCPtr()
76         //{
77         //    tlog.Debug(tag, $"WatchBoolSignalReleaseSwigCPtr START");
78
79         //    using (ImageView imageView = new ImageView())
80         //    {
81         //        var testingTarget = new MyWatchBoolSignal(imageView.SwigCPtr.Handle, false);
82         //        Assert.IsNotNull(testingTarget, "should be not null");
83         //        Assert.IsInstanceOf<WatchBoolSignal>(testingTarget, "should be an instance of testing target class!");
84
85         //        try
86         //        {
87         //            testingTarget.OnReleaseSwigCPtr(imageView.SwigCPtr);
88         //        }
89         //        catch (Exception e)
90         //        {
91         //            /** Unable to find an entry point named 'CSharp_Dali_delete_WatchBoolSignal' in shared library 'libdali2-csharp-binder.so' */
92         //            tlog.Debug(tag, e.Message.ToString());
93         //            Assert.Fail("Caught Exception: Failed!");
94         //        }
95
96         //        testingTarget.Dispose();
97         //    }
98
99         //    tlog.Debug(tag, $"WatchBoolSignalReleaseSwigCPtr END (OK)");
100         //}
101
102         //[Test]
103         //[Category("P1")]
104         //[Description("WatchBoolSignal Empty.")]
105         //[Property("SPEC", "Tizen.NUI.WatchBoolSignal.Empty M")]
106         //[Property("SPEC_URL", "-")]
107         //[Property("CRITERIA", "MR")]
108         //[Property("AUTHOR", "guowei.wang@samsung.com")]
109         //public void WatchBoolSignalEmpty()
110         //{
111         //    tlog.Debug(tag, $"WatchBoolSignalEmpty START");
112
113         //    using (ImageView imageView = new ImageView())
114         //    {
115         //        var testingTarget = new WatchBoolSignal(imageView.SwigCPtr.Handle, false);
116         //        Assert.IsNotNull(testingTarget, "should be not null");
117         //        Assert.IsInstanceOf<WatchBoolSignal>(testingTarget, "should be an instance of testing target class!");
118
119         //        try
120         //        {
121         //            /** Unable to find an entry point named 'CSharp_Dali_WatchBoolSignal_Empty' in shared library 'libdali2-csharp-binder.so' */
122         //            var result = testingTarget.Empty();
123         //        }
124         //        catch (Exception e)
125         //        {
126         //            tlog.Debug(tag, e.Message.ToString());
127         //            Assert.Fail("Caught Exception: Failed!");
128         //        }
129
130         //        testingTarget.Dispose();
131         //    }
132         //    tlog.Debug(tag, $"WatchBoolSignalEmpty END (OK)");
133         //}
134
135         //[Test]
136         //[Category("P1")]
137         //[Description("WatchBoolSignal GetConnectionCount.")]
138         //[Property("SPEC", "Tizen.NUI.WatchBoolSignal.GetConnectionCount M")]
139         //[Property("SPEC_URL", "-")]
140         //[Property("CRITERIA", "MR")]
141         //[Property("AUTHOR", "guowei.wang@samsung.com")]
142         //public void WatchBoolSignalGetConnectionCount()
143         //{
144         //    tlog.Debug(tag, $"WatchBoolSignalGetConnectionCount START");
145
146         //    using (ImageView imageView = new ImageView())
147         //    {
148         //        var testingTarget = new WatchBoolSignal(imageView.SwigCPtr.Handle, false);
149         //        Assert.IsNotNull(testingTarget, "should be not null");
150         //        Assert.IsInstanceOf<WatchBoolSignal>(testingTarget, "should be an instance of testing target class!");
151
152         //        try
153         //        {
154         //            /** Unable to find an entry point named 'CSharp_Dali_WatchBoolSignal_GetConnectionCount' in shared library 'libdali2-csharp-binder.so' */
155         //            var result = testingTarget.GetConnectionCount();
156         //            Assert.IsTrue(result == 0, "result should be 0");
157         //        }
158         //        catch (Exception e)
159         //        {
160         //            tlog.Debug(tag, e.Message.ToString());
161         //            Assert.Fail("Caught Exception: Failed!");
162         //        }
163
164         //        testingTarget.Dispose();
165         //    }
166         //    tlog.Debug(tag, $"WatchBoolSignalGetConnectionCount END (OK)");
167         //}
168
169         //[Test]
170         //[Category("P1")]
171         //[Description("WatchBoolSignal connection.")]
172         //[Property("SPEC", "Tizen.NUI.WatchBoolSignal.Connect M")]
173         //[Property("SPEC_URL", "-")]
174         //[Property("CRITERIA", "MR")]
175         //[Property("AUTHOR", "guowei.wang@samsung.com")]
176         //public void WatchBoolSignalConnection()
177         //{
178         //    tlog.Debug(tag, $"WatchBoolSignalConnection START");
179
180         //    using (ImageView imageView = new ImageView())
181         //    {
182         //        var testingTarget = new WatchBoolSignal(imageView.SwigCPtr.Handle, false);
183         //        Assert.IsNotNull(testingTarget, "should be not null");
184         //        Assert.IsInstanceOf<WatchBoolSignal>(testingTarget, "should be an instance of testing target class!");
185
186         //        dummyCallback callback = OnDummyCallback;
187
188         //        try
189         //        {
190         //            /** Unable to find an entry point named 'CSharp_Dali_WatchBoolSignal_Connect' in shared library 'libdali2-csharp-binder.so' */
191         //            testingTarget.Connect(callback);
192         //        }
193         //        catch (Exception e)
194         //        {
195         //            tlog.Debug(tag, e.Message.ToString());
196         //            Assert.Fail("Caught Exception: Failed!");
197         //        }
198
199         //        testingTarget.Dispose();
200         //    }
201         //    tlog.Debug(tag, $"WatchBoolSignalConnection END (OK)");
202         //}
203
204         //[Test]
205         //[Category("P1")]
206         //[Description("WatchBoolSignal disconnection.")]
207         //[Property("SPEC", "Tizen.NUI.WatchBoolSignal.Disconnect M")]
208         //[Property("SPEC_URL", "-")]
209         //[Property("CRITERIA", "MR")]
210         //[Property("AUTHOR", "guowei.wang@samsung.com")]
211         //public void WatchBoolSignalDisconnection()
212         //{
213         //    tlog.Debug(tag, $"WatchBoolSignalDisconnection START");
214
215         //    using (ImageView imageView = new ImageView())
216         //    {
217         //        var testingTarget = new WatchBoolSignal(imageView.SwigCPtr.Handle, false);
218         //        Assert.IsNotNull(testingTarget, "should be not null");
219         //        Assert.IsInstanceOf<WatchBoolSignal>(testingTarget, "should be an instance of testing target class!");
220
221         //        dummyCallback callback = OnDummyCallback;
222
223         //        try
224         //        {
225         //            /** Unable to find an entry point named 'CSharp_Dali_WatchBoolSignal_Disconnect' in shared library 'libdali2-csharp-binder.so' */
226         //            testingTarget.Connect(callback);
227         //            testingTarget.Disconnect(callback); 
228         //        }
229         //        catch (Exception e)
230         //        {   
231         //            tlog.Debug(tag, e.Message.ToString());
232         //            Assert.Fail("Caught Exception: Failed!");
233         //        }
234
235         //        testingTarget.Dispose();
236         //    }
237
238         //    tlog.Debug(tag, $"WatchBoolSignalDisconnection END (OK)");
239         //}
240
241         //[Test]
242         //[Category("P1")]
243         //[Description("WatchBoolSignal Emit.")]
244         //[Property("SPEC", "Tizen.NUI.WatchBoolSignal.Emit M")]
245         //[Property("SPEC_URL", "-")]
246         //[Property("CRITERIA", "MR")]
247         //[Property("AUTHOR", "guowei.wang@samsung.com")]
248         //public void WatchBoolSignalEmit()
249         //{
250         //    tlog.Debug(tag, $"WatchBoolSignalEmit START");
251
252         //    var currentPid = global::System.Diagnostics.Process.GetCurrentProcess().Id;
253         //    var currentTid = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
254
255         //    tlog.Debug(tag, $"thread check! main pid={App.mainPid}, current pid={currentPid}, main tid={App.mainTid}, current tid={currentTid}");
256
257         //    using (ImageView imageView = new ImageView())
258         //    {
259         //        var testingTarget = new WatchBoolSignal(imageView.SwigCPtr.Handle, false);
260         //        Assert.IsNotNull(testingTarget, "should be not null");
261         //        Assert.IsInstanceOf<WatchBoolSignal>(testingTarget, "should be an instance of testing target class!");
262
263         //        Widget widget = new Widget();
264         //        var application = new WidgetApplication(widget.GetIntPtr(), false);
265
266         //        try
267         //        {
268         //            /** Unable to find an entry point named 'CSharp_Dali_WatchBoolSignal_Emit' in shared library 'libdali2-csharp-binder.so' */
269         //            testingTarget.Emit(application, true);
270         //        }
271         //        catch (Exception e)
272         //        {
273         //            tlog.Debug(tag, e.Message.ToString());
274         //            Assert.Fail("Caught Exception: Failed!");
275         //        }
276
277         //        widget.Dispose();
278         //        widget = null;
279
280         //        testingTarget.Dispose();
281         //    }
282
283         //    tlog.Debug(tag, $"WatchBoolSignalEmit END (OK)");         
284         //}
285     }
286 }