3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 using System.Collections.Generic;
8 namespace Tizen.NUI.Devel.Tests
10 using tlog = Tizen.Log;
13 [Description("internal/Window/WindowVisibilityChangedEvent")]
14 public class InternalWindowVisibilityChangedEventTest
16 private const string tag = "NUITEST";
18 private delegate bool dummyCallback(IntPtr signal);
19 private bool OnDummyCallback(IntPtr data)
27 tlog.Info(tag, "Init() is called!");
33 tlog.Info(tag, "Destroy() is called!");
38 [Description("WindowVisibilityChangedEvent constructor")]
39 [Property("SPEC", "Tizen.NUI.WindowVisibilityChangedEvent.WindowVisibilityChangedEvent C")]
40 [Property("SPEC_URL", "-")]
41 [Property("CRITERIA", "CONSTR")]
42 [Property("AUTHOR", "guowei.wang@samsung.com")]
43 public void WindowVisibilityChangedEventConstructor()
45 tlog.Debug(tag, $"WindowVisibilityChangedEventConstructor START");
47 var testingTarget = new WindowVisibilityChangedEvent(Window.Instance);
48 Assert.IsNotNull(testingTarget, "should be not null");
49 Assert.IsInstanceOf<WindowVisibilityChangedEvent>(testingTarget, "should be an instance of WindowVisibilityChangedEvent class!");
51 testingTarget.Dispose();
52 tlog.Debug(tag, $"WindowVisibilityChangedEventConstructor END (OK)");
57 [Description("WindowVisibilityChangedEvent Empty.")]
58 [Property("SPEC", "Tizen.NUI.WindowVisibilityChangedEvent.Empty M")]
59 [Property("SPEC_URL", "-")]
60 [Property("CRITERIA", "MR")]
61 [Property("AUTHOR", "guowei.wang@samsung.com")]
62 public void WindowVisibilityChangedEventEmpty()
64 tlog.Debug(tag, $"WindowVisibilityChangedEventEmpty START");
66 var testingTarget = new WindowVisibilityChangedEvent(Window.Instance);
67 Assert.IsNotNull(testingTarget, "Should be not null!");
68 Assert.IsInstanceOf<WindowVisibilityChangedEvent>(testingTarget, "Should be an Instance of WindowVisibilityChangedEvent!");
72 testingTarget.Empty();
76 tlog.Debug(tag, e.Message.ToString());
77 Assert.Fail("Caught Exception: Failed!");
80 testingTarget.Dispose();
81 tlog.Debug(tag, $"WindowVisibilityChangedEventEmpty END (OK)");
86 [Description("WindowVisibilityChangedEvent GetConnectionCount.")]
87 [Property("SPEC", "Tizen.NUI.WindowVisibilityChangedEvent.GetConnectionCount M")]
88 [Property("SPEC_URL", "-")]
89 [Property("CRITERIA", "MR")]
90 [Property("AUTHOR", "guowei.wang@samsung.com")]
91 public void WindowVisibilityChangedEventGetConnectionCount()
93 tlog.Debug(tag, $"WindowVisibilityChangedEventGetConnectionCount START");
95 var testingTarget = new WindowVisibilityChangedEvent(Window.Instance);
96 Assert.IsNotNull(testingTarget, "Should be not null!");
97 Assert.IsInstanceOf<WindowVisibilityChangedEvent>(testingTarget, "Should be an Instance of WindowVisibilityChangedEvent!");
101 testingTarget.GetConnectionCount();
105 tlog.Debug(tag, e.Message.ToString());
106 Assert.Fail("Caught Exception: Failed!");
109 testingTarget.Dispose();
111 tlog.Debug(tag, $"WindowVisibilityChangedEventGetConnectionCount END (OK)");
116 [Description("WindowVisibilityChangedEvent Connect.")]
117 [Property("SPEC", "Tizen.NUI.WindowVisibilityChangedEvent.Connect M")]
118 [Property("SPEC_URL", "-")]
119 [Property("CRITERIA", "MR")]
120 [Property("AUTHOR", "guowei.wang@samsung.com")]
121 public void WindowVisibilityChangedEventConnect()
123 tlog.Debug(tag, $"WindowVisibilityChangedEventConnect START");
125 var testingTarget = new WindowVisibilityChangedEvent(Window.Instance);
126 Assert.IsNotNull(testingTarget, "Should be not null!");
127 Assert.IsInstanceOf<WindowVisibilityChangedEvent>(testingTarget, "Should be an Instance of WindowVisibilityChangedEvent!");
131 dummyCallback callback = OnDummyCallback;
132 testingTarget.Connect(callback);
133 testingTarget.Disconnect(callback);
137 tlog.Debug(tag, e.Message.ToString());
138 Assert.Fail("Caught Exception: Failed!");
141 testingTarget.Dispose();
143 tlog.Debug(tag, $"WindowVisibilityChangedEventConnect END (OK)");
148 [Description("WindowVisibilityChangedEvent Emit.")]
149 [Property("SPEC", "Tizen.NUI.WindowVisibilityChangedEvent.Emit M")]
150 [Property("SPEC_URL", "-")]
151 [Property("CRITERIA", "MR")]
152 [Property("AUTHOR", "guowei.wang@samsung.com")]
153 public void WindowVisibilityChangedEventEmit()
155 tlog.Debug(tag, $"WindowVisibilityChangedEventEmit START");
156 var currentPid = global::System.Diagnostics.Process.GetCurrentProcess().Id;
157 var currentTid = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
159 tlog.Debug(tag, $"thread check! main pid={App.mainPid}, current pid={currentPid}, main tid={App.mainTid}, current tid={currentTid}");
161 using (Window window = new Window(new Rectangle(0, 0, 2, 2), false))
163 var testingTarget = new WindowVisibilityChangedEvent(Window.Instance);
164 Assert.IsNotNull(testingTarget, "Should be not null!");
165 Assert.IsInstanceOf<WindowVisibilityChangedEvent>(testingTarget, "Should be an Instance of WindowVisibilityChangedEvent!");
169 testingTarget.Emit(window, false);
173 tlog.Debug(tag, e.Message.ToString());
174 Assert.Fail("Caught Exception: Failed!");
177 testingTarget.Dispose();
180 tlog.Debug(tag, $"WindowVisibilityChangedEventEmit END (OK)");