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!");
35 [Description("ApplicationControlSignal constructor")]
36 [Property("AUTHOR", "guowei.wang@samsung.com")]
37 public void ApplicationControlSignalConstructor()
39 tlog.Debug(tag, $"ApplicationControlSignalConstructor START");
41 var testingTarget = new ApplicationControlSignal();
43 Assert.IsNotNull(testingTarget, "should be not null");
44 Assert.IsInstanceOf<ApplicationControlSignal>(testingTarget, "should be an instance of testing target class!");
46 testingTarget.Dispose();
47 tlog.Debug(tag, $"ApplicationControlSignalConstructor END (OK)");
51 [Description("ApplicationControlSignal Empty")]
52 [Property("AUTHOR", "guowei.wang@samsung.com")]
53 public void ApplicationControlSignalEmpty()
55 tlog.Debug(tag, $"ApplicationControlSignalEmpty START");
57 var testingTarget = new ApplicationControlSignal();
58 Assert.IsNotNull(testingTarget, "should be not null");
59 Assert.IsInstanceOf<ApplicationControlSignal>(testingTarget, "should be an instance of testing target class!");
61 var result = testingTarget.Empty();
62 Assert.IsTrue(result);
64 testingTarget.Dispose();
65 tlog.Debug(tag, $"ApplicationControlSignalEmpty END (OK)");
69 [Description("ApplicationControlSignal GetConnectionCount")]
70 [Property("AUTHOR", "guowei.wang@samsung.com")]
71 public void ApplicationControlSignalGetConnectionCount()
73 tlog.Debug(tag, $"ApplicationControlSignalGetConnectionCount START");
75 var testingTarget = new ApplicationControlSignal();
76 Assert.IsNotNull(testingTarget, "should be not null");
77 Assert.IsInstanceOf<ApplicationControlSignal>(testingTarget, "should be an instance of testing target class!");
79 var result = testingTarget.GetConnectionCount();
80 Assert.IsTrue(result == 0, "result should be 0");
82 testingTarget.Dispose();
83 tlog.Debug(tag, $"ApplicationControlSignalGetConnectionCount END (OK)");
87 [Description("ApplicationControlSignal Connection")]
88 [Property("AUTHOR", "guowei.wang@samsung.com")]
89 public void ApplicationControlSignalConnection()
91 tlog.Debug(tag, $"ApplicationControlSignalConnection START");
93 var testingTarget = new ApplicationControlSignal();
94 Assert.IsNotNull(testingTarget, "should be not null");
95 Assert.IsInstanceOf<ApplicationControlSignal>(testingTarget, "should be an instance of testing target class!");
97 dummyCallback callback = OnDummyCallback;
98 testingTarget.Connect(callback);
99 testingTarget.Disconnect(callback);
100 testingTarget.Dispose();
102 tlog.Debug(tag, $"ApplicationControlSignalConnection END (OK)");
106 [Description("ApplicationControlSignal Disconnection")]
107 [Property("AUTHOR", "guowei.wang@samsung.com")]
108 public void ApplicationControlSignalDisconnection()
110 tlog.Debug(tag, $"ApplicationControlSignalDisconnection START");
112 var testingTarget = new ApplicationControlSignal();
113 Assert.IsNotNull(testingTarget, "should be not null");
114 Assert.IsInstanceOf<ApplicationControlSignal>(testingTarget, "should be an instance of testing target class!");
116 dummyCallback callback = OnDummyCallback;
117 testingTarget.Connect(callback);
118 testingTarget.Disconnect(callback);
119 testingTarget.Dispose();
121 tlog.Debug(tag, $"ApplicationControlSignalDisconnection END (OK)");
125 [Description("ApplicationControlSignal Emit")]
126 [Property("AUTHOR", "guowei.wang@samsung.com")]
127 public void ApplicationControlSignalEmit()
129 tlog.Debug(tag, $"ApplicationControlSignalEmit START");
130 var currentPid = global::System.Diagnostics.Process.GetCurrentProcess().Id;
131 var currentTid = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
133 tlog.Debug(tag, $"thread check! main pid={App.mainPid}, current pid={currentPid}, main tid={App.mainTid}, current tid={currentTid}");
135 var testingTarget = new ApplicationControlSignal();
136 Assert.IsNotNull(testingTarget, "should be not null");
137 Assert.IsInstanceOf<ApplicationControlSignal>(testingTarget, "should be an instance of testing target class!");
139 testingTarget.Emit(Application.Current, new global::System.IntPtr(0));
141 testingTarget.Dispose();
142 tlog.Debug(tag, $"ApplicationControlSignalEmit END (OK)");