From: guowei.wang Date: Wed, 28 Apr 2021 08:24:27 +0000 (+0800) Subject: [NUI] Add Application(Internal & Public) TCs. X-Git-Tag: accepted/tizen/unified/20231205.024657~1888 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3714b5408b5bc1a8a47068e591934091bd726926;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Add Application(Internal & Public) TCs. --- diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSApplication.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSApplication.cs new file mode 100755 index 0000000..5cf5cae --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSApplication.cs @@ -0,0 +1,452 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("internal/Application/Application")] + public class InternalApplicationTest + { + private const string tag = "NUITEST"; + private delegate bool dummyCallback(IntPtr application); + private bool OnDummyCallback(IntPtr data) + { + return false; + } + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Description("NUIApplicationInitEventArgs Get")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationInitEventArgsGet() + { + tlog.Debug(tag, $"NUIApplicationInitEventArgsGet START"); + + var testingTarget = new NUIApplicationInitEventArgs(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var result = testingTarget.Application; + Assert.IsNull(result); + + tlog.Debug(tag, $"NUIApplicationInitEventArgsGet END (OK)"); + } + + [Test] + [Description("NUIApplicationInitEventArgs Set")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationInitEventArgsSet() + { + tlog.Debug(tag, $"NUIApplicationInitEventArgsSet START"); + + var testingTarget = new NUIApplicationInitEventArgs(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var g_result = testingTarget.Application; + Assert.IsNull(g_result); + + testingTarget.Application = Application.Current; + var s_result = testingTarget.Application; + Assert.IsNotNull(s_result); + + tlog.Debug(tag, $"NUIApplicationInitEventArgsSet END (OK)"); + } + + [Test] + [Description("NUIApplicationTerminatingEventArgs Get")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationTerminatingEventArgsGet() + { + tlog.Debug(tag, $"NUIApplicationTerminatingEventArgsGet START"); + + var testingTarget = new NUIApplicationTerminatingEventArgs(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var result = testingTarget.Application; + Assert.IsNull(result); + + tlog.Debug(tag, $"NUIApplicationTerminatingEventArgsGet END (OK)"); + } + + [Test] + [Description("NUIApplicationTerminatingEventArgs Set")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationTerminatingEventArgsSet() + { + tlog.Debug(tag, $"NUIApplicationTerminatingEventArgsSet START"); + + var testingTarget = new NUIApplicationTerminatingEventArgs(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var g_result = testingTarget.Application; + Assert.IsNull(g_result); + + testingTarget.Application = Application.Current; + var s_result = testingTarget.Application; + Assert.IsNotNull(s_result); + + tlog.Debug(tag, $"NUIApplicationTerminatingEventArgsSet END (OK)"); + } + + [Test] + [Description("NUIApplicationPausedEventArgs Get")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationPausedEventArgsGet() + { + tlog.Debug(tag, $"NUIApplicationPausedEventArgsGet START"); + + var testingTarget = new NUIApplicationPausedEventArgs(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var result = testingTarget.Application; + Assert.IsNull(result); + + tlog.Debug(tag, $"NUIApplicationPausedEventArgsGet END (OK)"); + } + + [Test] + [Description("NUIApplicationPausedEventArgs Set")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationPausedEventArgsSet() + { + tlog.Debug(tag, $"NUIApplicationPausedEventArgsSet START"); + + var testingTarget = new NUIApplicationPausedEventArgs(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var g_result = testingTarget.Application; + Assert.IsNull(g_result); + + testingTarget.Application = Application.Current; + var s_result = testingTarget.Application; + Assert.IsNotNull(s_result); + + tlog.Debug(tag, $"NUIApplicationPausedEventArgsSet END (OK)"); + } + + [Test] + [Description("NUIApplicationResumedEventArgs Get")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationResumedEventArgsGet() + { + tlog.Debug(tag, $"NUIApplicationResumedEventArgsGet START"); + + var testingTarget = new NUIApplicationResumedEventArgs(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var result = testingTarget.Application; + Assert.IsNull(result); + + tlog.Debug(tag, $"NUIApplicationResumedEventArgsGet END (OK)"); + } + + [Test] + [Description("NUIApplicationResumedEventArgs Set")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationResumedEventArgsSet() + { + tlog.Debug(tag, $"NUIApplicationResumedEventArgsSet START"); + + var testingTarget = new NUIApplicationResumedEventArgs(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var g_result = testingTarget.Application; + Assert.IsNull(g_result); + + testingTarget.Application = Application.Current; + var s_result = testingTarget.Application; + Assert.IsNotNull(s_result); + + tlog.Debug(tag, $"NUIApplicationResumedEventArgsSet END (OK)"); + } + + [Test] + [Description("NUIApplicationResetEventArgs Get")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationResetEventArgsGet() + { + tlog.Debug(tag, $"NUIApplicationResetEventArgsGet START"); + + var testingTarget = new NUIApplicationResetEventArgs(); + Assert.IsNotNull(testingTarget); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var result = testingTarget.Application; + Assert.IsNull(result); + + tlog.Debug(tag, $"NUIApplicationResetEventArgsGet END (OK)"); + } + + [Test] + [Description("NUIApplicationResetEventArgs Set")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationResetEventArgsSet() + { + tlog.Debug(tag, $"NUIApplicationResetEventArgsSet START"); + + var testingTarget = new NUIApplicationResetEventArgs(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var g_result = testingTarget.Application; + Assert.IsNull(g_result); + + testingTarget.Application = Application.Current; + var s_result = testingTarget.Application; + Assert.IsNotNull(s_result); + + tlog.Debug(tag, $"NUIApplicationResetEventArgsSet END (OK)"); + } + + [Test] + [Description("NUIApplicationLanguageChangedEventArgs Get")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationLanguageChangedEventArgsGet() + { + tlog.Debug(tag, $"NUIApplicationLanguageChangedEventArgsGet START"); + + var testingTarget = new NUIApplicationLanguageChangedEventArgs(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var result = testingTarget.Application; + Assert.IsNull(result); + + tlog.Debug(tag, $"NUIApplicationLanguageChangedEventArgsGet END (OK)"); + } + + [Test] + [Description("NUIApplicationLanguageChangedEventArgs Set")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationLanguageChangedEventArgsSet() + { + tlog.Debug(tag, $"NUIApplicationLanguageChangedEventArgsSet START"); + + var testingTarget = new NUIApplicationLanguageChangedEventArgs(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var g_result = testingTarget.Application; + Assert.IsNull(g_result); + + testingTarget.Application = Application.Current; + var s_result = testingTarget.Application; + Assert.IsNotNull(s_result); + + tlog.Debug(tag, $"NUIApplicationLanguageChangedEventArgsSet END (OK)"); + } + + [Test] + [Description("NUIApplicationRegionChangedEventArgs Get")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationRegionChangedEventArgsGet() + { + tlog.Debug(tag, $"NUIApplicationRegionChangedEventArgsGet START"); + + var testingTarget = new NUIApplicationRegionChangedEventArgs(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var result = testingTarget.Application; + Assert.IsNull(result); + + tlog.Debug(tag, $"NUIApplicationRegionChangedEventArgsGet END (OK)"); + } + + [Test] + [Description("NUIApplicationRegionChangedEventArgs Set")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationRegionChangedEventArgsSet() + { + tlog.Debug(tag, $"NUIApplicationRegionChangedEventArgsSet START"); + + var testingTarget = new NUIApplicationRegionChangedEventArgs(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var g_result = testingTarget.Application; + Assert.IsNull(g_result); + + testingTarget.Application = Application.Current; + var s_result = testingTarget.Application; + Assert.IsNotNull(s_result); + + tlog.Debug(tag, $"NUIApplicationRegionChangedEventArgsSet END (OK)"); + } + + [Test] + [Description("NUIApplicationBatteryLowEventArgs BatteryStatus Get")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationBatteryLowEventArgsBatteryStatusGet() + { + tlog.Debug(tag, $"NUIApplicationBatteryLowEventArgsBatteryStatusGet START"); + + var testingTarget = new NUIApplicationBatteryLowEventArgs(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var result = testingTarget.BatteryStatus; + Assert.IsNotNull(result, "should be not null"); + + tlog.Debug(tag, $"NUIApplicationBatteryLowEventArgsBatteryStatusGet END (OK)"); + } + + [Test] + [Description("NUIApplicationBatteryLowEventArgs BatteryStatus Set")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationBatteryLowEventArgsBatteryStatusSet() + { + tlog.Debug(tag, $"NUIApplicationBatteryLowEventArgsBatteryStatusSet START"); + + var testingTarget = new NUIApplicationBatteryLowEventArgs(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var status = Application.BatteryStatus.Normal; + testingTarget.BatteryStatus = status; + + var result = testingTarget.BatteryStatus; + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.AreEqual(status, result, "Retrieved result should be equal to status."); + + tlog.Debug(tag, $"NUIApplicationBatteryLowEventArgsBatteryStatusSet END (OK)"); + } + + [Test] + [Description("NUIApplicationMemoryLowEventArgs MemoryStatus Get")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationMemoryLowEventArgsMemoryStatusGet() + { + tlog.Debug(tag, $"NUIApplicationMemoryLowEventArgsMemoryStatusGet START"); + + var testingTarget = new NUIApplicationMemoryLowEventArgs(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var result = testingTarget.MemoryStatus; + Assert.IsNotNull(result, "should be not null"); + + tlog.Debug(tag, $"NUIApplicationMemoryLowEventArgsMemoryStatusGet END (OK)"); + } + + [Test] + [Description("NUIApplicationMemoryLowEventArgs MemoryStatus Set")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationMemoryLowEventArgsMemoryStatusSet() + { + tlog.Debug(tag, $"NUIApplicationMemoryLowEventArgsMemoryStatusSet START"); + + var testingTarget = new NUIApplicationMemoryLowEventArgs(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var status = Application.MemoryStatus.Normal; + testingTarget.MemoryStatus = status; + + var result = testingTarget.MemoryStatus; + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.AreEqual(status, result, "Retrieved result should be equal to status."); + + tlog.Debug(tag, $"NUIApplicationMemoryLowEventArgsMemoryStatusSet END (OK)"); + } + + [Test] + [Description("NUIApplicationAppControlEventArgs Application Get")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationAppControlEventArgsApplicationGet() + { + tlog.Debug(tag, $"NUIApplicationAppControlEventArgsApplicationGet START"); + + var testingTarget = new NUIApplicationAppControlEventArgs(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var result = testingTarget.Application; + Assert.IsNull(result, "should be null"); + + tlog.Debug(tag, $"NUIApplicationAppControlEventArgsApplicationGet END (OK)"); + } + + [Test] + [Description("NUIApplicationAppControlEventArgs Application Set")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationAppControlEventArgsApplicationSet() + { + tlog.Debug(tag, $"NUIApplicationAppControlEventArgsApplicationSet START"); + + var testingTarget = new NUIApplicationAppControlEventArgs(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var g_result = testingTarget.Application; + Assert.IsNull(g_result); + + testingTarget.Application = Application.Current; + var s_result = testingTarget.Application; + Assert.IsNotNull(s_result); + + tlog.Debug(tag, $"NUIApplicationAppControlEventArgsApplicationSet END (OK)"); + } + + [Test] + [Description("NUIApplicationAppControlEventArgs VoidP Get")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationAppControlEventArgsVoidPGet() + { + tlog.Debug(tag, $"NUIApplicationAppControlEventArgsVoidPGet START"); + + var testingTarget = new NUIApplicationAppControlEventArgs(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var result = testingTarget.VoidP; + Assert.IsNotNull(result, "should be not null"); + + tlog.Debug(tag, $"NUIApplicationAppControlEventArgsVoidPGet END (OK)"); + } + + [Test] + [Description("NUIApplicationAppControlEventArgs VoidP Set")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationAppControlEventArgsVoidPSet() + { + tlog.Debug(tag, $"NUIApplicationAppControlEventArgsVoidPSet START"); + + var dummy = new global::System.IntPtr(0); + var testingTarget = new NUIApplicationAppControlEventArgs(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.VoidP = dummy; + + var result = testingTarget.VoidP; + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.AreEqual(dummy, result, "Retrieved result should be equal to dummy."); + + tlog.Debug(tag, $"NUIApplicationAppControlEventArgsVoidPSet END (OK)"); + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSApplicationControlSignal.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSApplicationControlSignal.cs new file mode 100755 index 0000000..68c88dd --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSApplicationControlSignal.cs @@ -0,0 +1,145 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("internal/Application/ApplicationControlSignal")] + public class InternalApplicationControlSignalTest + { + private const string tag = "NUITEST"; + private delegate bool dummyCallback(IntPtr application); + private bool OnDummyCallback(IntPtr data) + { + return false; + } + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Description("ApplicationControlSignal constructor")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ApplicationControlSignalConstructor() + { + tlog.Debug(tag, $"ApplicationControlSignalConstructor START"); + + var testingTarget = new ApplicationControlSignal(); + + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"ApplicationControlSignalConstructor END (OK)"); + } + + [Test] + [Description("ApplicationControlSignal Empty")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ApplicationControlSignalEmpty() + { + tlog.Debug(tag, $"ApplicationControlSignalEmpty START"); + + var testingTarget = new ApplicationControlSignal(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var result = testingTarget.Empty(); + Assert.IsTrue(result); + + testingTarget.Dispose(); + tlog.Debug(tag, $"ApplicationControlSignalEmpty END (OK)"); + } + + [Test] + [Description("ApplicationControlSignal GetConnectionCount")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ApplicationControlSignalGetConnectionCount() + { + tlog.Debug(tag, $"ApplicationControlSignalGetConnectionCount START"); + + var testingTarget = new ApplicationControlSignal(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var result = testingTarget.GetConnectionCount(); + Assert.IsTrue(result == 0, "result should be 0"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"ApplicationControlSignalGetConnectionCount END (OK)"); + } + + [Test] + [Description("ApplicationControlSignal Connection")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ApplicationControlSignalConnection() + { + tlog.Debug(tag, $"ApplicationControlSignalConnection START"); + + var testingTarget = new ApplicationControlSignal(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + dummyCallback callback = OnDummyCallback; + testingTarget.Connect(callback); + testingTarget.Disconnect(callback); + testingTarget.Dispose(); + + tlog.Debug(tag, $"ApplicationControlSignalConnection END (OK)"); + } + + [Test] + [Description("ApplicationControlSignal Disconnection")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ApplicationControlSignalDisconnection() + { + tlog.Debug(tag, $"ApplicationControlSignalDisconnection START"); + + var testingTarget = new ApplicationControlSignal(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + dummyCallback callback = OnDummyCallback; + testingTarget.Connect(callback); + testingTarget.Disconnect(callback); + testingTarget.Dispose(); + + tlog.Debug(tag, $"ApplicationControlSignalDisconnection END (OK)"); + } + + [Test] + [Description("ApplicationControlSignal Emit")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ApplicationControlSignalEmit() + { + tlog.Debug(tag, $"ApplicationControlSignalEmit START"); + var currentPid = global::System.Diagnostics.Process.GetCurrentProcess().Id; + var currentTid = global::System.Threading.Thread.CurrentThread.ManagedThreadId; + + tlog.Debug(tag, $"thread check! main pid={App.mainPid}, current pid={currentPid}, main tid={App.mainTid}, current tid={currentTid}"); + + var testingTarget = new ApplicationControlSignal(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Emit(Application.Current, new global::System.IntPtr(0)); + + testingTarget.Dispose(); + tlog.Debug(tag, $"ApplicationControlSignalEmit END (OK)"); + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSApplicationSignal.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSApplicationSignal.cs new file mode 100755 index 0000000..f5e08db --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSApplicationSignal.cs @@ -0,0 +1,145 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("internal/Application/ApplicationSignal")] + public class InternalApplicationSignalTest + { + private const string tag = "NUITEST"; + private delegate bool dummyCallback(IntPtr application); + private bool OnDummyCallback(IntPtr data) + { + return false; + } + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Description("ApplicationSignal constructor")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ApplicationSignalConstructor() + { + tlog.Debug(tag, $"ApplicationSignalConstructor START"); + + var testingTarget = new ApplicationSignal(); + + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"ApplicationSignalConstructor END (OK)"); + } + + [Test] + [Description("ApplicationSignal Empty")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ApplicationSignalEmpty() + { + tlog.Debug(tag, $"ApplicationSignalEmpty START"); + + var testingTarget = new ApplicationSignal(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var result = testingTarget.Empty(); + Assert.IsTrue(result); + + testingTarget.Dispose(); + tlog.Debug(tag, $"ApplicationSignalEmpty END (OK)"); + } + + [Test] + [Description("ApplicationSignal GetConnectionCount")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ApplicationSignalGetConnectionCount() + { + tlog.Debug(tag, $"ApplicationSignalGetConnectionCount START"); + + var testingTarget = new ApplicationSignal(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var result = testingTarget.GetConnectionCount(); + Assert.IsTrue(result == 0, "result should be 0"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"ApplicationSignalGetConnectionCount END (OK)"); + } + + [Test] + [Description("ApplicationSignal Connection")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ApplicationSignalConnection() + { + tlog.Debug(tag, $"ApplicationSignalConnection START"); + + var testingTarget = new ApplicationSignal(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + dummyCallback callback = OnDummyCallback; + testingTarget.Connect(callback); + testingTarget.Disconnect(callback); + testingTarget.Dispose(); + + tlog.Debug(tag, $"ApplicationSignalConnection END (OK)"); + } + + [Test] + [Description("ApplicationSignal Disconnection")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ApplicationSignalDisconnection() + { + tlog.Debug(tag, $"ApplicationSignalDisconnection START"); + + var testingTarget = new ApplicationSignal(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + dummyCallback callback = OnDummyCallback; + testingTarget.Connect(callback); + testingTarget.Disconnect(callback); + testingTarget.Dispose(); + + tlog.Debug(tag, $"ApplicationSignalDisconnection END (OK)"); + } + + [Test] + [Description("ApplicationSignal Emit")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ApplicationSignalEmit() + { + tlog.Debug(tag, $"ApplicationSignalEmit START"); + var currentPid = global::System.Diagnostics.Process.GetCurrentProcess().Id; + var currentTid = global::System.Threading.Thread.CurrentThread.ManagedThreadId; + + tlog.Debug(tag, $"thread check! main pid={App.mainPid}, current pid={currentPid}, main tid={App.mainTid}, current tid={currentTid}"); + + var testingTarget = Tizen.NUI.Application.Instance.PauseSignal(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Emit(Tizen.NUI.Application.Current); + + testingTarget.Dispose(); + tlog.Debug(tag, $"ApplicationSignalEmit END (OK)"); + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSComponentApplication.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSComponentApplication.cs new file mode 100755 index 0000000..616de03 --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSComponentApplication.cs @@ -0,0 +1,111 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("internal/Application/ComponentApplication")] + public class InternalComponentApplicationTest + { + private const string tag = "NUITEST"; + private string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource; + private delegate bool dummyCallback(IntPtr application); + private bool OnDummyCallback(IntPtr data) + { + return false; + } + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Description("ComponentApplication NewComponentApplication")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ComponentApplicationNewComponentApplication() + { + tlog.Debug(tag, $"ComponentApplicationNewComponentApplication START"); + + var args = new string[] { "Dali-demo" }; + var stylesheet = resource + "/style/Test_Style_Manager.json"; + var testingTarget = ComponentApplication.NewComponentApplication(args, stylesheet); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"ComponentApplicationNewComponentApplication END (OK)"); + } + + [Test] + [Description("ComponentApplication New")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ComponentApplicationNew() + { + tlog.Debug(tag, $"ComponentApplicationNew START"); + + var args = new string[] { "Dali-demo" }; + var stylesheet = resource + "/style/Test_Style_Manager.json"; + var testingTarget = ComponentApplication.New(args, stylesheet); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"ComponentApplicationNew END (OK)"); + } + + [Test] + [Description("ComponentApplication connection")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ComponentApplicationConnection() + { + tlog.Debug(tag, $"ComponentApplicationConnection START"); + + var args = new string[] { "Dali-demo" }; + var stylesheet = resource + "/style/Test_Style_Manager.json"; + var testingTarget = ComponentApplication.NewComponentApplication(args, stylesheet); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + dummyCallback callback = OnDummyCallback; + testingTarget.Connect(callback); + testingTarget.Disconnect(callback); + testingTarget.Dispose(); + + tlog.Debug(tag, $"ComponentApplicationConnection END (OK)"); + } + + [Test] + [Description("ComponentApplication disconnection")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ComponentApplicationDisconnection() + { + tlog.Debug(tag, $"ComponentApplicationDisconnection START"); + + var args = new string[] { "Dali-demo" }; + var stylesheet = resource + "/style/Test_Style_Manager.json"; + var testingTarget = ComponentApplication.NewComponentApplication(args, stylesheet); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + dummyCallback callback = OnDummyCallback; + testingTarget.Connect(callback); + testingTarget.Disconnect(callback); + testingTarget.Dispose(); + + tlog.Debug(tag, $"ComponentApplicationDisconnection END (OK)"); + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSNUIComponentCoreBackend.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSNUIComponentCoreBackend.cs new file mode 100755 index 0000000..0aa5047 --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSNUIComponentCoreBackend.cs @@ -0,0 +1,110 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("internal/Application/NUIComponentCoreBackend")] + public class InternalNUIComponentCoreBackendTest + { + private const string tag = "NUITEST"; + private string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource; + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Description("NUIComponentCoreBackend constructor")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIComponentCoreBackendConstructor() + { + tlog.Debug(tag, $"NUIComponentCoreBackendConstructor START"); + + var testingTarget = new NUIComponentCoreBackend(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUIComponentCoreBackendConstructor END (OK)"); + } + + [Test] + [Description("NUIComponentCoreBackend constructor with stylesheet")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIComponentCoreBackendConstructorWithStylesheet() + { + tlog.Debug(tag, $"NUIComponentCoreBackendConstructorWithStylesheet START"); + + var dummy = resource + "/style/Test_Style_Manager.json"; + var testingTarget = new NUIComponentCoreBackend(dummy); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUIComponentCoreBackendConstructorWithStylesheet END (OK)"); + } + + [Test] + [Description("NUIComponentCoreBackend dispose")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIComponentCoreBackendDispose() + { + tlog.Debug(tag, $"NUIComponentCoreBackendDispose START"); + + var testingTarget = new NUIComponentCoreBackend(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + try + { + testingTarget.Dispose(); + } + catch (Exception e) + { + tlog.Error(tag, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + + tlog.Debug(tag, $"NUIComponentCoreBackendDispose END (OK)"); + } + + [Test] + [Description("NUIComponentCoreBackend exit")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIComponentCoreBackendExit() + { + tlog.Debug(tag, $"NUIComponentCoreBackendExit START"); + + var testingTarget = new NUIComponentCoreBackend(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + try + { + testingTarget.Exit(); + } + catch (Exception e) + { + tlog.Error(tag, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUIComponentCoreBackendExit END (OK)"); + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSNUICoreBackend.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSNUICoreBackend.cs new file mode 100755 index 0000000..5389b65 --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSNUICoreBackend.cs @@ -0,0 +1,162 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("internal/Application/NUICoreBackend")] + public class InternalNUICoreBackendTest + { + private const string tag = "NUITEST"; + private event EventHandler Created; + protected virtual void OnCreate() + { + Created?.Invoke(this, EventArgs.Empty); + } + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Description("NUICoreBackend constructor")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUICoreBackendConstructor() + { + tlog.Debug(tag, $"NUICoreBackendConstructor START"); + + var testingTarget = new NUICoreBackend(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUICoreBackendConstructor END (OK)"); + } + + [Test] + [Description("NUICoreBackend constructor with stylesheet")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUICoreBackendConstructorWithStylesheet() + { + tlog.Debug(tag, $"NUICoreBackendConstructorWithStylesheet START"); + + var dummy = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/style/Test_Style_Manager.json"; + var testingTarget = new NUICoreBackend(dummy); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUICoreBackendConstructorWithStylesheet END (OK)"); + } + + [Test] + [Description("NUICoreBackend constructor with stylesheet and windowMode")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUICoreBackendConstructorWithStylesheetAndWindowmode() + { + tlog.Debug(tag, $"NUICoreBackendConstructorWithStylesheetAndWindowmode START"); + + var dummy = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/style/Test_Style_Manager.json"; + var testingTarget = new NUICoreBackend(dummy, NUIApplication.WindowMode.Opaque); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUICoreBackendConstructorWithStylesheetAndWindowmode END (OK)"); + } + + [Test] + [Description("NUICoreBackend constructor with stylesheet, window mode, window size and window position")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUICoreBackendConstructorWithMoreArgs() + { + tlog.Debug(tag, $"NUICoreBackendConstructorWithMoreArgs START"); + + var dummy = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/style/Test_Style_Manager.json"; + var testingTarget = new NUICoreBackend(dummy, NUIApplication.WindowMode.Opaque, new Size(400, 400), new Position(200, 300)); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUICoreBackendConstructorWithMoreArgs END (OK)"); + } + + [Test] + [Description("NUICoreBackend AddEventHandler")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUICoreBackendAddEventHandler() + { + tlog.Debug(tag, $"NUICoreBackendAddEventHandler START"); + + var testingTarget = new NUICoreBackend(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.AddEventHandler(Tizen.Applications.CoreBackend.EventType.Created, OnCreate); + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUICoreBackendAddEventHandler END (OK)"); + } + + [Test] + [Description("NUICoreBackend dispose")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUICoreBackendDispose() + { + tlog.Debug(tag, $"NUICoreBackendDispose START"); + + var testingTarget = new NUICoreBackend(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + try + { + testingTarget.Dispose(); + } + catch (Exception e) + { + tlog.Error(tag, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + + tlog.Debug(tag, $"NUICoreBackendDispose END (OK)"); + } + + [Test] + [Description("NUICoreBackend exit")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUICoreBackendExit() + { + tlog.Debug(tag, $"NUICoreBackendExit START"); + + var testingTarget = new NUICoreBackend(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + try + { + testingTarget.Exit(); + } + catch (Exception e) + { + tlog.Error(tag, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUICoreBackendExit END (OK)"); + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSNUIWidgetCoreBackend.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSNUIWidgetCoreBackend.cs new file mode 100755 index 0000000..26c7603 --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSNUIWidgetCoreBackend.cs @@ -0,0 +1,147 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; +using System.Collections.Generic; + +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("internal/Application/NUIWidgetCoreBackend")] + public class InternalNUIWidgetCoreBackendTest + { + private const string tag = "NUITEST"; + private string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource; + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Description("NUIWidgetCoreBackend constructor")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIWidgetCoreBackendConstructor() + { + tlog.Debug(tag, $"NUIWidgetCoreBackendConstructor START"); + + var testingTarget = new NUIWidgetCoreBackend(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUIWidgetCoreBackendConstructor END (OK)"); + } + + [Test] + [Description("NUIWidgetCoreBackend constructor with stylesheet")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIWidgetCoreBackendConstructorWithStylesheet() + { + tlog.Debug(tag, $"NUIWidgetCoreBackendConstructorWithStylesheet START"); + + var dummy = resource + "/style/Test_Style_Manager.json"; + var testingTarget = new NUIWidgetCoreBackend(dummy); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUIWidgetCoreBackendConstructorWithStylesheet END (OK)"); + } + + [Test] + [Description("NUIWidgetCoreBackend dispose")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIWidgetCoreBackendDispose() + { + tlog.Debug(tag, $"NUIWidgetCoreBackendDispose START"); + + var testingTarget = new NUIWidgetCoreBackend(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + try + { + testingTarget.Dispose(); + } + catch (Exception e) + { + tlog.Error(tag, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + + tlog.Debug(tag, $"NUIWidgetCoreBackendDispose END (OK)"); + } + + [Test] + [Description("NUIWidgetCoreBackend exit")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIWidgetCoreBackendExit() + { + tlog.Debug(tag, $"NUIWidgetCoreBackendExit START"); + + var testingTarget = new NUIWidgetCoreBackend(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + try + { + testingTarget.Exit(); + } + catch (Exception e) + { + tlog.Error(tag, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUIWidgetCoreBackendExit END (OK)"); + } + + [Test] + [Description("NUIWidgetCoreBackend register widget info")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIWidgetCoreBackendRegisterWidgetInfo() + { + tlog.Debug(tag, $"NUIWidgetCoreBackendRegisterWidgetInfo START"); + + var testingTarget = new NUIWidgetCoreBackend(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var widgetInfo = new Dictionary(); + testingTarget.RegisterWidgetInfo(widgetInfo); + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUIWidgetCoreBackendRegisterWidgetInfo END (OK)"); + } + + [Test] + [Description("NUIWidgetCoreBackend add widget info")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIWidgetCoreBackendAddWidgetInfo() + { + tlog.Debug(tag, $"NUIWidgetCoreBackendAddWidgetInfo START"); + + var testingTarget = new NUIWidgetCoreBackend(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var widgetInfo = new Dictionary(); + testingTarget.AddWidgetInfo(widgetInfo); + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUIWidgetCoreBackendAddWidgetInfo END (OK)"); + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSWatchApplication.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSWatchApplication.cs new file mode 100755 index 0000000..58c45dc --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSWatchApplication.cs @@ -0,0 +1,429 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI.Devel.Tests +{ + using static Tizen.NUI.WatchApplication; + using tlog = Tizen.Log; + + [TestFixture] + [Description("internal/Application/WatchApplication")] + public class InternalWatchApplicationTest + { + private const string tag = "NUITEST"; + private string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource; + + private bool IsWearable() + { + string value; + var result = Tizen.System.Information.TryGetValue("tizen.org/feature/profile", out value); + if (result && value.Equals("wearable")) + { + return true; + } + + return false; + } + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Description("WatchApplication new")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchApplicationNew() + { + tlog.Debug(tag, $"WatchApplicationNew START"); + + if (IsWearable()) + { + var testingTarget = Tizen.NUI.WatchApplication.New(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchApplicationNew END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchApplicationNew END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchApplication new with strings")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchApplicationNewWithStrings() + { + tlog.Debug(tag, $"WatchApplicationNewWithStrings START"); + + if (IsWearable()) + { + var dummy = new string[3]; + var testingTarget = Tizen.NUI.WatchApplication.New(dummy); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchApplicationNewWithStrings END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchApplicationNewWithStrings END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchApplication new with strings and stylesheet")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchApplicationNewWithStringsAndStylesheet() + { + tlog.Debug(tag, $"WatchApplicationNewWithStringsAndStylesheet START"); + + if (IsWearable()) + { + var args = new string[] { "Dali-demo" }; + var stylesheet = resource + "/style/Test_Style_Manager.json"; + var testingTarget = Tizen.NUI.WatchApplication.New(args, stylesheet); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchApplicationNewWithStringsAndStylesheet END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchApplicationNewWithStringsAndStylesheet END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchApplication TimeTickEventArgs:Application get")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchApplicationTimeTickEventArgsApplicationGet() + { + tlog.Debug(tag, $"WatchApplicationTimeTickEventArgsApplicationGet START"); + + if (IsWearable()) + { + TimeTickEventArgs dummy = new TimeTickEventArgs(); + var testingTarget = dummy.Application; + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchApplicationTimeTickEventArgsApplicationGet END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchApplicationTimeTickEventArgsApplicationGet END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchApplication TimeTickEventArgs:Application set")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchApplicationTimeTickEventArgsApplicationSet() + { + tlog.Debug(tag, $"WatchApplicationTimeTickEventArgsApplicationSet START"); + + if (IsWearable()) + { + var dummyApplication = new Application(); + Assert.IsNotNull(dummyApplication, "should be not null"); + Assert.IsInstanceOf(dummyApplication, "should be an instance of testing target class!"); + + TimeTickEventArgs testingTarget = new TimeTickEventArgs(); + testingTarget.Application = dummyApplication; + + var result = testingTarget.Application; + Assert.IsNotNull(result, "should be not null."); + Assert.AreEqual(dummyApplication, result, "Retrieved result should be equal to dummyApplication. "); + + tlog.Debug(tag, $"WatchApplicationTimeTickEventArgsApplicationSet END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchApplicationTimeTickEventArgsApplicationSet END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchApplication TimeTickEventArgs:WatchTime get")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchApplicationTimeTickEventArgsWatchTimeGet() + { + tlog.Debug(tag, $"WatchApplicationTimeTickEventArgsWatchTimeGet START"); + + if (IsWearable()) + { + TimeTickEventArgs dummy = new TimeTickEventArgs(); + var testingTarget = dummy.WatchTime; + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchApplicationTimeTickEventArgsWatchTimeGet END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchApplicationTimeTickEventArgsWatchTimeGet END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchApplication TimeTickEventArgs:WatchTime set")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchApplicationTimeTickEventArgsWatchTimeSet() + { + tlog.Debug(tag, $"WatchApplicationTimeTickEventArgsWatchTimeSet START"); + + if (IsWearable()) + { + var dummyWatchTime = new WatchTime(); + Assert.IsNotNull(dummyWatchTime, "should be not null"); + Assert.IsInstanceOf(dummyWatchTime, "should be an instance of testing target class!"); + + TimeTickEventArgs testingTarget = new TimeTickEventArgs(); + testingTarget.WatchTime = dummyWatchTime; + + var result = testingTarget.WatchTime; + Assert.IsNotNull(result, "should be not null."); + Assert.AreEqual(dummyWatchTime, result, "Retrieved result should be equal to dummyApplication. "); + + tlog.Debug(tag, $"WatchApplicationTimeTickEventArgsWatchTimeSet END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchApplicationTimeTickEventArgsWatchTimeSet END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchApplication AmbientTickEventArgs:Application get")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchApplicationAmbientTickEventArgsApplicationGet() + { + tlog.Debug(tag, $"WatchApplicationAmbientTickEventArgsApplicationGet START"); + + if (IsWearable()) + { + AmbientTickEventArgs dummy = new AmbientTickEventArgs(); + var testingTarget = dummy.Application; + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchApplicationAmbientTickEventArgsApplicationGet END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchApplicationAmbientTickEventArgsApplicationGet END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchApplication AmbientTickEventArgs:Application set")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchApplicationAmbientTickEventArgsApplicationSet() + { + tlog.Debug(tag, $"WatchApplicationAmbientTickEventArgsApplicationSet START"); + + if (IsWearable()) + { + var application = new Application(); + Assert.IsNotNull(application, "should be not null"); + Assert.IsInstanceOf(application, "should be an instance of testing target class!"); + + AmbientTickEventArgs testingTarget = new AmbientTickEventArgs(); + testingTarget.Application = application; + + var result = testingTarget.Application; + Assert.IsNotNull(result, "should be not null."); + Assert.AreEqual(application, result, "Retrieved result should be equal to dummyApplication. "); + + application.Dispose(); + tlog.Debug(tag, $"WatchApplicationAmbientTickEventArgsApplicationSet END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchApplicationAmbientTickEventArgsApplicationSet END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchApplication AmbientTickEventArgs:WatchTime get")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchApplicationAmbientTickEventArgsWatchTimeGet() + { + tlog.Debug(tag, $"WatchApplicationAmbientTickEventArgsWatchTimeGet START"); + + if (IsWearable()) + { + AmbientTickEventArgs dummy = new AmbientTickEventArgs(); + var testingTarget = dummy.WatchTime; + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchApplicationAmbientTickEventArgsWatchTimeGet END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchApplicationAmbientTickEventArgsWatchTimeGet END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchApplication AmbientTickEventArgs:WatchTime set")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchApplicationAmbientTickEventArgsWatchTimeSet() + { + tlog.Debug(tag, $"WatchApplicationAmbientTickEventArgsWatchTimeSet START"); + + if (IsWearable()) + { + var dummyWatchTime = new WatchTime(); + Assert.IsNotNull(dummyWatchTime, "should be not null"); + Assert.IsInstanceOf(dummyWatchTime, "should be an instance of testing target class!"); + + AmbientTickEventArgs testingTarget = new AmbientTickEventArgs(); + testingTarget.WatchTime = dummyWatchTime; + + var result = testingTarget.WatchTime; + Assert.IsNotNull(result, "should be not null."); + Assert.AreEqual(dummyWatchTime, result, "Retrieved result should be equal to dummyApplication. "); + + dummyWatchTime.Dispose(); + tlog.Debug(tag, $"WatchApplicationAmbientTickEventArgsWatchTimeSet END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchApplicationAmbientTickEventArgsWatchTimeSet END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchApplication AmbientChangedEventArgs:Application get")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchApplicationAmbientChangedEventArgsApplicationGet() + { + tlog.Debug(tag, $"WatchApplicationAmbientChangedEventArgsApplicationGet START"); + + if (IsWearable()) + { + AmbientChangedEventArgs dummy = new AmbientChangedEventArgs(); + var testingTarget = dummy.Application; + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchApplicationAmbientChangedEventArgsApplicationGet END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchApplicationAmbientChangedEventArgsApplicationGet END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchApplication AmbientChangedEventArgs:Application set")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchApplicationAmbientChangedEventArgsApplicationSet() + { + tlog.Debug(tag, $"WatchApplicationAmbientChangedEventArgsApplicationSet START"); + + if (IsWearable()) + { + var dummyApplication = new Application(); + Assert.IsNotNull(dummyApplication, "should be not null"); + Assert.IsInstanceOf(dummyApplication, "should be an instance of testing target class!"); + + AmbientChangedEventArgs testingTarget = new AmbientChangedEventArgs(); + testingTarget.Application = dummyApplication; + + var result = testingTarget.Application; + Assert.IsNotNull(result, "should be not null."); + Assert.AreEqual(dummyApplication, result, "Retrieved result should be equal to dummyApplication. "); + + dummyApplication.Dispose(); + tlog.Debug(tag, $"WatchApplicationAmbientChangedEventArgsApplicationSet END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchApplicationAmbientChangedEventArgsApplicationSet END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchApplication AmbientChangedEventArgs:Changed get")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchApplicationAmbientChangedEventArgsChangedGet() + { + tlog.Debug(tag, $"WatchApplicationAmbientChangedEventArgsChangedGet START"); + + if (IsWearable()) + { + AmbientChangedEventArgs testingTarget = new AmbientChangedEventArgs(); + var result = testingTarget.Changed; + Assert.IsNotNull(result, "should be not null"); + + tlog.Debug(tag, $"WatchApplicationAmbientChangedEventArgsChangedGet END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchApplicationAmbientChangedEventArgsChangedGet END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchApplication AmbientChangedEventArgs:Changed set")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchApplicationAmbientChangedEventArgsChangedSet() + { + tlog.Debug(tag, $"WatchApplicationAmbientChangedEventArgsChangedSet START"); + + if (IsWearable()) + { + AmbientChangedEventArgs testingTarget = new AmbientChangedEventArgs(); + testingTarget.Changed = true; + + var result = testingTarget.Changed; + Assert.IsNotNull(result, "should be not null."); + Assert.AreEqual(true, result, "Retrieved result should be equal to true. "); + tlog.Debug(tag, $"WatchApplicationAmbientChangedEventArgsChangedSet END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchApplicationAmbientChangedEventArgsChangedSet END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSWatchBoolSignal.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSWatchBoolSignal.cs new file mode 100755 index 0000000..f825b37 --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSWatchBoolSignal.cs @@ -0,0 +1,206 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("internal/Application/WatchBoolSignal")] + public class InternalWatchBoolSignalTest + { + private const string tag = "NUITEST"; + private delegate bool dummyCallback(IntPtr application); + private bool OnDummyCallback(IntPtr data) + { + return false; + } + + private bool IsWearable() + { + string value; + var result = Tizen.System.Information.TryGetValue("tizen.org/feature/profile", out value); + if (result && value.Equals("wearable")) + { + return true; + } + + return false; + } + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Description("WatchBoolSignal constructor")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchBoolSignalConstructor() + { + tlog.Debug(tag, $"WatchBoolSignalConstructor START"); + + if (IsWearable()) + { + var testingTarget = new WatchBoolSignal(); + + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchBoolSignalConstructor END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchBoolSignalConstructor END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchBoolSignal Empty")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchBoolSignalEmpty() + { + tlog.Debug(tag, $"WatchBoolSignalEmpty START"); + + if (IsWearable()) + { + var testingTarget = new WatchBoolSignal(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var result = testingTarget.Empty(); + Assert.IsTrue(result); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchBoolSignalEmpty END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchBoolSignalEmpty END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchBoolSignal GetConnectionCount")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchBoolSignalGetConnectionCount() + { + tlog.Debug(tag, $"WatchBoolSignalGetConnectionCount START"); + + if (IsWearable()) + { + var testingTarget = new WatchBoolSignal(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var result = testingTarget.GetConnectionCount(); + Assert.IsTrue(result == 0, "result should be 0"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchBoolSignalGetConnectionCount END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchBoolSignalGetConnectionCount END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchBoolSignal Connection")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchBoolSignalConnection() + { + tlog.Debug(tag, $"WatchBoolSignalConnection START"); + + if (IsWearable()) + { + var testingTarget = new WatchBoolSignal(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + dummyCallback callback = OnDummyCallback; + testingTarget.Connect(callback); + testingTarget.Disconnect(callback); + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchBoolSignalConnection END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchBoolSignalConnection END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchBoolSignal Disconnection")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchBoolSignalDisconnection() + { + tlog.Debug(tag, $"WatchBoolSignalDisconnection START"); + + if (IsWearable()) + { + var testingTarget = new WatchBoolSignal(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + dummyCallback callback = OnDummyCallback; + testingTarget.Connect(callback); + testingTarget.Disconnect(callback); + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchBoolSignalDisconnection END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchBoolSignalDisconnection END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchBoolSignal Emit")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchBoolSignalEmit() + { + tlog.Debug(tag, $"WatchBoolSignalEmit START"); + + if (IsWearable()) + { + var currentPid = global::System.Diagnostics.Process.GetCurrentProcess().Id; + var currentTid = global::System.Threading.Thread.CurrentThread.ManagedThreadId; + + tlog.Debug(tag, $"thread check! main pid={App.mainPid}, current pid={currentPid}, main tid={App.mainTid}, current tid={currentTid}"); + + var testingTarget = new WatchBoolSignal(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var dummy = new Application(); + testingTarget.Emit(dummy, true); + + dummy.Dispose(); + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchBoolSignalEmit END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchBoolSignalEmit END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSWatchTimeSignal.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSWatchTimeSignal.cs new file mode 100755 index 0000000..f33deca --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/internal/Application/TSWatchTimeSignal.cs @@ -0,0 +1,207 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("internal/Application/WatchTimeSignal")] + public class InternalWatchTimeSignalTest + { + private const string tag = "NUITEST"; + private delegate bool dummyCallback(IntPtr application); + private bool OnDummyCallback(IntPtr data) + { + return false; + } + + private bool IsWearable() + { + string value; + var result = Tizen.System.Information.TryGetValue("tizen.org/feature/profile", out value); + if (result && value.Equals("wearable")) + { + return true; + } + + return false; + } + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Description("WatchTimeSignal constructor")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchTimeSignalConstructor() + { + tlog.Debug(tag, $"WatchTimeSignalConstructor START"); + + if (IsWearable()) + { + var testingTarget = new WatchTimeSignal(); + + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchTimeSignalConstructor END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchTimeSignalConstructor END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchTimeSignal Empty")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchTimeSignalEmpty() + { + tlog.Debug(tag, $"WatchTimeSignalEmpty START"); + + if (IsWearable()) + { + var testingTarget = new WatchTimeSignal(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var result = testingTarget.Empty(); + Assert.IsTrue(result); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchTimeSignalEmpty END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchTimeSignalEmpty END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchTimeSignal GetConnectionCount")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchTimeSignalGetConnectionCount() + { + tlog.Debug(tag, $"WatchTimeSignalGetConnectionCount START"); + + if (IsWearable()) + { + var testingTarget = new WatchTimeSignal(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + var result = testingTarget.GetConnectionCount(); + Assert.IsTrue(result == 0, "result should be 0"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchTimeSignalGetConnectionCount END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchTimeSignalGetConnectionCount END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchTimeSignal Connection")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchTimeSignalConnection() + { + tlog.Debug(tag, $"WatchTimeSignalConnection START"); + + if (IsWearable()) + { + var testingTarget = new WatchTimeSignal(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + dummyCallback callback = OnDummyCallback; + testingTarget.Connect(callback); + testingTarget.Disconnect(callback); + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchTimeSignalConnection END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchTimeSignalConnection END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchTimeSignal Disconnection")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchTimeSignalDisconnection() + { + tlog.Debug(tag, $"WatchTimeSignalDisconnection START"); + + if (IsWearable()) + { + var testingTarget = new WatchTimeSignal(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + dummyCallback callback = OnDummyCallback; + testingTarget.Connect(callback); + testingTarget.Disconnect(callback); + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchTimeSignalDisconnection END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchTimeSignalDisconnection END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Description("WatchTimeSignal Emit")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchTimeSignalEmit() + { + tlog.Debug(tag, $"WatchTimeSignalEmit START"); + + if (IsWearable()) + { + var currentPid = global::System.Diagnostics.Process.GetCurrentProcess().Id; + var currentTid = global::System.Threading.Thread.CurrentThread.ManagedThreadId; + + tlog.Debug(tag, $"thread check! main pid={App.mainPid}, current pid={currentPid}, main tid={App.mainTid}, current tid={currentTid}"); + + var testingTarget = new WatchTimeSignal(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "should be an instance of testing target class!"); + + Application application = new Application(); + WatchTime watchTime = new WatchTime(); + testingTarget.Emit(application, watchTime); + + application.Dispose(); + watchTime.Dispose(); + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchTimeSignalEmit END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchTimeSignalEmit END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Application/TSNUIApplication.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Application/TSNUIApplication.cs new file mode 100755 index 0000000..bea448a --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Application/TSNUIApplication.cs @@ -0,0 +1,348 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; +using System.Globalization; +using System.Resources; +using Tizen.Applications; + +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("public/Application/NUIApplication")] + class PublicNUIApplicationTest + { + private const string tag = "NUITEST"; + private delegate bool dummyCallback(IntPtr NUIApplication); + private bool OnDummyCallback(IntPtr data) + { + return false; + } + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("NUIApplication constructor.")] + [Property("SPEC", "Tizen.NUI.NUIApplication.NUIApplication C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationConstructor() + { + tlog.Debug(tag, $"NUIApplicationConstructor START"); + + var testingTarget = new NUIApplication(); + Assert.IsNotNull(testingTarget, "Should be not null."); + Assert.IsInstanceOf(testingTarget, "Should be an instance of NUIApplication type."); + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUIApplicationConstructor END (OK)"); + } + + [Test] + [Category("P1")] + [Description("NUIApplication constructor. With window size and position")] + [Property("SPEC", "Tizen.NUI.NUIApplication.NUIApplication C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationConstructorWithWindowSizeAndPosition() + { + tlog.Debug(tag, $"NUIApplicationConstructorWithWindowSizeAndPosition START"); + + Size size = new Size(100, 200); + Position pos = new Position(200, 300); + var testingTarget = new NUIApplication(size, pos); + Assert.IsNotNull(testingTarget, "Should be not null."); + Assert.IsInstanceOf(testingTarget, "Should be an instance of NUIApplication type."); + + pos.Dispose(); + size.Dispose(); + testingTarget.Dispose(); + tlog.Debug(tag, $"NUIApplicationConstructorWithWindowSizeAndPosition END (OK)"); + } + + [Test] + [Category("P1")] + [Description("NUIApplication constructor. With stylesheet.")] + [Property("SPEC", "Tizen.NUI.NUIApplication.NUIApplication C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationConstructorWithStyleSheet() + { + tlog.Debug(tag, $"NUIApplicationConstructorWithStyleSheet START"); + + var testingTarget = new NUIApplication("stylesheet"); + Assert.IsNotNull(testingTarget, "Should be not null."); + Assert.IsInstanceOf(testingTarget, "Should be an instance of NUIApplication type."); + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUIApplicationConstructorWithStyleSheet END (OK)"); + } + + [Test] + [Category("P1")] + [Description("NUIApplication constructor. With stylesheet, window size, position.")] + [Property("SPEC", "Tizen.NUI.NUIApplication.NUIApplication C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationConstructorWithStyleSheetAndWindowSizeAndPostion() + { + tlog.Debug(tag, $"NUIApplicationConstructorWithStyleSheetAndWindowSizeAndPostion START"); + + var testingTarget = new NUIApplication("stylesheet", new Size(100, 200), new Position(200, 300)); + Assert.IsNotNull(testingTarget, "Should be not null."); + Assert.IsInstanceOf(testingTarget, "Should be an instance of NUIApplication type."); + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUIApplicationConstructorWithStyleSheetAndWindowSizeAndPostion END (OK)"); + } + + [Test] + [Category("P1")] + [Description("NUIApplication constructor. With stylesheet and WindowMode.")] + [Property("SPEC", "Tizen.NUI.NUIApplication.NUIApplication C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationConstructorWithStringAndWindowMode() + { + tlog.Debug(tag, $"NUIApplicationConstructorWithStringAndWindowMode START"); + + var testingTarget = new NUIApplication("stylesheet", NUIApplication.WindowMode.Opaque); + Assert.IsNotNull(testingTarget, "Should be not null."); + Assert.IsNotNull(testingTarget, "NUIApplication Should return NUIApplication instance."); + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUIApplicationConstructorWithStringAndWindowMode END (OK)"); + } + + [Test] + [Category("P1")] + [Description("NUIApplication constructor. With stylesheet, WindowMode, window size and position")] + [Property("SPEC", "Tizen.NUI.NUIApplication.NUIApplication C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationConstructorWithStringAndWindowModeAndWindowSizeAndPosition() + { + tlog.Debug(tag, $"NUIApplicationConstructorWithStringAndWindowModeAndWindowSizeAndPosition START"); + + var testingTarget = new NUIApplication("stylesheet", NUIApplication.WindowMode.Opaque, new Size(100, 200), new Position(200, 300)); + Assert.IsNotNull(testingTarget, "Should be not null."); + Assert.IsNotNull(testingTarget, "NUIApplication Should return NUIApplication instance."); + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUIApplicationConstructorWithStringAndWindowModeAndWindowSizeAndPosition END (OK)"); + } + + [Test] + [Category("P1")] + [Description("NUIApplication RegisterAssembly.")] + [Property("SPEC", "Tizen.NUI.NUIApplication.RegisterAssembly M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationRegisterAssembly() + { + tlog.Debug(tag, $"NUIApplicationRegisterAssembly START"); + + try + { + NUIApplication.RegisterAssembly(typeof(NUIApplication).Assembly); + } + catch (Exception e) + { + tlog.Error(tag, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + + tlog.Debug(tag, $"NUIApplicationRegisterAssembly END (OK)"); + } + + [Test] + [Category("P1")] + [Description("NUIApplication MultilingualResourceManager.")] + [Property("SPEC", "Tizen.NUI.NUIApplication.MultilingualResourceManager A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationMultilingualResourceManager() + { + tlog.Debug(tag, $"NUIApplicationMultilingualResourceManager START"); + + NUIApplication.MultilingualResourceManager = Resource.ResourceManager; + Assert.IsNotNull(NUIApplication.MultilingualResourceManager, "Should be not null!"); + + string str = null; + str = NUIApplication.MultilingualResourceManager?.GetString("Test"); + Assert.AreEqual("Test", str, "Picture should be Beeld in Dutch"); + + tlog.Debug(tag, $"NUIApplicationMultilingualResourceManager END (OK)"); + } + + [Test] + [Category("P1")] + [Description("NUIApplication AppId")] + [Property("SPEC", "Tizen.NUI.NUIApplication.AppId A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationAppId() + { + tlog.Debug(tag, $"NUIApplicationAppId START"); + + var testingTarget = new NUIApplication(); + Assert.IsNotNull(testingTarget, "Should be not null."); + Assert.IsInstanceOf(testingTarget, "Should be an instance of NUIApplication type."); + + var result = testingTarget.AppId; + Assert.IsNotNull(result, "Should be not null."); + + tlog.Debug(tag, $"NUIApplicationAppId END (OK)"); + } + + [Test] + [Category("P1")] + [Description("NUIApplication GetDefaultWindow")] + [Property("SPEC", "Tizen.NUI.NUIApplication.GetDefaultWindow M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationGetDefaultWindow() + { + tlog.Debug(tag, $"NUIApplicationGetDefaultWindow START"); + + var testingTarget = NUIApplication.GetDefaultWindow(); + Assert.IsNotNull(testingTarget, "Should be not null."); + Assert.IsInstanceOf(testingTarget, "Should be an instance of Window type."); + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUIApplicationGetDefaultWindow END (OK)"); + } + + [Test] + [Category("P1")] + [Description("NUIApplication AddIdle")] + [Property("SPEC", "Tizen.NUI.NUIApplication.AddIdle M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationAddIdle() + { + tlog.Debug(tag, $"NUIApplicationAddIdle START"); + + dummyCallback callback = OnDummyCallback; + var result = Application.Instance.AddIdle(callback); + Assert.IsTrue(result); + + tlog.Debug(tag, $"NUIApplicationAddIdle END (OK)"); + } + + [Test] + [Category("P1")] + [Description("NUIApplication SetRenderRefreshRate")] + [Property("SPEC", "Tizen.NUI.NUIApplication.SetRenderRefreshRate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationSetRenderRefreshRate() + { + tlog.Debug(tag, $"NUIApplicationSetRenderRefreshRate START"); + + try + { + NUIApplication.SetRenderRefreshRate(2); + } + catch (Exception e) + { + tlog.Error(tag, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + + tlog.Debug(tag, $"NUIApplicationSetRenderRefreshRate END (OK)"); + } + + [Test] + [Category("P1")] + [Description("NUIApplication SendLaunchRequest")] + [Property("SPEC", "Tizen.NUI.NUIApplication.SendLaunchRequest M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationSendLaunchRequest() + { + tlog.Debug(tag, $"NUIApplicationSendLaunchRequest START"); + + var testingTarget = new NUIApplication(); + Assert.IsNotNull(testingTarget, "Should be not null."); + Assert.IsInstanceOf(testingTarget, "Should be an instance of Window type."); + + TransitionOptions transitionOption = new TransitionOptions(Window.Instance); + testingTarget.TransitionOptions = transitionOption; + transitionOption.EnableTransition = true; + + var appControl = new Applications.AppControl(true); + try + { + testingTarget.SendLaunchRequest(appControl); + } + catch (Exception e) + { + tlog.Error(tag, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + + transitionOption.Dispose(); + testingTarget.Dispose(); + tlog.Debug(tag, $"NUIApplicationSendLaunchRequest END (OK)"); + } + + [Test] + [Category("P1")] + [Description("NUIApplication TransitionOptions")] + [Property("SPEC", "Tizen.NUI.NUIApplication.TransitionOptions A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIApplicationTransitionOptions() + { + tlog.Debug(tag, $"NUIApplicationTransitionOptions START"); + + var testingTarget = new NUIApplication(); + Assert.IsNotNull(testingTarget, "Should be not null."); + Assert.IsInstanceOf(testingTarget, "Should be an instance of Window type."); + + TransitionOptions transitionOption = new TransitionOptions(Window.Instance); + testingTarget.TransitionOptions = transitionOption; + + var result = testingTarget.TransitionOptions; + Assert.IsNotNull(result); + Assert.IsInstanceOf(result, "Should be an instance of TransitionOptions type."); + + result.Dispose(); + transitionOption.Dispose(); + testingTarget.Dispose(); + tlog.Debug(tag, $"NUIApplicationTransitionOptions END (OK)"); + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Application/TSNUIComponentApplication.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Application/TSNUIComponentApplication.cs new file mode 100755 index 0000000..855f6ec --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Application/TSNUIComponentApplication.cs @@ -0,0 +1,29 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("public/Application/NUIComponentApplication")] + class PublicNUIComponentApplicationTest + { + private const string tag = "NUITEST"; + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Application/TSNUIFrameComponent.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Application/TSNUIFrameComponent.cs new file mode 100755 index 0000000..960784b --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Application/TSNUIFrameComponent.cs @@ -0,0 +1,29 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("public/Application/NUIFrameComponent")] + class PublicNUIFrameComponentTest + { + private const string tag = "NUITEST"; + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Application/TSNUIWidgetApplication.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Application/TSNUIWidgetApplication.cs new file mode 100755 index 0000000..78253bb --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Application/TSNUIWidgetApplication.cs @@ -0,0 +1,156 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; +using System.Collections.Generic; + +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("public/Application/NUIWidgetApplication")] + + public class MyWidget : Widget + { + protected override void OnCreate(string contentInfo, Window window) + { + window.BackgroundColor = Color.White; + TextLabel textLabel = new TextLabel("Widget Works"); + + window.GetDefaultLayer().Add(textLabel); + base.OnCreate(contentInfo, window); + } + } + + public class PublicNUIWidgetApplicationTest + { + private const string tag = "NUITEST"; + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("NUIWidgetApplication constructor.")] + [Property("SPEC", "Tizen.NUI.NUIWidgetApplication.NUIWidgetApplication C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIWidgetApplicationConstructor() + { + tlog.Debug(tag, $"NUIWidgetApplicationConstructor START"); + + var testingTarget = new NUIWidgetApplication(typeof(MyWidget)); + Assert.IsNotNull(testingTarget, "should be not null."); + Assert.IsInstanceOf(testingTarget, "Should be an instance of NUIWidgetApplication type."); + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUIWidgetApplicationConstructor END (OK)"); + } + + [Test] + [Category("P1")] + [Description("NUIWidgetApplication constructor. With stylesheet.")] + [Property("SPEC", "Tizen.NUI.NUIWidgetApplication.NUIWidgetApplication C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@partner.samsung.com")] + public void NUIWidgetApplicationConstructorWithStylesheet() + { + tlog.Debug(tag, $"NUIWidgetApplicationConstructorWithStylesheet START"); + + var testingTarget = new NUIWidgetApplication(typeof(MyWidget), "stylesheet"); + Assert.IsNotNull(testingTarget, "should be not null."); + Assert.IsInstanceOf(testingTarget, "Should be an instance of NUIWidgetApplication type."); + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUIWidgetApplicationConstructorWithStylesheet END (OK)"); + } + + [Test] + [Category("P1")] + [Description("NUIWidgetApplication constructor. With multi class.")] + [Property("SPEC", "Tizen.NUI.NUIWidgetApplication.NUIWidgetApplication C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIWidgetApplicationConstructorWithMultiClass() + { + tlog.Debug(tag, $"NUIWidgetApplicationConstructorWithMultiClass START"); + + Dictionary widgetSet = new Dictionary(); + widgetSet.Add(typeof(MyWidget), "Tizen.NUI.Tests"); + + var testingTarget = new NUIWidgetApplication(widgetSet); + Assert.IsNotNull(testingTarget, "should be not null."); + Assert.IsInstanceOf(testingTarget, "Should be an instance of NUIWidgetApplication type."); + + testingTarget.Dispose(); + tlog.Debug(tag, $"NUIWidgetApplicationConstructorWithMultiClass END (OK)"); + } + + [Test] + [Category("P2")] + [Description("NUIWidgetApplication constructor. With invalid value.")] + [Property("SPEC", "Tizen.NUI.NUIWidgetApplication.NUIWidgetApplication C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void NUIWidgetApplicationConstructorWithNullValue() + { + tlog.Debug(tag, $"NUIWidgetApplicationConstructorWithNullValue START"); + + try + { + Dictionary widgetSet = null; + var testingTarget = new NUIWidgetApplication(widgetSet); + } + catch (InvalidOperationException e) + { + Assert.Pass("Create a NUIWidgetApplication with invalid Dictionary"); + } + + tlog.Debug(tag, $"NUIWidgetApplicationConstructorWithNullValue END (OK)"); + } + + [Test] + [Category("P1")] + [Description("NUIWidgetApplication Dispose.")] + [Property("SPEC", "Tizen.NUI.NUIWidgetApplication.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@partner.samsung.com")] + public void NUIWidgetApplicationDispose() + { + tlog.Debug(tag, $"NUIWidgetApplicationDispose START"); + + try + { + var testingTarget = new NUIWidgetApplication(typeof(MyWidget)); + Assert.IsNotNull(testingTarget, "should be not null."); + Assert.IsInstanceOf(testingTarget, "Should be an instance of NUIWidgetApplication type."); + + testingTarget.Dispose(); + } + catch (Exception e) + { + tlog.Error(tag, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + + tlog.Debug(tag, $"NUIWidgetApplicationDispose END (OK)"); + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Application/TSWatchTime.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Application/TSWatchTime.cs new file mode 100755 index 0000000..0028f00 --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Application/TSWatchTime.cs @@ -0,0 +1,399 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; +using System.Threading.Tasks; + +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("public/Application/WatchTime")] + public class PublicWatchTimeTest + { + private const string tag = "NUITEST"; + + private bool IsWearable() + { + string value; + var result = Tizen.System.Information.TryGetValue("tizen.org/feature/profile", out value); + if (result && value.Equals("wearable")) + { + return true; + } + + return false; + } + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("WatchTime constructor.")] + [Property("SPEC", "Tizen.NUI.WatchTime.WatchTime C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchTimeConstructor() + { + tlog.Debug(tag, $"WatchTimeConstructor START"); + + if (IsWearable()) + { + var testingTarget = new WatchTime(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WatchTime type."); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchTimeConstructor END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchTimeConstructor END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Category("P1")] + [Description("WatchTime Day.")] + [Property("SPEC", "Tizen.NUI.WatchTime.Day A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchTimeDay() + { + tlog.Debug(tag, $"WatchTimeDay START"); + + if (IsWearable()) + { + var testingTarget = new WatchTime(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WatchTime type."); + + int time = testingTarget.Day; + Assert.IsTrue(time > 0.0f); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchTimeDay END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchTimeDay END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Category("P1")] + [Description("WatchTime DaylightSavingTimeStatus.")] + [Property("SPEC", "Tizen.NUI.WatchTime.DaylightSavingTimeStatus A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchTimeDaylightSavingTimeStatus() + { + tlog.Debug(tag, $"WatchTimeDaylightSavingTimeStatus START"); + + if (IsWearable()) + { + var testingTarget = new WatchTime(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WatchTime type."); + + bool status = testingTarget.DaylightSavingTimeStatus; + Assert.AreEqual(false, status, "Should be the default value"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchTimeDaylightSavingTimeStatus END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchTimeDaylightSavingTimeStatus END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Category("P1")] + [Description("WatchTime DayOfWeek.")] + [Property("SPEC", "Tizen.NUI.WatchTime.DayOfWeek A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchTimeDayOfWeek() + { + tlog.Debug(tag, $"WatchTimeDayOfWeek START"); + + if (IsWearable()) + { + var testingTarget = new WatchTime(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WatchTime type."); + + int day = testingTarget.DayOfWeek; + Assert.IsTrue(day > 0.0f); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchTimeDayOfWeek END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchTimeDayOfWeek END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Category("P1")] + [Description("WatchTime Hour.")] + [Property("SPEC", "Tizen.NUI.WatchTime.Hour A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchTimeHour() + { + tlog.Debug(tag, $"WatchTimeHour START"); + + if (IsWearable()) + { + var testingTarget = new WatchTime(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WatchTime type."); + + int hour = testingTarget.Hour; + Assert.IsTrue(hour > 0.0f); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchTimeHour END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchTimeHour END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Category("P1")] + [Description("WatchTime Hour24.")] + [Property("SPEC", "Tizen.NUI.WatchTime.Hour24 A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchTimeHour24() + { + tlog.Debug(tag, $"WatchTimeHour24 START"); + + if (IsWearable()) + { + var testingTarget = new WatchTime(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WatchTime type."); + + int hour24 = testingTarget.Hour24; + Assert.IsTrue(hour24 >= 0.0f); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchTimeHour24 END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchTimeHour24 END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Category("P1")] + [Description("WatchTime Millisecond.")] + [Property("SPEC", "Tizen.NUI.WatchTime.Millisecond A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchTimeMillisecond() + { + tlog.Debug(tag, $"WatchTimeMillisecond START"); + + if (IsWearable()) + { + var testingTarget = new WatchTime(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WatchTime type."); + + int millisecond = testingTarget.Millisecond; + Assert.IsTrue(millisecond >= 0.0f); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchTimeMillisecond END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchTimeMillisecond END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Category("P1")] + [Description("WatchTime Minute.")] + [Property("SPEC", "Tizen.NUI.WatchTime.Minute A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchTimeMinute() + { + tlog.Debug(tag, $"WatchTimeMinute START"); + + if (IsWearable()) + { + var testingTarget = new WatchTime(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WatchTime type."); + + int minute = testingTarget.Minute; + Assert.IsTrue(minute >= 0.0f); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchTimeMinute END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchTimeMinute END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Category("P1")] + [Description("WatchTime Month.")] + [Property("SPEC", "Tizen.NUI.WatchTime.Month A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchTimeMonth() + { + tlog.Debug(tag, $"WatchTimeMonth START"); + + if (IsWearable()) + { + var testingTarget = new WatchTime(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WatchTime type."); + + int month = testingTarget.Month; + Assert.IsTrue(month > 0.0f); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchTimeMonth END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchTimeMonth END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Category("P1")] + [Description("WatchTime Second.")] + [Property("SPEC", "Tizen.NUI.WatchTime.Second A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchTimeSecond() + { + tlog.Debug(tag, $"WatchTimeSecond START"); + + if (IsWearable()) + { + var testingTarget = new WatchTime(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WatchTime type."); + + int second = testingTarget.Second; + Assert.IsTrue(second >= 0.0f); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchTimeSecond END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchTimeSecond END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Category("P1")] + [Description("WatchTime TimeZone.")] + [Property("SPEC", "Tizen.NUI.WatchTime.TimeZone A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchTimeTimeZone() + { + tlog.Debug(tag, $"WatchTimeTimeZone START"); + + if (IsWearable()) + { + var testingTarget = new WatchTime(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WatchTime type."); + + string zone = testingTarget.TimeZone; + Assert.IsNotEmpty(zone, "TimeZone is empty"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchTimeTimeZone END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchTimeTimeZone END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + + [Test] + [Category("P1")] + [Description("WatchTime Year.")] + [Property("SPEC", "Tizen.NUI.WatchTime.Year A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WatchTimeYear() + { + tlog.Debug(tag, $"WatchTimeYear START"); + + if (IsWearable()) + { + var testingTarget = new WatchTime(); + Assert.IsNotNull(testingTarget, "should be not null"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WatchTime type."); + + int year = testingTarget.Year; + Assert.IsTrue(year > 0.0f); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WatchTimeYear END (OK)"); + } + else + { + tlog.Debug(tag, $"WatchTimeYear END (OK)"); + Assert.Pass("Not Supported profile"); + } + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Common/TSProperty.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Common/TSProperty.cs index 2a44194..714c717 100755 --- a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Common/TSProperty.cs +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Common/TSProperty.cs @@ -188,7 +188,7 @@ namespace Tizen.NUI.Devel.Tests [Property("AUTHOR", "guowei.wang@samsung.com")] public void PropertyComponentIndexGet() { - tlog.Debug(tag, $"PropertyPropertyIndexGet START"); + tlog.Debug(tag, $"PropertyComponentIndexGet START"); var animatable = new Animatable(); Assert.IsNotNull(animatable, "Should be not null!"); @@ -203,7 +203,7 @@ namespace Tizen.NUI.Devel.Tests testingTarget.Dispose(); animatable.Dispose(); - tlog.Debug(tag, $"PropertyPropertyIndexGet END (OK)"); + tlog.Debug(tag, $"PropertyComponentIndexGet END (OK)"); } [Test] @@ -213,9 +213,9 @@ namespace Tizen.NUI.Devel.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "PRO")] [Property("AUTHOR", "guowei.wang@samsung.com")] - public void PropertyComponentIndexIndexSet() + public void PropertyComponentIndexSet() { - tlog.Debug(tag, $"PropertyPropertyIndexSet START"); + tlog.Debug(tag, $"PropertyComponentIndexSet START"); var animatable = new Animatable(); Assert.IsNotNull(animatable, "Should be not null!"); @@ -231,7 +231,7 @@ namespace Tizen.NUI.Devel.Tests testingTarget.Dispose(); animatable.Dispose(); - tlog.Debug(tag, $"PropertyPropertyIndexSet END (OK)"); + tlog.Debug(tag, $"PropertyComponentIndexSet END (OK)"); } } } diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Common/TSPropertyArray.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Common/TSPropertyArray.cs index 27cf8c8..5ccd0cd 100755 --- a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Common/TSPropertyArray.cs +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Common/TSPropertyArray.cs @@ -172,7 +172,7 @@ namespace Tizen.NUI.Devel.Tests Assert.IsTrue(testingTarget.Capacity() == 3, "testingTarget's capacity should be 3"); testingTarget.Dispose(); - tlog.Debug(tag, $"PropertyArrayClear END (OK)"); + tlog.Debug(tag, $"PropertyArrayReserve END (OK)"); } [Test] diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Common/TSPropertyNotifySignal.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Common/TSPropertyNotifySignal.cs index 1ec84b7..e3e9f73 100755 --- a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Common/TSPropertyNotifySignal.cs +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Common/TSPropertyNotifySignal.cs @@ -4,7 +4,7 @@ using NUnit.Framework.TUnit; using Tizen.NUI.Components; using Tizen.NUI.BaseComponents; -namespace Tizen.NUI.Devel.Tests.testcase +namespace Tizen.NUI.Devel.Tests { using tlog = Tizen.Log;