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/Common/ActivatedSignalType")]
13 public class InternalActivatedSignalTypeTest
15 private const string tag = "NUITEST";
16 private delegate bool dummyCallback(IntPtr signal);
17 private bool OnDummyCallback(IntPtr data)
25 tlog.Info(tag, "Init() is called!");
31 tlog.Info(tag, "Destroy() is called!");
36 [Description("ActivatedSignalType constructor.")]
37 [Property("SPEC", "Tizen.NUI.ActivatedSignalType.ActivatedSignalType C")]
38 [Property("SPEC_URL", "-")]
39 [Property("CRITERIA", "CONSTR")]
40 [Property("AUTHOR", "guowei.wang@samsung.com")]
41 public void ActivatedSignalTypeConstructor()
43 tlog.Debug(tag, $"ActivatedSignalTypeConstructor START");
45 using (View view = new View())
47 var testingTarget = new ActivatedSignalType(view.SwigCPtr.Handle, false);
48 Assert.IsNotNull(testingTarget, "Should be not null!");
49 Assert.IsInstanceOf<ActivatedSignalType>(testingTarget, "Should be an Instance of ActivatedSignalType!");
51 testingTarget.Dispose();
54 tlog.Debug(tag, $"ActivatedSignalTypeConstructor END (OK)");
59 [Description("ActivatedSignalType Empty.")]
60 [Property("SPEC", "Tizen.NUI.ActivatedSignalType.Empty M")]
61 [Property("SPEC_URL", "-")]
62 [Property("CRITERIA", "MR")]
63 [Property("AUTHOR", "guowei.wang@samsung.com")]
64 public void ActivatedSignalTypeEmpty()
66 tlog.Debug(tag, $"ActivatedSignalTypeEmpty START");
68 var testingTarget = new ActivatedSignalType();
69 Assert.IsNotNull(testingTarget, "Should be not null!");
70 Assert.IsInstanceOf<ActivatedSignalType>(testingTarget, "Should be an Instance of ActivatedSignalType!");
74 testingTarget.Empty();
78 tlog.Debug(tag, e.Message.ToString());
79 Assert.Fail("Caught Exception: Failed!");
82 testingTarget.Dispose();
84 tlog.Debug(tag, $"ActivatedSignalTypeEmpty END (OK)");
89 [Description("ActivatedSignalType GetConnectionCount.")]
90 [Property("SPEC", "Tizen.NUI.ActivatedSignalType.GetConnectionCount M")]
91 [Property("SPEC_URL", "-")]
92 [Property("CRITERIA", "MR")]
93 [Property("AUTHOR", "guowei.wang@samsung.com")]
94 public void ActivatedSignalTypeGetConnectionCount()
96 tlog.Debug(tag, $"ActivatedSignalTypeGetConnectionCount START");
98 var testingTarget = new ActivatedSignalType();
99 Assert.IsNotNull(testingTarget, "Should be not null!");
100 Assert.IsInstanceOf<ActivatedSignalType>(testingTarget, "Should be an Instance of ActivatedSignalType!");
104 testingTarget.GetConnectionCount();
108 tlog.Debug(tag, e.Message.ToString());
109 Assert.Fail("Caught Exception: Failed!");
112 testingTarget.Dispose();
114 tlog.Debug(tag, $"ActivatedSignalTypeGetConnectionCount END (OK)");
119 [Description("ActivatedSignalType Connect.")]
120 [Property("SPEC", "Tizen.NUI.ActivatedSignalType.Connect M")]
121 [Property("SPEC_URL", "-")]
122 [Property("CRITERIA", "MR")]
123 [Property("AUTHOR", "guowei.wang@samsung.com")]
124 public void ActivatedSignalTypeConnect()
126 tlog.Debug(tag, $"ActivatedSignalTypeConnect START");
128 var testingTarget = new ActivatedSignalType();
129 Assert.IsNotNull(testingTarget, "Should be not null!");
130 Assert.IsInstanceOf<ActivatedSignalType>(testingTarget, "Should be an Instance of ActivatedSignalType!");
134 dummyCallback callback = OnDummyCallback;
135 testingTarget.Connect(callback);
136 testingTarget.Disconnect(callback);
140 tlog.Debug(tag, e.Message.ToString());
141 Assert.Fail("Caught Exception: Failed!");
144 testingTarget.Dispose();
146 tlog.Debug(tag, $"ActivatedSignalTypeConnect END (OK)");
151 [Description("ActivatedSignalType Emit.")]
152 [Property("SPEC", "Tizen.NUI.ActivatedSignalType.Emit M")]
153 [Property("SPEC_URL", "-")]
154 [Property("CRITERIA", "MR")]
155 [Property("AUTHOR", "guowei.wang@samsung.com")]
157 public void ActivatedSignalTypeEmit()
159 tlog.Debug(tag, $"ActivatedSignalTypeEmit START");
160 var currentPid = global::System.Diagnostics.Process.GetCurrentProcess().Id;
161 var currentTid = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
163 tlog.Debug(tag, $"thread check! main pid={App.mainPid}, current pid={currentPid}, main tid={App.mainTid}, current tid={currentTid}");
165 using (InputMethodContext context = new InputMethodContext())
167 var testingTarget = new ActivatedSignalType();
168 Assert.IsNotNull(testingTarget, "Should be not null!");
169 Assert.IsInstanceOf<ActivatedSignalType>(testingTarget, "Should be an Instance of ActivatedSignalType!");
173 testingTarget.Emit(context);
177 tlog.Debug(tag, e.Message.ToString());
178 Assert.Fail("Caught Exception: Failed!");
181 testingTarget.Dispose();
184 tlog.Debug(tag, $"ActivatedSignalTypeEmit END (OK)");