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/WatchBoolSignal")]
13 public class InternalWatchBoolSignalTest
15 private const string tag = "NUITEST";
16 private delegate bool dummyCallback(IntPtr application);
17 private bool OnDummyCallback(IntPtr data)
22 private bool IsWearable()
25 var result = Tizen.System.Information.TryGetValue("tizen.org/feature/profile", out value);
26 if (result && value.Equals("wearable"))
37 tlog.Info(tag, "Init() is called!");
43 tlog.Info(tag, "Destroy() is called!");
47 [Description("WatchBoolSignal constructor")]
48 [Property("AUTHOR", "guowei.wang@samsung.com")]
49 public void WatchBoolSignalConstructor()
51 tlog.Debug(tag, $"WatchBoolSignalConstructor START");
55 var testingTarget = new WatchBoolSignal();
57 Assert.IsNotNull(testingTarget, "should be not null");
58 Assert.IsInstanceOf<WatchBoolSignal>(testingTarget, "should be an instance of testing target class!");
60 testingTarget.Dispose();
61 tlog.Debug(tag, $"WatchBoolSignalConstructor END (OK)");
65 tlog.Debug(tag, $"WatchBoolSignalConstructor END (OK)");
66 Assert.Pass("Not Supported profile");
71 [Description("WatchBoolSignal Empty")]
72 [Property("AUTHOR", "guowei.wang@samsung.com")]
73 public void WatchBoolSignalEmpty()
75 tlog.Debug(tag, $"WatchBoolSignalEmpty START");
79 var testingTarget = new WatchBoolSignal();
80 Assert.IsNotNull(testingTarget, "should be not null");
81 Assert.IsInstanceOf<WatchBoolSignal>(testingTarget, "should be an instance of testing target class!");
83 var result = testingTarget.Empty();
84 Assert.IsTrue(result);
86 testingTarget.Dispose();
87 tlog.Debug(tag, $"WatchBoolSignalEmpty END (OK)");
91 tlog.Debug(tag, $"WatchBoolSignalEmpty END (OK)");
92 Assert.Pass("Not Supported profile");
97 [Description("WatchBoolSignal GetConnectionCount")]
98 [Property("AUTHOR", "guowei.wang@samsung.com")]
99 public void WatchBoolSignalGetConnectionCount()
101 tlog.Debug(tag, $"WatchBoolSignalGetConnectionCount START");
105 var testingTarget = new WatchBoolSignal();
106 Assert.IsNotNull(testingTarget, "should be not null");
107 Assert.IsInstanceOf<WatchBoolSignal>(testingTarget, "should be an instance of testing target class!");
109 var result = testingTarget.GetConnectionCount();
110 Assert.IsTrue(result == 0, "result should be 0");
112 testingTarget.Dispose();
113 tlog.Debug(tag, $"WatchBoolSignalGetConnectionCount END (OK)");
117 tlog.Debug(tag, $"WatchBoolSignalGetConnectionCount END (OK)");
118 Assert.Pass("Not Supported profile");
123 [Description("WatchBoolSignal Connection")]
124 [Property("AUTHOR", "guowei.wang@samsung.com")]
125 public void WatchBoolSignalConnection()
127 tlog.Debug(tag, $"WatchBoolSignalConnection START");
131 var testingTarget = new WatchBoolSignal();
132 Assert.IsNotNull(testingTarget, "should be not null");
133 Assert.IsInstanceOf<WatchBoolSignal>(testingTarget, "should be an instance of testing target class!");
135 dummyCallback callback = OnDummyCallback;
136 testingTarget.Connect(callback);
137 testingTarget.Disconnect(callback);
138 testingTarget.Dispose();
139 tlog.Debug(tag, $"WatchBoolSignalConnection END (OK)");
143 tlog.Debug(tag, $"WatchBoolSignalConnection END (OK)");
144 Assert.Pass("Not Supported profile");
149 [Description("WatchBoolSignal Disconnection")]
150 [Property("AUTHOR", "guowei.wang@samsung.com")]
151 public void WatchBoolSignalDisconnection()
153 tlog.Debug(tag, $"WatchBoolSignalDisconnection START");
157 var testingTarget = new WatchBoolSignal();
158 Assert.IsNotNull(testingTarget, "should be not null");
159 Assert.IsInstanceOf<WatchBoolSignal>(testingTarget, "should be an instance of testing target class!");
161 dummyCallback callback = OnDummyCallback;
162 testingTarget.Connect(callback);
163 testingTarget.Disconnect(callback);
164 testingTarget.Dispose();
165 tlog.Debug(tag, $"WatchBoolSignalDisconnection END (OK)");
169 tlog.Debug(tag, $"WatchBoolSignalDisconnection END (OK)");
170 Assert.Pass("Not Supported profile");
175 [Description("WatchBoolSignal Emit")]
176 [Property("AUTHOR", "guowei.wang@samsung.com")]
177 public void WatchBoolSignalEmit()
179 tlog.Debug(tag, $"WatchBoolSignalEmit START");
183 var currentPid = global::System.Diagnostics.Process.GetCurrentProcess().Id;
184 var currentTid = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
186 tlog.Debug(tag, $"thread check! main pid={App.mainPid}, current pid={currentPid}, main tid={App.mainTid}, current tid={currentTid}");
188 var testingTarget = new WatchBoolSignal();
189 Assert.IsNotNull(testingTarget, "should be not null");
190 Assert.IsInstanceOf<WatchBoolSignal>(testingTarget, "should be an instance of testing target class!");
192 var dummy = new Application();
193 testingTarget.Emit(dummy, true);
196 testingTarget.Dispose();
197 tlog.Debug(tag, $"WatchBoolSignalEmit END (OK)");
201 tlog.Debug(tag, $"WatchBoolSignalEmit END (OK)");
202 Assert.Pass("Not Supported profile");