3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 namespace Tizen.NUI.Devel.Tests
8 using tlog = Tizen.Log;
11 [Description("internal/Application/WatchTimeSignal")]
12 public class InternalWatchTimeSignalTest
14 private const string tag = "NUITEST";
15 private delegate bool dummyCallback(IntPtr application);
16 private bool OnDummyCallback(IntPtr data)
21 private bool IsWearable()
24 var result = Tizen.System.Information.TryGetValue("tizen.org/feature/profile", out value);
25 if (result && value.Equals("wearable"))
36 tlog.Info(tag, "Init() is called!");
42 tlog.Info(tag, "Destroy() is called!");
46 [Description("WatchTimeSignal constructor")]
47 [Property("AUTHOR", "guowei.wang@samsung.com")]
48 public void WatchTimeSignalConstructor()
50 tlog.Debug(tag, $"WatchTimeSignalConstructor START");
54 var testingTarget = new WatchTimeSignal();
56 Assert.IsNotNull(testingTarget, "should be not null");
57 Assert.IsInstanceOf<WatchTimeSignal>(testingTarget, "should be an instance of testing target class!");
59 testingTarget.Dispose();
60 tlog.Debug(tag, $"WatchTimeSignalConstructor END (OK)");
64 tlog.Debug(tag, $"WatchTimeSignalConstructor END (OK)");
65 Assert.Pass("Not Supported profile");
70 [Description("WatchTimeSignal Empty")]
71 [Property("AUTHOR", "guowei.wang@samsung.com")]
72 public void WatchTimeSignalEmpty()
74 tlog.Debug(tag, $"WatchTimeSignalEmpty START");
78 var testingTarget = new WatchTimeSignal();
79 Assert.IsNotNull(testingTarget, "should be not null");
80 Assert.IsInstanceOf<WatchTimeSignal>(testingTarget, "should be an instance of testing target class!");
82 var result = testingTarget.Empty();
83 Assert.IsTrue(result);
85 testingTarget.Dispose();
86 tlog.Debug(tag, $"WatchTimeSignalEmpty END (OK)");
90 tlog.Debug(tag, $"WatchTimeSignalEmpty END (OK)");
91 Assert.Pass("Not Supported profile");
96 [Description("WatchTimeSignal GetConnectionCount")]
97 [Property("AUTHOR", "guowei.wang@samsung.com")]
98 public void WatchTimeSignalGetConnectionCount()
100 tlog.Debug(tag, $"WatchTimeSignalGetConnectionCount START");
104 var testingTarget = new WatchTimeSignal();
105 Assert.IsNotNull(testingTarget, "should be not null");
106 Assert.IsInstanceOf<WatchTimeSignal>(testingTarget, "should be an instance of testing target class!");
108 var result = testingTarget.GetConnectionCount();
109 Assert.IsTrue(result == 0, "result should be 0");
111 testingTarget.Dispose();
112 tlog.Debug(tag, $"WatchTimeSignalGetConnectionCount END (OK)");
116 tlog.Debug(tag, $"WatchTimeSignalGetConnectionCount END (OK)");
117 Assert.Pass("Not Supported profile");
122 [Description("WatchTimeSignal Connection")]
123 [Property("AUTHOR", "guowei.wang@samsung.com")]
124 public void WatchTimeSignalConnection()
126 tlog.Debug(tag, $"WatchTimeSignalConnection START");
130 var testingTarget = new WatchTimeSignal();
131 Assert.IsNotNull(testingTarget, "should be not null");
132 Assert.IsInstanceOf<WatchTimeSignal>(testingTarget, "should be an instance of testing target class!");
134 dummyCallback callback = OnDummyCallback;
135 testingTarget.Connect(callback);
136 testingTarget.Disconnect(callback);
137 testingTarget.Dispose();
138 tlog.Debug(tag, $"WatchTimeSignalConnection END (OK)");
142 tlog.Debug(tag, $"WatchTimeSignalConnection END (OK)");
143 Assert.Pass("Not Supported profile");
148 [Description("WatchTimeSignal Disconnection")]
149 [Property("AUTHOR", "guowei.wang@samsung.com")]
150 public void WatchTimeSignalDisconnection()
152 tlog.Debug(tag, $"WatchTimeSignalDisconnection START");
156 var testingTarget = new WatchTimeSignal();
157 Assert.IsNotNull(testingTarget, "should be not null");
158 Assert.IsInstanceOf<WatchTimeSignal>(testingTarget, "should be an instance of testing target class!");
160 dummyCallback callback = OnDummyCallback;
161 testingTarget.Connect(callback);
162 testingTarget.Disconnect(callback);
163 testingTarget.Dispose();
164 tlog.Debug(tag, $"WatchTimeSignalDisconnection END (OK)");
168 tlog.Debug(tag, $"WatchTimeSignalDisconnection END (OK)");
169 Assert.Pass("Not Supported profile");
174 [Description("WatchTimeSignal Emit")]
175 [Property("AUTHOR", "guowei.wang@samsung.com")]
176 public void WatchTimeSignalEmit()
178 tlog.Debug(tag, $"WatchTimeSignalEmit START");
182 var currentPid = global::System.Diagnostics.Process.GetCurrentProcess().Id;
183 var currentTid = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
185 tlog.Debug(tag, $"thread check! main pid={App.mainPid}, current pid={currentPid}, main tid={App.mainTid}, current tid={currentTid}");
187 var testingTarget = new WatchTimeSignal();
188 Assert.IsNotNull(testingTarget, "should be not null");
189 Assert.IsInstanceOf<WatchTimeSignal>(testingTarget, "should be an instance of testing target class!");
191 Application application = new Application();
192 WatchTime watchTime = new WatchTime();
193 testingTarget.Emit(application, watchTime);
195 application.Dispose();
197 testingTarget.Dispose();
198 tlog.Debug(tag, $"WatchTimeSignalEmit END (OK)");
202 tlog.Debug(tag, $"WatchTimeSignalEmit END (OK)");
203 Assert.Pass("Not Supported profile");