3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
7 namespace Tizen.NUI.Devel.Tests
9 using tlog = Tizen.Log;
12 [Description("internal/Application/ApplicationControlSignal")]
13 public class InternalApplicationControlSignalTest
15 private const string tag = "NUITEST";
16 private delegate bool dummyCallback(IntPtr application);
17 private bool OnDummyCallback(IntPtr data)
25 tlog.Info(tag, "Init() is called!");
31 tlog.Info(tag, "Destroy() is called!");
36 [Description("ApplicationControlSignal constructor.")]
37 [Property("SPEC", "Tizen.NUI.ApplicationControlSignal.ApplicationControlSignal C")]
38 [Property("SPEC_URL", "-")]
39 [Property("CRITERIA", "CONSTR")]
40 [Property("AUTHOR", "guowei.wang@samsung.com")]
41 public void ApplicationControlSignalConstructor()
43 tlog.Debug(tag, $"ApplicationControlSignalConstructor START");
45 var testingTarget = new ApplicationControlSignal();
47 Assert.IsNotNull(testingTarget, "should be not null");
48 Assert.IsInstanceOf<ApplicationControlSignal>(testingTarget, "should be an instance of testing target class!");
50 testingTarget.Dispose();
51 tlog.Debug(tag, $"ApplicationControlSignalConstructor END (OK)");
56 [Description("ApplicationControlSignal Empty.")]
57 [Property("SPEC", "Tizen.NUI.ApplicationControlSignal.Empty M")]
58 [Property("SPEC_URL", "-")]
59 [Property("CRITERIA", "MR")]
60 [Property("AUTHOR", "guowei.wang@samsung.com")]
61 public void ApplicationControlSignalEmpty()
63 tlog.Debug(tag, $"ApplicationControlSignalEmpty START");
65 var testingTarget = new ApplicationControlSignal();
66 Assert.IsNotNull(testingTarget, "should be not null");
67 Assert.IsInstanceOf<ApplicationControlSignal>(testingTarget, "should be an instance of testing target class!");
69 var result = testingTarget.Empty();
70 Assert.IsTrue(result);
72 testingTarget.Dispose();
73 tlog.Debug(tag, $"ApplicationControlSignalEmpty END (OK)");
78 [Description("ApplicationControlSignal GetConnectionCount.")]
79 [Property("SPEC", "Tizen.NUI.ApplicationControlSignal.GetConnectionCount M")]
80 [Property("SPEC_URL", "-")]
81 [Property("CRITERIA", "MR")]
82 [Property("AUTHOR", "guowei.wang@samsung.com")]
83 public void ApplicationControlSignalGetConnectionCount()
85 tlog.Debug(tag, $"ApplicationControlSignalGetConnectionCount START");
87 var testingTarget = new ApplicationControlSignal();
88 Assert.IsNotNull(testingTarget, "should be not null");
89 Assert.IsInstanceOf<ApplicationControlSignal>(testingTarget, "should be an instance of testing target class!");
91 var result = testingTarget.GetConnectionCount();
92 Assert.IsTrue(result == 0, "result should be 0");
94 testingTarget.Dispose();
95 tlog.Debug(tag, $"ApplicationControlSignalGetConnectionCount END (OK)");
100 [Description("ApplicationControlSignal connection.")]
101 [Property("SPEC", "Tizen.NUI.ApplicationControlSignal.Connect M")]
102 [Property("SPEC_URL", "-")]
103 [Property("CRITERIA", "MR")]
104 [Property("AUTHOR", "guowei.wang@samsung.com")]
105 public void ApplicationControlSignalConnection()
107 tlog.Debug(tag, $"ApplicationControlSignalConnection START");
109 var testingTarget = new ApplicationControlSignal();
110 Assert.IsNotNull(testingTarget, "should be not null");
111 Assert.IsInstanceOf<ApplicationControlSignal>(testingTarget, "should be an instance of testing target class!");
113 dummyCallback callback = OnDummyCallback;
114 testingTarget.Connect(callback);
115 testingTarget.Disconnect(callback);
116 testingTarget.Dispose();
118 tlog.Debug(tag, $"ApplicationControlSignalConnection END (OK)");
123 [Description("ApplicationControlSignal disconnection.")]
124 [Property("SPEC", "Tizen.NUI.ApplicationControlSignal.Disconnect M")]
125 [Property("SPEC_URL", "-")]
126 [Property("CRITERIA", "MR")]
127 [Property("AUTHOR", "guowei.wang@samsung.com")]
128 public void ApplicationControlSignalDisconnection()
130 tlog.Debug(tag, $"ApplicationControlSignalDisconnection START");
132 var testingTarget = new ApplicationControlSignal();
133 Assert.IsNotNull(testingTarget, "should be not null");
134 Assert.IsInstanceOf<ApplicationControlSignal>(testingTarget, "should be an instance of testing target class!");
136 dummyCallback callback = OnDummyCallback;
137 testingTarget.Connect(callback);
138 testingTarget.Disconnect(callback);
139 testingTarget.Dispose();
141 tlog.Debug(tag, $"ApplicationControlSignalDisconnection END (OK)");
146 [Description("ApplicationControlSignal Emit.")]
147 [Property("SPEC", "Tizen.NUI.ApplicationControlSignal.Emit M")]
148 [Property("SPEC_URL", "-")]
149 [Property("CRITERIA", "MR")]
150 [Property("AUTHOR", "guowei.wang@samsung.com")]
151 public void ApplicationControlSignalEmit()
153 tlog.Debug(tag, $"ApplicationControlSignalEmit START");
154 var currentPid = global::System.Diagnostics.Process.GetCurrentProcess().Id;
155 var currentTid = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
157 tlog.Debug(tag, $"thread check! main pid={App.mainPid}, current pid={currentPid}, main tid={App.mainTid}, current tid={currentTid}");
159 var testingTarget = new ApplicationControlSignal();
160 Assert.IsNotNull(testingTarget, "should be not null");
161 Assert.IsInstanceOf<ApplicationControlSignal>(testingTarget, "should be an instance of testing target class!");
163 testingTarget.Emit(Application.Current, new global::System.IntPtr(0));
165 testingTarget.Dispose();
166 tlog.Debug(tag, $"ApplicationControlSignalEmit END (OK)");