Merge remote-tracking branch 'origin/master' into tizen
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / Utility / TSConnectionTrackerInterface.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/Utility/ConnectionTrackerInterface")]
13     public class InternalConnectionTrackerInterfaceTest
14     {
15         private const string tag = "NUITEST";
16         private delegate bool dummyCallback(IntPtr pageTurnSignal);
17         private bool OnDummyCallback(IntPtr data)
18         {
19             return false;
20         }
21
22         internal class MyConnectionTrackerInterface : ConnectionTrackerInterface
23         {
24             public MyConnectionTrackerInterface(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
25             { }
26         }
27
28         [SetUp]
29         public void Init()
30         {
31             tlog.Info(tag, "Init() is called!");
32         }
33
34         [TearDown]
35         public void Destroy()
36         {
37             tlog.Info(tag, "Destroy() is called!");
38         }
39
40         [Test]
41         [Category("P1")]
42         [Description("ConnectionTrackerInterface constructor.")]
43         [Property("SPEC", "Tizen.NUI.ConnectionTrackerInterface.ConnectionTrackerInterface C")]
44         [Property("SPEC_URL", "-")]
45         [Property("CRITERIA", "CONSTR")]
46         [Property("AUTHOR", "guowei.wang@samsung.com")]
47         public void ConnectionTrackerInterfaceConstructor()
48         {
49             tlog.Debug(tag, $"ConnectionTrackerInterfaceConstructor START");
50
51             using (View view = new View())
52             {
53                 var testingTarget = new ConnectionTrackerInterface(view.SwigCPtr.Handle, false);
54                 Assert.IsNotNull(testingTarget, "Should be not null!");
55                 Assert.IsInstanceOf<ConnectionTrackerInterface>(testingTarget, "Should be an Instance of ConnectionTrackerInterface!");
56
57                 testingTarget.Dispose();
58             }
59
60             tlog.Debug(tag, $"ConnectionTrackerInterfaceConstructor END (OK)");
61         }
62
63         [Test]
64         [Category("P1")]
65         [Description("ConnectionTrackerInterface getCPtr.")]
66         [Property("SPEC", "Tizen.NUI.ConnectionTrackerInterface.getCPtr M")]
67         [Property("SPEC_URL", "-")]
68         [Property("CRITERIA", "MR")]
69         [Property("AUTHOR", "guowei.wang@samsung.com")]
70         public void ConnectionTrackerInterfacegetCPtr()
71         {
72             tlog.Debug(tag, $"ConnectionTrackerInterfacegetCPtr START");
73
74             using (View view = new View())
75             {
76                 var testingTarget = new MyConnectionTrackerInterface(view.SwigCPtr.Handle, false);
77                 Assert.IsNotNull(testingTarget, "Should be not null!");
78                 Assert.IsInstanceOf<ConnectionTrackerInterface>(testingTarget, "Should be an Instance of ConnectionTrackerInterface!");
79
80                 try
81                 {
82                     ConnectionTrackerInterface.getCPtr(testingTarget);
83                 }
84                 catch (Exception e)
85                 {
86                     tlog.Debug(tag, e.Message.ToString());
87                     Assert.Fail("Caught Exception: Failed!");
88                 }
89
90                 testingTarget.Dispose();
91             }
92
93             tlog.Debug(tag, $"ConnectionTrackerInterfacegetCPtr END (OK)");
94         }
95
96         //[Test]
97         //[Category("P1")]
98         //[Description("ConnectionTrackerInterface SignalConnected.")]
99         //[Property("SPEC", "Tizen.NUI.ConnectionTrackerInterface.SignalConnected M")]
100         //[Property("SPEC_URL", "-")]
101         //[Property("CRITERIA", "MR")]
102         //[Property("AUTHOR", "guowei.wang@samsung.com")]
103         //public void ConnectionTrackerInterfaceSignalConnected()
104         //{
105         //    tlog.Debug(tag, $"ConnectionTrackerInterfaceSignalConnected START");
106
107         //    using (View view = new View())
108         //    {
109         //        var testingTarget = new ConnectionTrackerInterface(view.SwigCPtr.Handle, false);
110         //        Assert.IsNotNull(testingTarget, "Should be not null!");
111         //        Assert.IsInstanceOf<ConnectionTrackerInterface>(testingTarget, "Should be an Instance of ConnectionTrackerInterface!");
112
113         //        try
114         //        {
115         //            var slotObserver = new SlotObserver(testingTarget.SwigCPtr.Handle, false);
116         //            var callback = new SWIGTYPE_p_CallbackBase(testingTarget.SwigCPtr.Handle);
117         //            testingTarget.SignalConnected(slotObserver, callback);
118         //        }
119         //        catch (Exception e)
120         //        {
121         //            tlog.Debug(tag, e.Message.ToString());
122         //            Assert.Fail("Caught Exception: Failed!");
123         //        }
124
125         //        testingTarget.Dispose();
126         //    }
127
128         //    tlog.Debug(tag, $"ConnectionTrackerInterfaceSignalConnected END (OK)");
129         //}
130     }
131 }