From: hyunho Date: Tue, 12 Feb 2019 08:42:28 +0000 (+0900) Subject: [WatchfaceComplication][TCSACR-189][Add Watchface Complication API] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e002a69411b88faceefb5e4097445d8fbf1a3fed;p=test%2Ftct%2Fcsharp%2Fapi.git [WatchfaceComplication][TCSACR-189][Add Watchface Complication API] Change-Id: I3eeeb3440832875fc287602a27f4fee24548342e Signed-off-by: hyunho --- diff --git a/tct-suite-vs/Resource/Tizen.WatchfaceComplication.Tests/CsharpWatch.tar b/tct-suite-vs/Resource/Tizen.WatchfaceComplication.Tests/CsharpWatch.tar new file mode 100644 index 0000000..11a5ba7 Binary files /dev/null and b/tct-suite-vs/Resource/Tizen.WatchfaceComplication.Tests/CsharpWatch.tar differ diff --git a/tct-suite-vs/Resource/Tizen.WatchfaceComplication.Tests/complication-provider-csharp.tar b/tct-suite-vs/Resource/Tizen.WatchfaceComplication.Tests/complication-provider-csharp.tar new file mode 100644 index 0000000..d3fd3c2 Binary files /dev/null and b/tct-suite-vs/Resource/Tizen.WatchfaceComplication.Tests/complication-provider-csharp.tar differ diff --git a/tct-suite-vs/Resource/Tizen.WatchfaceComplication.Tests/org.tizen.ComplicationProviderCsharp-1.0.0.tpk b/tct-suite-vs/Resource/Tizen.WatchfaceComplication.Tests/org.tizen.ComplicationProviderCsharp-1.0.0.tpk new file mode 100644 index 0000000..b7f8919 Binary files /dev/null and b/tct-suite-vs/Resource/Tizen.WatchfaceComplication.Tests/org.tizen.ComplicationProviderCsharp-1.0.0.tpk differ diff --git a/tct-suite-vs/Resource/Tizen.WatchfaceComplication.Tests/org.tizen.CsharpWatch-1.0.0.tpk b/tct-suite-vs/Resource/Tizen.WatchfaceComplication.Tests/org.tizen.CsharpWatch-1.0.0.tpk new file mode 100644 index 0000000..be6a80d Binary files /dev/null and b/tct-suite-vs/Resource/Tizen.WatchfaceComplication.Tests/org.tizen.CsharpWatch-1.0.0.tpk differ diff --git a/tct-suite-vs/Resource/Tizen.WatchfaceComplication.Tests/org.tizen.watchface_sample_editor-1.0.0-arm.tpk b/tct-suite-vs/Resource/Tizen.WatchfaceComplication.Tests/org.tizen.watchface_sample_editor-1.0.0-arm.tpk new file mode 100644 index 0000000..7e51a43 Binary files /dev/null and b/tct-suite-vs/Resource/Tizen.WatchfaceComplication.Tests/org.tizen.watchface_sample_editor-1.0.0-arm.tpk differ diff --git a/tct-suite-vs/Resource/Tizen.WatchfaceComplication.Tests/org.tizen.watchface_sample_editor-1.0.0-x86.tpk b/tct-suite-vs/Resource/Tizen.WatchfaceComplication.Tests/org.tizen.watchface_sample_editor-1.0.0-x86.tpk new file mode 100644 index 0000000..3aadcd6 Binary files /dev/null and b/tct-suite-vs/Resource/Tizen.WatchfaceComplication.Tests/org.tizen.watchface_sample_editor-1.0.0-x86.tpk differ diff --git a/tct-suite-vs/Resource/Tizen.WatchfaceComplication.Tests/watchface_sample_editor.tar b/tct-suite-vs/Resource/Tizen.WatchfaceComplication.Tests/watchface_sample_editor.tar new file mode 100644 index 0000000..ad0c0aa Binary files /dev/null and b/tct-suite-vs/Resource/Tizen.WatchfaceComplication.Tests/watchface_sample_editor.tar differ diff --git a/tct-suite-vs/Tizen.WatchfaceComplication.Tests/Program.cs b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/Program.cs new file mode 100755 index 0000000..87d9f97 --- /dev/null +++ b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/Program.cs @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using NUnitLite.TUnit; +using AutoTemplate; + +namespace XamarinForTizen.Tizen +{ + + class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication + { + private static App _app; + protected override void OnCreate() + { + base.OnCreate(); + + Console.WriteLine("TCT : OnCreate()"); + _app = new App(); + LoadApplication(_app); + + TRunner t = new TRunner(); + t.LoadTestsuite(); + t.Execute(); + } + + public static App getApp() + { + return _app; + } + static void Main(string[] args) + { + Console.WriteLine("TCT : Main()"); + var app = new Program(); + global::Xamarin.Forms.Platform.Tizen.Forms.Init(app); + app.Run(args); + } + } +} diff --git a/tct-suite-vs/Tizen.WatchfaceComplication.Tests/Tizen.WatchfaceComplication.Tests.csproj b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/Tizen.WatchfaceComplication.Tests.csproj new file mode 100755 index 0000000..1c4ad04 --- /dev/null +++ b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/Tizen.WatchfaceComplication.Tests.csproj @@ -0,0 +1,39 @@ + + + + + Exe + tizen60 + + + + + true + + + + portable + + + None + + + + + + + + + + + Runtime + + + + + + + + + + diff --git a/tct-suite-vs/Tizen.WatchfaceComplication.Tests/Tizen.WatchfaceComplication.Tests.sln b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/Tizen.WatchfaceComplication.Tests.sln new file mode 100755 index 0000000..8bf5632 --- /dev/null +++ b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/Tizen.WatchfaceComplication.Tests.sln @@ -0,0 +1,72 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26730.15 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.WatchfaceComplication.Tests", "Tizen.WatchfaceComplication.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTemplate", "..\Template\AutoTemplate\AutoTemplate.csproj", "{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.NUI|Any CPU.ActiveCfg = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.NUI|Any CPU.Build.0 = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680} + EndGlobalSection +EndGlobal diff --git a/tct-suite-vs/Tizen.WatchfaceComplication.Tests/shared/res/Tizen.WatchfaceComplication.Tests.png b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/shared/res/Tizen.WatchfaceComplication.Tests.png new file mode 100755 index 0000000..9765b1b Binary files /dev/null and b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/shared/res/Tizen.WatchfaceComplication.Tests.png differ diff --git a/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSComplication.cs b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSComplication.cs new file mode 100644 index 0000000..12a0965 --- /dev/null +++ b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSComplication.cs @@ -0,0 +1,861 @@ +/* + * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Tizen; +using Tizen.Applications; +using Tizen.Applications.WatchfaceComplication; + +namespace Tizen.Applications.WatchfaceComplication.Tests { + + [TestFixture] + [Description("Tizen.Applications.WatchfaceComplication Test")] + public class ComplicationTests { + + private const double _expectCurRange = 50; + private const double _expectMinRange = 1; + private const double _expectMaxRange = 100; + private const long _expectTimestamp = 777; + private const int _notEditedCompId = 10; + private const int _compId = 1; + private const string _providerId = "org.tizen.ComplicationProviderCsharp/battery"; + private const string _notExistProviderId = "org.tizen.notexist"; + public static bool _userDisposeCalled; + private static MyComplication _mc; + + class MyComplication : Complication + { + private static string _logTag = "ComplicationTests"; + public string _extraData; + public string _shorttext; + public string _longtext; + public string _iconPath; + public string _title; + public string _imagePath; + public double _curRange = -1; + public double _minRange = -1; + public double _maxRange = -1; + public string _screenReaderText; + public long _timestamp; + public bool _onErrorHit = false; + public ComplicationTypes _curDataType; + + public MyComplication(int complicationId, ComplicationTypes supportTypes, EventTypes supportEvents, string defaultProviderId, + ComplicationTypes defaultType) + : base(complicationId, supportTypes, supportEvents, defaultProviderId, defaultType) + { + } + + protected override void OnComplicationUpdated(string providerId, ComplicationTypes type, Bundle data) + { + IEditable e = this; + try + { + if (type == ComplicationTypes.ShortText) + { + _shorttext = Complication.GetShortText(data); + Log.Debug(_logTag, "shorttext !!! : " + _shorttext); + + _title = Complication.GetTitle(data); + } + else if (type == ComplicationTypes.Icon) + { + _iconPath = Complication.GetIconPath(data); + } + else if (type == ComplicationTypes.LongText) + { + _longtext = Complication.GetLongText(data); + } + else if (type == ComplicationTypes.Image) + { + _imagePath = Complication.GetImagePath(data); + Log.Debug(_logTag, "imagePath !!! : " + _imagePath); + } + else if (type == ComplicationTypes.RangedValue) + { + _curRange = Complication.GetCurrentValueOfRange(data); + _maxRange = Complication.GetMaxValueOfRange(data); + _minRange = Complication.GetMinValueOfRange(data); + Log.Debug(_logTag, "cur range !!! : " + _curRange); + } + else if (type == ComplicationTypes.Time) + { + _timestamp = Complication.GetTimestamp(data); + Log.Debug(_logTag, "timestamp !!! : " + _timestamp); + } + _extraData = Complication.GetExtraData(data); + _screenReaderText = Complication.GetScreenReaderText(data); + _curDataType = Complication.GetType(data); + } + catch (Exception exp) + { + Log.Error(_logTag, "Failed to get data : " + exp.Message); + } + Log.Debug(_logTag, "Complication updated"); + OnComplicationError("test", ComplicationTypes.Icon, ComplicationError.DB); + } + + protected override void OnComplicationError(string providerId, ComplicationTypes type, ComplicationError errorReason) + { + Log.Error(_logTag, "Complication error !!! : " + providerId); + _onErrorHit = true; + } + + protected override void Dispose(bool disposing) + { + _userDisposeCalled = true; + base.Dispose(disposing); + } + } + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Preconditions for each TEST"); + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Postconditions for each TEST"); + _mc.Dispose(); + } + + [Test] + [Category("P1")] + [Description("Test : WatchfaceComplication Constructor test")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.Complication C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + [Property("COVPARAM", "int, Tizen.Applications.WatchfaceComplication.ComplicationTypes, Tizen.Applications.WatchfaceComplication.EventTypes, string, Tizen.Applications.WatchfaceComplication.ComplicationTypes")] + public void Complication_INIT() + { + var mc = new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText); + Assert.IsNotNull(mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(mc, "Object should be instance of Complication"); + mc.Dispose(); + } + + [Test] + [Category("P2")] + [Description("Test : WatchfaceComplication Constructor test with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.Complication C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + [Property("COVPARAM", "int, Tizen.Applications.WatchfaceComplication.ComplicationTypes, Tizen.Applications.WatchfaceComplication.EventTypes, string, Tizen.Applications.WatchfaceComplication.ComplicationTypes")] + public void Complication_INIT_ArgumentException() + { + Assert.Throws(() => new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventTap, null, ComplicationTypes.ShortText)); + } + + [Test] + [Category("P2")] + [Description("Test : WatchfaceComplication Constructor test with InvalidOperationException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.Complication C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + [Property("COVPARAM", "int, Tizen.Applications.WatchfaceComplication.ComplicationTypes, Tizen.Applications.WatchfaceComplication.EventTypes, string, Tizen.Applications.WatchfaceComplication.ComplicationTypes")] + public void Complication_INIT_InvalidOperationException() + { + var mc = new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText); + Assert.Throws(() => new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText)); + mc.Dispose(); + } + + [Test] + [Category("P1")] + [Description("Test : Gets current provider Id")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetCurrentProviderId M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetCurrentProviderId_Return_Value() + { + _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + string providerId = _mc.GetCurrentProviderId(); + Assert.AreEqual(providerId, _providerId); + + _mc.Dispose(); + } + + [Test] + [Category("P1")] + [Description("Test : Gets current type")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetCurrentType M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetCurrentType_Return_Value() + { + _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + ComplicationTypes type = _mc.GetCurrentType(); + Assert.AreEqual(type, ComplicationTypes.ShortText); + _mc.Dispose(); + } + + [Test] + [Category("P1")] + [Description("Test : Gets extra data from complication data")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetExtraData M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public async Task GetExtraData_Return_Value() + { + _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + + _mc.SendUpdateRequest(); + await Task.Delay(5000); + Assert.AreNotEqual(_mc._extraData, null); + _mc.Dispose(); + } + + [Test] + [Category("P2")] + [Description("Test : Gets extra data from complication data with InvalidOperationException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetExtraData M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetExtraData_InvalidOperationException() + { + Bundle b = new Bundle(); + Assert.Throws(() => Complication.GetExtraData(b)); + } + + [Test] + [Category("P1")] + [Description("Test : Gets icon path from complication data")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetIconPath M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public async Task GetIconPath_Return_Value() + { + _mc = new MyComplication(_notEditedCompId, ComplicationTypes.Icon, EventTypes.EventTap, _providerId, ComplicationTypes.Icon); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + + _mc.SendUpdateRequest(); + await Task.Delay(5000); + Assert.AreNotEqual(_mc._iconPath, null); + _mc.Dispose(); + } + + [Test] + [Category("P2")] + [Description("Test : Gets icon path from complication data with InvalidOperationException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetIconPath M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetIconPath_InvalidOperationException() + { + Bundle b = new Bundle(); + Assert.Throws(() => Complication.GetIconPath(b)); + } + + [Test] + [Category("P1")] + [Description("Test : Gets image path from complication data")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetImagePath M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public async Task GetImagePath_Return_Value() + { + _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.Image, EventTypes.EventTap, _providerId, ComplicationTypes.Image); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + + _mc.SendUpdateRequest(); + await Task.Delay(5000); + Assert.AreNotEqual(_mc._imagePath, null); + _mc.Dispose(); + } + + [Test] + [Category("P2")] + [Description("Test : Gets image path from complication data with InvalidOperationException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetImagePath M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetImagePath_InvalidOperationException() + { + Bundle b = new Bundle(); + Assert.Throws(() => Complication.GetImagePath(b)); + } + + [Test] + [Category("P1")] + [Description("Test : Gets long text from complication data")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetLongText M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public async Task GetLongText_Return_Value() + { + _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.LongText); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + + _mc.SendUpdateRequest(); + await Task.Delay(5000); + Assert.AreNotEqual(_mc._longtext, null); + _mc.Dispose(); + } + + [Test] + [Category("P2")] + [Description("Test : Gets long text from complication data with InvalidOperationException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetLongText M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetLongText_InvalidOperationException() + { + Bundle b = new Bundle(); + Assert.Throws(() => Complication.GetLongText(b)); + } + + [Test] + [Category("P1")] + [Description("Test : Gets current value of range type data from complication data")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetCurrentValueOfRange M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public async Task GetCurrentValueOfRange_Return_Value() + { + _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.RangedValue, EventTypes.EventTap, _providerId, ComplicationTypes.RangedValue); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + + _mc.SendUpdateRequest(); + await Task.Delay(5000); + Assert.AreEqual(_expectCurRange, _mc._curRange); + _mc.Dispose(); + } + + [Test] + [Category("P2")] + [Description("Test : Gets current value of range type data from complication data with InvalidOperationException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetCurrentValueOfRange M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetCurrentValueOfRange_InvalidOperationException() + { + Bundle b = new Bundle(); + Assert.Throws(() => Complication.GetCurrentValueOfRange(b)); + } + + [Test] + [Category("P1")] + [Description("Test : Gets max value of range type data from complication data")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetMaxValueOfRange M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public async Task GetMaxValueOfRange_Return_Value() + { + _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.RangedValue, EventTypes.EventTap, _providerId, ComplicationTypes.RangedValue); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + + _mc.SendUpdateRequest(); + await Task.Delay(5000); + Assert.AreEqual(_expectMaxRange, _mc._maxRange); + _mc.Dispose(); + } + + [Test] + [Category("P2")] + [Description("Test : Gets max value of range type data from complication data with InvalidOperationException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetMaxValueOfRange M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetMaxValueOfRange_InvalidOperationException() + { + Bundle b = new Bundle(); + Assert.Throws(() => Complication.GetMaxValueOfRange(b)); + } + + [Test] + [Category("P1")] + [Description("Test : Gets minimum value of range type data from complication data")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetMinValueOfRange M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public async Task GetMinValueOfRange_Return_Value() + { + _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.RangedValue, EventTypes.EventTap, _providerId, ComplicationTypes.RangedValue); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + + _mc.SendUpdateRequest(); + await Task.Delay(5000); + Assert.AreEqual(_expectMinRange, _mc._minRange); + _mc.Dispose(); + } + + [Test] + [Category("P2")] + [Description("Test : Gets minimum value of range type data from complication data with InvalidOperationException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetMinValueOfRange M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetMinValueOfRange_InvalidOperationException() + { + Bundle b = new Bundle(); + Assert.Throws(() => Complication.GetMinValueOfRange(b)); + } + + [Test] + [Category("P1")] + [Description("Test : Gets screen reader text from complication data")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetScreenReaderText M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public async Task GetScreenReaderText_Return_Value() + { + _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.LongText); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + + _mc.SendUpdateRequest(); + await Task.Delay(5000); + Assert.AreNotEqual(null, _mc._screenReaderText); + _mc.Dispose(); + } + + [Test] + [Category("P2")] + [Description("Test : Gets screen reader text from complication data with InvalidOperationException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetScreenReaderText M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetScreenReaderText_InvalidOperationException() + { + Bundle b = new Bundle(); + Assert.Throws(() => Complication.GetScreenReaderText(b)); + } + + [Test] + [Category("P1")] + [Description("Test : Gets short text from complication data")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetShortText M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public async Task GetShortText_Return_Value() + { + _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + + _mc.SendUpdateRequest(); + await Task.Delay(5000); + Assert.AreNotEqual(null, _mc._shorttext); + _mc.Dispose(); + } + + [Test] + [Category("P2")] + [Description("Test : Gets short text from complication data with InvalidOperationException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetShortText M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetShortText_InvalidOperationException() + { + Bundle b = new Bundle(); + Assert.Throws(() => Complication.GetShortText(b)); + } + + [Test] + [Category("P1")] + [Description("Test : Gets timestamp from complication data")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetTimestamp M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public async Task GetTimestamp_Return_Value() + { + _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.Time, EventTypes.EventTap, _providerId, ComplicationTypes.Time); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + + _mc.SendUpdateRequest(); + await Task.Delay(5000); + Assert.AreEqual(_expectTimestamp, _mc._timestamp); + _mc.Dispose(); + } + + + [Test] + [Category("P2")] + [Description("Test : Gets timestamp from complication data with InvalidOperationException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetTimestamp M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetTimestamp_InvalidOperationException() + { + Bundle b = new Bundle(); + Assert.Throws(() => Complication.GetTimestamp(b)); + } + + [Test] + [Category("P1")] + [Description("Test : Gets title from complication data")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetTitle M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public async Task GetTitle_Return_Value() + { + _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + + _mc.SendUpdateRequest(); + await Task.Delay(5000); + Assert.AreNotEqual(null, _mc._title); + _mc.Dispose(); + } + + [Test] + [Category("P2")] + [Description("Test : Gets title from complication data with InvalidOperationException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetTitle M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetTitle_InvalidOperationException() + { + Bundle b = new Bundle(); + Assert.Throws(() => Complication.GetTitle(b)); + } + + [Test] + [Category("P1")] + [Description("Test : Gets type from complication data")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetType M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public async Task GetType_Return_Value() + { + _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + + _mc.SendUpdateRequest(); + await Task.Delay(5000); + Assert.AreEqual(ComplicationTypes.ShortText, _mc._curDataType); + _mc.Dispose(); + } + + [Test] + [Category("P2")] + [Description("Test : Gets type from complication data with InvalidOperationException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.GetType M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetType_InvalidOperationException() + { + Bundle b = new Bundle(); + Assert.Throws(() => Complication.GetType(b)); + } + + [Test] + [Category("P1")] + [Description("Test : Listen OnComplicationError event")] + [Property("SPEC", " Tizen.Applications.WatchfaceComplication.Complication.OnComplicationError M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public async Task OnComplicationError_RECEIVE_EVENT() + { + _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + + _mc.SendUpdateRequest(); + await Task.Delay(5000); + Assert.AreEqual(true, _mc._onErrorHit); + _mc.Dispose(); + } + + [Test] + [Category("P1")] + [Description("Test : Listen OnComplicationUpdated event")] + [Property("SPEC", " Tizen.Applications.WatchfaceComplication.Complication.OnComplicationUpdated M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public async Task OnComplicationUpdated_RECEIVE_EVENT() + { + _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + + _mc.SendUpdateRequest(); + await Task.Delay(5000); + Assert.AreNotEqual(null, _mc._shorttext); + _mc.Dispose(); + } + + [Test] + [Category("P1")] + [Description("Test : Sends type from complication data")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.SendUpdateRequest M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public async Task SendUpdateRequest_SEND() + { + _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + + try + { + _mc.SendUpdateRequest(); + await Task.Delay(5000); + Assert.AreNotEqual(null, _mc._shorttext); + } + catch (Exception e) + { + Assert.Fail(e.ToString()); + } + finally + { + _mc.Dispose(); + } + } + + [Test] + [Category("P2")] + [Description("Test : Sends type from complication data with InvalidOperationException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.SendUpdateRequest M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void SendUpdateRequest_InvalidOperationException() + { + _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, "aaa", ComplicationTypes.ShortText); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + + Assert.Throws(() => _mc.SendUpdateRequest()); + _mc.Dispose(); + } + + [Test] + [Category("P1")] + [Description("Test : Sends type from complication data")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.TransferEvent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + [Property("COVPARAM", "Tizen.Applications.WatchfaceComplication.EventTypes")] + public void TransferEvent_SEND() + { + _mc = new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + + try + { + Log.Debug("[TCT]", "[TransferEvent] "); + _mc.TransferEvent(EventTypes.EventTap); + } + catch (Exception e) + { + Assert.Fail(e.ToString()); + } + finally + { + _mc.Dispose(); + } + } + + [Test] + [Category("P2")] + [Description("Test : Sends type from complication data with InvalidOperationException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.TransferEvent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + [Property("COVPARAM", "Tizen.Applications.WatchfaceComplication.EventTypes")] + public void TransferEvent_InvalidOperationException() + { + _mc = new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventTap, "aaa", ComplicationTypes.ShortText); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + Assert.Throws(() => _mc.TransferEvent(EventTypes.EventTap)); + } + + [Test] + [Category("P1")] + [Description("Test : Gets allowed list.")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.AllowedList A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void AllowedList_Return_Value() + { + _mc = new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + + try + { + Log.Debug("[TCT]", "[TransferEvent] "); + + List<(string providerId, ComplicationTypes t)> allowedList = new List<(string providerId, ComplicationTypes t)>(); + allowedList.Add((_providerId, ComplicationTypes.ShortText)); + _mc.AllowedList = allowedList; + } + catch (Exception e) + { + Assert.Fail(e.ToString()); + } + finally + { + _mc.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("Test : Gets complication ID.")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.ComplicationId A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ComplicationId_Return_Value() + { + _mc = new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + + try + { + Assert.AreEqual(_compId, _mc.ComplicationId); + } + catch (Exception e) + { + Assert.Fail(e.ToString()); + } + finally + { + _mc.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("Test : Gets complication Highlight information.")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.Highlight A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void Highlight_Return_Value() + { + _mc = new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + + try + { + _mc.Highlight = new Highlight(ShapeType.Rectangle, 1, 2, 3, 4); + Assert.IsNotNull(_mc.Highlight, "Object should not be null after initializing"); + Assert.AreEqual(ShapeType.Rectangle, _mc.Highlight.ShapeType); + Assert.AreEqual(1, _mc.Highlight.X); + Assert.AreEqual(2, _mc.Highlight.Y); + Assert.AreEqual(3, _mc.Highlight.W); + Assert.AreEqual(4, _mc.Highlight.H); + } + catch (Exception e) + { + Assert.Fail(e.ToString()); + } + finally + { + _mc.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("Test : Gets complication support events.")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.SupportEvents A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void SupportEvents_Return_Value() + { + _mc = new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventDoubleTap, _providerId, ComplicationTypes.ShortText); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + Assert.AreEqual(_mc.SupportEvents, EventTypes.EventDoubleTap); + + _mc.Dispose(); + } + + [Test] + [Category("P1")] + [Description("Test : Gets complication support types.")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Complication.SupportTypes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void SupportTypes_Return_Value() + { + _mc = new MyComplication(_compId, ComplicationTypes.ShortText | ComplicationTypes.Image | ComplicationTypes.LongText, + EventTypes.EventDoubleTap, _providerId, ComplicationTypes.ShortText); + Assert.IsNotNull(_mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(_mc, "Object should be instance of Complication"); + Assert.AreEqual(_mc.SupportTypes, ComplicationTypes.ShortText | ComplicationTypes.Image | ComplicationTypes.LongText); + + _mc.Dispose(); + } + } +} \ No newline at end of file diff --git a/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSComplicationProvider.cs b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSComplicationProvider.cs new file mode 100644 index 0000000..9b25f2f --- /dev/null +++ b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSComplicationProvider.cs @@ -0,0 +1,337 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + +namespace Tizen.Applications.WatchfaceComplication.Tests +{ + + [TestFixture] + [Description("Tizen.Applications.WatchfaceComplication Test complication provider")] + public class ComplicationProviderTests + { + private const int _compId = 1; + private const string _providerId = "Tizen.WatchfaceComplication.Tests/test"; + private const string _watchId = "org.tizen.CsharpWatch"; + public static bool _userDisposeCalled; + public static bool _updateRequested; + private static MyComplicationProvider _provider; + + class MyComplicationProvider : ComplicationProvider + { + public MyComplicationProvider(string providerId) + : base(providerId) + { + } + + protected override ComplicationData OnDataUpdateRequested(string reqestAppId, ComplicationTypes type, Bundle contextData) + { + _updateRequested = true; + return null; + } + + protected override void Dispose(bool disposing) + { + _userDisposeCalled = true; + base.Dispose(disposing); + } + } + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for complication provider TEST"); + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for complication provider TEST"); + } + + [Test] + [Category("P1")] + [Description("Test : ComplicationProvider Constructor test")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ComplicationProvider.ComplicationProvider C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + + public void ComplicationProvider_INIT() + { + var provider = new MyComplicationProvider(_providerId); + Assert.IsNotNull(provider, "Object should not be null after initializing"); + Assert.IsInstanceOf(provider, "Object should be instance of Complication"); + provider.Dispose(); + } + + [Test] + [Category("P2")] + [Description("Test : ComplicationProvider Constructor with invalid argument")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ComplicationProvider.ComplicationProvider C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ComplicationProvider_INIT_INVALID_ARGUMENT() + { + Assert.Throws(() => new MyComplicationProvider(null)); + } + + [Test] + [Category("P1")] + [Description("Test : Gets complication type of event")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ComplicationProvider.GetEventComplicationType M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetEventComplicationType_GET() + { + Bundle a = new Bundle(); + a.AddItem("__TOUCH_LAUNCH_TYPE_KEY__", ((int)ComplicationTypes.ShortText).ToString()); + + AppControl c = new AppControl(); + c.ExtraData.Add("__TOUCH_LAUNCH_DATA_KEY__", a.Encode()); + + ReceivedAppControl control = new ReceivedAppControl(c.SafeAppControlHandle); + ComplicationTypes type = ComplicationProvider.GetEventComplicationType(control); + Assert.AreEqual(type, ComplicationTypes.ShortText); + } + + [Test] + [Category("P2")] + [Description("Test : Gets complication type of event with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ComplicationProvider.GetEventComplicationType M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetEventComplicationType_ArgumentException() + { + AppControl c = new AppControl(); + ReceivedAppControl control = new ReceivedAppControl(c.SafeAppControlHandle); + Assert.Throws(() => ComplicationProvider.GetEventComplicationType(control)); + } + + [Test] + [Category("P2")] + [Description("Test : Gets complication type of event with InvalidOperationException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ComplicationProvider.GetEventComplicationType M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetEventComplicationType_InvalidOperationException() + { + AppControl c = new AppControl(); + c.ExtraData.Add("__TOUCH_LAUNCH_DATA_KEY__", "wrong format"); + ReceivedAppControl control = new ReceivedAppControl(c.SafeAppControlHandle); + Assert.Throws(() => ComplicationProvider.GetEventComplicationType(control)); + } + + [Test] + [Category("P1")] + [Description("Test : Gets context of event")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ComplicationProvider.GetEventContext M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetEventContext_GET() + { + Bundle ctx = new Bundle(); + ctx.AddItem("context", "test"); + + Bundle a = new Bundle(); + a.AddItem("__TOUCH_LAUNCH_CONTEXT_KEY__", ctx.Encode()); + + AppControl c = new AppControl(); + c.ExtraData.Add("__TOUCH_LAUNCH_DATA_KEY__", a.Encode()); + + ReceivedAppControl control = new ReceivedAppControl(c.SafeAppControlHandle); + Bundle re = ComplicationProvider.GetEventContext(control); + Assert.AreEqual(re.GetItem("context"), "test"); + } + + [Test] + [Category("P2")] + [Description("Test : Gets context of event with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ComplicationProvider.GetEventContext M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetEventContext_ArgumentException() + { + AppControl c = new AppControl(); + ReceivedAppControl control = new ReceivedAppControl(c.SafeAppControlHandle); + Assert.Throws(() => ComplicationProvider.GetEventContext(control)); + } + + [Test] + [Category("P2")] + [Description("Test : Gets context of event with InvalidOperationException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ComplicationProvider.GetEventContext M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetEventContext_InvalidOperationException() + { + AppControl c = new AppControl(); + c.ExtraData.Add("__TOUCH_LAUNCH_DATA_KEY__", "wrong format"); + ReceivedAppControl control = new ReceivedAppControl(c.SafeAppControlHandle); + Assert.Throws(() => ComplicationProvider.GetEventContext(control)); + } + + [Test] + [Category("P1")] + [Description("Test : Gets provider id of event")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ComplicationProvider.GetEventProviderId M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetEventProviderId_GET() + { + string test_provider_id = "test provider id"; + Bundle a = new Bundle(); + a.AddItem("__TOUCH_LAUNCH_PROVIDER_ID_KEY__", test_provider_id); + + AppControl c = new AppControl(); + c.ExtraData.Add("__TOUCH_LAUNCH_DATA_KEY__", a.Encode()); + + ReceivedAppControl control = new ReceivedAppControl(c.SafeAppControlHandle); + string providerid = ComplicationProvider.GetEventProviderId(control); + Assert.AreEqual(providerid, test_provider_id); + } + + [Test] + [Category("P2")] + [Description("Test : Gets provider id of event with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ComplicationProvider.GetEventProviderId M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetEventProviderId_ArgumentException() + { + AppControl c = new AppControl(); + ReceivedAppControl control = new ReceivedAppControl(c.SafeAppControlHandle); + Assert.Throws(() => ComplicationProvider.GetEventProviderId(control)); + } + + [Test] + [Category("P2")] + [Description("Test : Gets provider id of event with InvalidOperationException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ComplicationProvider.GetEventProviderId M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetEventProviderId_InvalidOperationException() + { + AppControl c = new AppControl(); + c.ExtraData.Add("__TOUCH_LAUNCH_DATA_KEY__", "wrong format"); + ReceivedAppControl control = new ReceivedAppControl(c.SafeAppControlHandle); + Assert.Throws(() => ComplicationProvider.GetEventProviderId(control)); + } + + [Test] + [Category("P1")] + [Description("Test : Gets type of event")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ComplicationProvider.GetEventType M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetEventType_GET() + { + Bundle a = new Bundle(); + a.AddItem("__TOUCH_LAUNCH_TYPE_KEY__", ((int)EventTypes.EventNone).ToString()); + + AppControl c = new AppControl(); + c.ExtraData.Add("__TOUCH_LAUNCH_DATA_KEY__", a.Encode()); + + ReceivedAppControl control = new ReceivedAppControl(c.SafeAppControlHandle); + EventTypes type = ComplicationProvider.GetEventType(control); + Assert.AreEqual(type, EventTypes.EventNone); + } + + [Test] + [Category("P1")] + [Description("Test : Notify update")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ComplicationProvider.NotifyUpdate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void NotifyUpdate_NOTIFY() + { + _provider = new MyComplicationProvider(_providerId); + Assert.IsNotNull(_provider, "Object should not be null after initializing"); + Assert.IsInstanceOf(_provider, "Object should be instance of Complication"); + try + { + _provider.NotifyUpdate(); + } + catch (Exception e) + { + Assert.Fail(e.ToString()); + } + finally + { + _provider.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("Test : Listen OnDataUpdateRequested event")] + [Property("SPEC", " Tizen.Applications.WatchfaceComplication.ComplicationProvider.OnDataUpdateRequested E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public async Task OnDataUpdateRequested_RECEIVE_EVENT() + { + _provider = new MyComplicationProvider(_providerId); + Assert.IsNotNull(_provider, "Object should not be null after initializing"); + Assert.IsInstanceOf(_provider, "Object should be instance of Complication"); + try + { + AppControl MyAppControl = new Tizen.Applications.AppControl(true); + Assert.IsNotNull(MyAppControl, "Object should not be null after initializing"); + + MyAppControl.Operation = AppControlOperations.Default; + MyAppControl.ApplicationId = _watchId; + MyAppControl.LaunchMode = AppControlLaunchMode.Single; + + AppControl.SendLaunchRequest(MyAppControl, null); + await Task.Delay(5000); + + _updateRequested = false; + _provider.NotifyUpdate(); + await Task.Delay(5000); + + Assert.IsTrue(_updateRequested); + } + catch (Exception e) + { + Assert.Fail(e.ToString()); + } + finally + { + _provider.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("Test : Gets complication provider Id information.")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ComplicationProvider.Id A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void Id_GET() + { + _provider = new MyComplicationProvider(_providerId); + Assert.IsNotNull(_provider, "Object should not be null after initializing"); + Assert.IsInstanceOf(_provider, "Object should be instance of Complication"); + Assert.AreEqual(_provider.Id, _providerId); + } + } +} + diff --git a/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSComplicationProviderSetup.cs b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSComplicationProviderSetup.cs new file mode 100644 index 0000000..6121956 --- /dev/null +++ b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSComplicationProviderSetup.cs @@ -0,0 +1,128 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + +namespace Tizen.Applications.WatchfaceComplication.Tests +{ + + [TestFixture] + [Description("Tizen.Applications.WatchfaceComplication Test complication provider setup")] + public class ComplicationProviderSetupTests + { + private const string _editorId = "org.tizen.watchface_sample_editor"; + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for complication provider setup TEST"); + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for complication provider setup TEST"); + } + + [Test] + [Category("P1")] + [Description("Test : Gets complication provider setup context test")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ComplicationProviderSetup.GetContext M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetContext_GET() + { + Bundle ctx = new Bundle(); + ctx.AddItem("context", "test"); + + AppControl c = new AppControl(); + c.ExtraData.Add("__SETUP_EDITOR_APPID_KEY__", _editorId); + c.ExtraData.Add("__SETUP_CONTEXT_DATA_KEY__", ctx.Encode()); + + ReceivedAppControl control = new ReceivedAppControl(c.SafeAppControlHandle); + Bundle re = ComplicationProviderSetup.GetContext(control); + Assert.AreEqual(re.GetItem("context"), "test"); + } + + [Test] + [Category("P2")] + [Description("Test : Gets complication provider setup context with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ComplicationProviderSetup.GetContext M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void GetContext_ArgumentException() + { + AppControl c = new AppControl(); + c.ExtraData.Add("__SETUP_CONTEXT_DATA_KEY__", "test"); + ReceivedAppControl control = new ReceivedAppControl(c.SafeAppControlHandle); + Assert.Throws(() => ComplicationProviderSetup.GetContext(control)); + } + + [Test] + [Category("P1")] + [Description("Test : Gets whether received appcontrol contains setup related info or not")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ComplicationProviderSetup.IsEditing M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void IsEditing_GET() + { + AppControl c = new AppControl(); + c.ExtraData.Add("__SETUP_EDITOR_APPID_KEY__", _editorId); + + ReceivedAppControl control = new ReceivedAppControl(c.SafeAppControlHandle); + Assert.IsTrue(ComplicationProviderSetup.IsEditing(control)); + } + + [Test] + [Category("P1")] + [Description("Test : Sends reply to editor")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ComplicationProviderSetup.ReplyToEditor M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ReplyToEditor_SEND() + { + Bundle ctx = new Bundle(); + ctx.AddItem("context", "test"); + + AppControl c = new AppControl(); + c.ExtraData.Add("__SETUP_EDITOR_APPID_KEY__", _editorId); + c.ExtraData.Add("__SETUP_CONTEXT_DATA_KEY__", ctx.Encode()); + c.ExtraData.Add("__SETUP_EDITABLE_ID_KEY__", "1"); + ReceivedAppControl control = new ReceivedAppControl(c.SafeAppControlHandle); + + Bundle newCtx = new Bundle(); + newCtx.AddItem("context", "new data"); + try + { + ComplicationProviderSetup.ReplyToEditor(control, newCtx); + } + catch (Exception e) + { + Assert.Fail(e.ToString()); + } + } + + [Test] + [Category("P2")] + [Description("Test : Sends reply to editor with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ComplicationProviderSetup.ReplyToEditor M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ReplyToEditor_ArgumentException() + { + Bundle ctx = new Bundle(); + ctx.AddItem("context", "test"); + AppControl c = new AppControl(); + ReceivedAppControl control = new ReceivedAppControl(c.SafeAppControlHandle); + Assert.Throws(() => ComplicationProviderSetup.ReplyToEditor(control, ctx)); + } + } +} \ No newline at end of file diff --git a/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSDesignElement.cs b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSDesignElement.cs new file mode 100644 index 0000000..086f430 --- /dev/null +++ b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSDesignElement.cs @@ -0,0 +1,200 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + +namespace Tizen.Applications.WatchfaceComplication.Tests +{ + + [TestFixture] + [Description("Tizen.Applications.WatchfaceComplication Test design element")] + public class DesignElementTests + { + public static string _editorId = "org.tizen.watchface_sample_editor"; + public static bool _updated; + public static string[] _colorArr = { + "YELLOW", + "RED", + "BLUE", + "GREEN" + }; + + public class MyContainer : EditablesContainer + { + private static readonly string _logTag = "DesignElementTests"; + public MyContainer() : base() + { + } + + protected override void OnEditReady(string editorId) + { + Log.Debug(_logTag, "Edit ready : " + editorId); + this.RequestEdit(); + } + } + + public class ColorDesign : DesignElement + { + public ColorDesign(IEnumerable candidates, int curDataIdx, + string editableName) + : base(candidates, curDataIdx, editableName) + { + } + + protected override void OnDesignUpdated(int selectedIdx, State state) + { + _updated = true; + } + } + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for complication provider TEST"); + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for complication provider TEST"); + } + + [Test] + [Category("P1")] + [Description("Test : DesignElement Constructor test")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.DesignElement.DesignElement C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + + public void DesignElement_INIT() + { + List candidatesList = new List(); + candidatesList.Add(new Bundle()); + + var cd = new ColorDesign(candidatesList, 0, "color"); + Assert.IsNotNull(cd, "Object should not be null after initializing"); + Assert.IsInstanceOf(cd, "Object should be instance of DesignElement"); + } + + + [Test] + [Category("P2")] + [Description("Test : DesignElement Constructor test with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.DesignElement.DesignElement C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void DesignElement_INIT_ArgumentException() + { + Assert.Throws(() => new ColorDesign(null, -1, "color")); + } + + [Test] + [Category("P1")] + [Description("Test : Listen OnDataUpdateRequested event")] + [Property("SPEC", " Tizen.Applications.WatchfaceComplication.DesignElement.OnDesignUpdated E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public async Task OnDesignUpdated_RECEIVE_EVENT() + { + MyContainer _container = new MyContainer(); + try + { + _updated = false; + List candidatesList = new List(); + Bundle data; + int curIdx = 0; + foreach (string str in _colorArr) + { + data = new Bundle(); + data.AddItem("__COLOR__", str); + candidatesList.Add(data); + } + + ColorDesign colorEdit = new ColorDesign(candidatesList, curIdx, "COLOR"); + colorEdit.Highlight = new Highlight(ShapeType.Circle, 0, 40, 10, 10); + _container.Add(colorEdit, 1); + + AppControl MyAppControl = new Tizen.Applications.AppControl(true); + Assert.IsNotNull(MyAppControl, "Object should not be null after initializing"); + + MyAppControl.Operation = AppControlOperations.Default; + MyAppControl.ApplicationId = _editorId; + MyAppControl.LaunchMode = AppControlLaunchMode.Group; + MyAppControl.ExtraData.Add("SENDER_ID", "Tizen.WatchfaceComplication.Tests"); + + Tizen.Applications.AppControl.SendLaunchRequest(MyAppControl, null); + + await Task.Delay(10000); + Assert.IsTrue(_updated); + } + catch (Exception e) + { + Assert.Fail(e.ToString()); + } + finally + { + _container.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("Test : Gets DesignElement candidates information.")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.DesignElement.Candidates A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void Candidates_GET() + { + string colorKey = "__COLOR__"; + List candidatesList = new List(); + Bundle data; + int curIdx = 0; + foreach (string str in _colorArr) + { + data = new Bundle(); + data.AddItem(colorKey, str); + candidatesList.Add(data); + } + + ColorDesign colorEdit = new ColorDesign(candidatesList, curIdx, "COLOR") + { + Highlight = new Highlight(ShapeType.Circle, 0, 40, 10, 10) + }; + + int idx = 0; + foreach (Bundle candidate in colorEdit.Candidates) + { + Assert.AreEqual(candidate.GetItem(colorKey), _colorArr[idx++]); + } + } + + [Test] + [Category("P1")] + [Description("Test : Gets DesignElement Highlight information.")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.DesignElement.Highlight A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void Highlight_GET() + { + List candidatesList = new List(); + int curIdx = 0; + + ColorDesign colorEdit = new ColorDesign(candidatesList, curIdx, "COLOR"); + colorEdit.Highlight = new Highlight(ShapeType.Circle, 0, 40, 10, 10); + Assert.AreEqual(ShapeType.Circle, colorEdit.Highlight.ShapeType); + Assert.AreEqual(0, colorEdit.Highlight.X); + Assert.AreEqual(40, colorEdit.Highlight.Y); + Assert.AreEqual(10, colorEdit.Highlight.W); + Assert.AreEqual(10, colorEdit.Highlight.H); + } + } +} \ No newline at end of file diff --git a/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSEditablesContainer.cs b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSEditablesContainer.cs new file mode 100644 index 0000000..3a32c03 --- /dev/null +++ b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSEditablesContainer.cs @@ -0,0 +1,477 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + +namespace Tizen.Applications.WatchfaceComplication.Tests +{ + + [TestFixture] + [Description("Tizen.Applications.WatchfaceComplication Test editables container")] + public class EditablesContainerTest + { + public static string[] _colorArr = { + "YELLOW", + "RED", + "BLUE", + "GREEN" + }; + private const string _providerId = "org.tizen.ComplicationProviderCsharp/battery"; + public static bool _userDisposeCalled; + public static bool _editReady; + public static string _editorId = "org.tizen.watchface_sample_editor"; + + public class MyContainer : EditablesContainer + { + public MyContainer() : base() + { + } + + protected override void OnEditReady(string editorId) + { + _editReady = true; + } + + protected override void Dispose(bool disposing) + { + _userDisposeCalled = true; + base.Dispose(disposing); + } + } + + public class ColorDesign : DesignElement + { + public ColorDesign(IEnumerable candidates, int curDataIdx, + string editableName) + : base(candidates, curDataIdx, editableName) + { + } + + protected override void OnDesignUpdated(int selectedIdx, State state) + { + } + } + + class MyComplication : Complication + { + public MyComplication(int complicationId, ComplicationTypes supportTypes, EventTypes supportEvents, string defaultProviderId, + ComplicationTypes defaultType) + : base(complicationId, supportTypes, supportEvents, defaultProviderId, defaultType) + { + } + + protected override void OnComplicationUpdated(string providerId, ComplicationTypes type, Bundle data) + { + + } + } + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for complication provider TEST"); + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for complication provider TEST"); + } + + [Test] + [Category("P1")] + [Description("Test : EditablesContainer Constructor test")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.EditablesContainer.EditablesContainer C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + + public void EditablesContainer_INIT() + { + var mc = new MyContainer(); + Assert.IsNotNull(mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(mc, "Object should be instance of EditablesContainer"); + mc.Dispose(); + } + + [Test] + [Category("P1")] + [Description("Test : Adds design element to editable container")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.EditablesContainer.Add M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + [Property("COVPARAM", "Tizen.Applications.WatchfaceComplication.DesignElement, int")] + public void Add_DESIGN_ELEMENT() + { + MyContainer mc = new MyContainer(); + try + { + Assert.IsNotNull(mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(mc, "Object should be instance of EditablesContainer"); + + List candidatesList = new List(); + Bundle data; + int curIdx = 0; + int editId = 1; + foreach (string str in _colorArr) + { + data = new Bundle(); + data.AddItem("__COLOR__", str); + candidatesList.Add(data); + } + + ColorDesign colorEdit = new ColorDesign(candidatesList, curIdx, "COLOR") + { + Highlight = new Highlight(ShapeType.Circle, 0, 40, 10, 10) + }; + mc.Add(colorEdit, editId); + Assert.IsTrue(mc.IsExist(editId)); + } + catch (Exception e) + { + Assert.Fail(e.ToString()); + } + finally + { + mc.Dispose(); + } + } + + [Test] + [Category("P2")] + [Description("Test : Adds design element to editable container with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.EditablesContainer.Add M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + [Property("COVPARAM", "Tizen.Applications.WatchfaceComplication.DesignElement, int")] + public void Add_DESIGN_ELEMENT_ArgumentException() + { + MyContainer mc = new MyContainer(); + ColorDesign cd = null; + Assert.Throws(() => mc.Add(cd, 1)); + } + + [Test] + [Category("P2")] + [Description("Test : Adds design element to editable container with InvalidOperationException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.EditablesContainer.Add M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + [Property("COVPARAM", "Tizen.Applications.WatchfaceComplication.DesignElement, int")] + public void Add_DESIGN_ELEMENT_InvalidOperationException() + { + MyContainer mc = new MyContainer(); + List candidatesList = new List(); + Bundle data; + int curIdx = 0; + foreach (string str in _colorArr) + { + data = new Bundle(); + data.AddItem("__COLOR__", str); + candidatesList.Add(data); + } + + ColorDesign colorEdit = new ColorDesign(candidatesList, curIdx, "COLOR") + { + Highlight = new Highlight(ShapeType.Circle, 0, 40, 10, 10) + }; + mc.Add(colorEdit, 1); + Assert.Throws(() => mc.Add(colorEdit, 1)); + } + + [Test] + [Category("P1")] + [Description("Test : Adds complication to editable container")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.EditablesContainer.Add M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + [Property("COVPARAM", "Tizen.Applications.WatchfaceComplication.Complication, int")] + public void Add_COMPLICATION() + { + int compId = 2; + MyContainer mc = new MyContainer(); + MyComplication comp = new MyComplication(compId, ComplicationTypes.ShortText, EventTypes.EventNone, _providerId, ComplicationTypes.ShortText); + try + { + Assert.IsNotNull(mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(mc, "Object should be instance of EditablesContainer"); + + int editid = 2; + mc.Add(comp, editid); + Assert.IsTrue(mc.IsExist(editid)); + } + catch (Exception e) + { + Assert.Fail(e.ToString()); + } + finally + { + mc.Dispose(); + comp.Dispose(); + } + } + + [Test] + [Category("P2")] + [Description("Test : Adds complication to editable container with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.EditablesContainer.Add M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + [Property("COVPARAM", "Tizen.Applications.WatchfaceComplication.Complication, int")] + public void Add_COMPLICATION_ArgumentException() + { + MyContainer mc = new MyContainer(); + MyComplication comp = null; + Assert.Throws(() => mc.Add(comp, 1)); + } + + [Test] + [Category("P2")] + [Description("Test : Adds complication to editable container with InvalidOperationException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.EditablesContainer.Add M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + [Property("COVPARAM", "Tizen.Applications.WatchfaceComplication.DesignElement, int")] + public void Add_COMPLICATION_InvalidOperationException() + { + MyContainer mc = new MyContainer(); + MyComplication comp = new MyComplication(1, ComplicationTypes.ShortText, EventTypes.EventNone, _providerId, ComplicationTypes.ShortText); + mc.Add(comp, 1); + Assert.Throws(() => mc.Add(comp, 1)); + } + + [Test] + [Category("P1")] + [Description("Test : Check Dispose API returns correct value")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.EditablesContainer.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void Dispose_DISPOSE_OBJECT() + { + MyContainer mc = new MyContainer(); + Assert.IsNotNull(mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(mc, "Object should be instance of EditablesContainer"); + + try + { + mc.Dispose(); + } + catch (Exception e) + { + Assert.Fail(e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test : Check Dispose API returns correct value")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.EditablesContainer.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + [Property("COVPARAM", "bool")] + public void Dispose_DISPOSE_OBJECT_WITH_PARAM() + { + MyContainer mc = new MyContainer(); + Assert.IsNotNull(mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(mc, "Object should be instance of EditablesContainer"); + mc.Dispose(); + + Assert.IsTrue(_userDisposeCalled); + } + + [Test] + [Category("P1")] + [Description("Test : Checks whether specific editable id is already exist in editable container or not")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.EditablesContainer.IsExist M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void IsExist_CHECK() + { + MyContainer mc = new MyContainer(); + try + { + Assert.IsNotNull(mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(mc, "Object should be instance of EditablesContainer"); + Assert.IsFalse(mc.IsExist(7)); + } + catch (Exception e) + { + Assert.Fail(e.ToString()); + } + finally + { + mc.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("Test : Gets editable's current data")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.EditablesContainer.LoadCurrentData M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void LoadCurrentData_GET() + { + try + { + MyContainer.LoadCurrentData(0); + } + catch (Exception e) + { + Assert.Fail(e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test : Listen OnEditReady event")] + [Property("SPEC", " Tizen.Applications.WatchfaceComplication.EditablesContainer.OnEditReady E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public async Task OnEditReady_RECEIVE_EVENT() + { + _editReady = false; + MyContainer mc = new MyContainer(); + try + { + Assert.IsNotNull(mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(mc, "Object should be instance of EditablesContainer"); + + List candidatesList = new List(); + int curIdx = 0; + + ColorDesign colorEdit = new ColorDesign(candidatesList, curIdx, "COLOR"); + mc.Add(colorEdit, 1); + + AppControl MyAppControl = new Tizen.Applications.AppControl(true); + Assert.IsNotNull(MyAppControl, "Object should not be null after initializing"); + + MyAppControl.Operation = AppControlOperations.Default; + MyAppControl.ApplicationId = _editorId; + MyAppControl.LaunchMode = AppControlLaunchMode.Group; + MyAppControl.ExtraData.Add("SENDER_ID", "Tizen.WatchfaceComplication.Tests"); + + Tizen.Applications.AppControl.SendLaunchRequest(MyAppControl, null); + + await Task.Delay(10000); + Assert.IsTrue(_editReady); + } + catch (Exception e) + { + Assert.Fail(e.ToString()); + } + finally + { + mc.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("Test : Removes editable from editables container")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.EditablesContainer.Remove M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void Remove_EDITABLE() + { + MyContainer mc = new MyContainer(); + try + { + Assert.IsNotNull(mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(mc, "Object should be instance of EditablesContainer"); + + List candidatesList = new List(); + int curIdx = 0; + + ColorDesign colorEdit = new ColorDesign(candidatesList, curIdx, "COLOR"); + mc.Add(colorEdit, 1); + mc.Remove(1); + Assert.IsFalse(mc.IsExist(1)); + } + catch (Exception e) + { + Assert.Fail(e.ToString()); + } + finally + { + mc.Dispose(); + } + } + + [Test] + [Category("P2")] + [Description("Test : Removes editable from editables container with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.EditablesContainer.Remove M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void Remove_EDITABLE_ArgumentException() + { + MyContainer mc = new MyContainer(); + Assert.Throws(() => mc.Remove(1)); + } + + [Test] + [Category("P1")] + [Description("Test : Requests edit to editor")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.EditablesContainer.RequestEdit M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public async Task RequestEdit_SEND() + { + _editReady = false; + MyContainer mc = new MyContainer(); + try + { + Assert.IsNotNull(mc, "Object should not be null after initializing"); + Assert.IsInstanceOf(mc, "Object should be instance of EditablesContainer"); + + List candidatesList = new List(); + int curIdx = 0; + + ColorDesign colorEdit = new ColorDesign(candidatesList, curIdx, "COLOR"); + mc.Add(colorEdit, 1); + + AppControl MyAppControl = new Tizen.Applications.AppControl(true); + Assert.IsNotNull(MyAppControl, "Object should not be null after initializing"); + + MyAppControl.Operation = AppControlOperations.Default; + MyAppControl.ApplicationId = _editorId; + MyAppControl.LaunchMode = AppControlLaunchMode.Group; + MyAppControl.ExtraData.Add("SENDER_ID", "Tizen.WatchfaceComplication.Tests"); + + AppControl.SendLaunchRequest(MyAppControl, null); + + await Task.Delay(10000); + Assert.IsTrue(_editReady); + + mc.RequestEdit(); + } + catch (Exception e) + { + Assert.Fail(e.ToString()); + } + finally + { + mc.Dispose(); + } + } + } +} diff --git a/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSHighlight.cs b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSHighlight.cs new file mode 100644 index 0000000..abc93c3 --- /dev/null +++ b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSHighlight.cs @@ -0,0 +1,184 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + +namespace Tizen.Applications.WatchfaceComplication.Tests +{ + + [TestFixture] + [Description("Tizen.Applications.WatchfaceComplication Test highlight")] + public class HighlightTests + { + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for complication provider TEST"); + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for complication provider TEST"); + } + + [Test] + [Category("P1")] + [Description("Test : Highlight Constructor test")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Highlight.Highlight C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + + public void Highlight_INIT() + { + var hi = new Highlight(ShapeType.Circle, 0, 0, 10, 10); + Assert.IsNotNull(hi, "Object should not be null after initializing"); + Assert.IsInstanceOf(hi, "Object should be instance of Highlight"); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether H is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Highlight.H A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void H_GET_SET() + { + Highlight hi = new Highlight(ShapeType.Circle, 10, 20, 30, 40); + Assert.IsNotNull(hi, "Object should not be null after initializing"); + Assert.IsInstanceOf(hi, "Object should be instance of Highlight"); + hi.H = 20; + Assert.AreEqual(20, hi.H); + } + + [Test] + [Category("P2")] + [Description("Test : Sets Highlight height information with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Highlight.H A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void H_SET_ArgumentException() + { + Highlight hi = new Highlight(ShapeType.Circle, 10, 20, 30, 40); + Assert.IsNotNull(hi, "Object should not be null after initializing"); + Assert.IsInstanceOf(hi, "Object should be instance of Highlight"); + Assert.Throws(() => hi.H = -1); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether W is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Highlight.W A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void W_GET_SET() + { + Highlight hi = new Highlight(ShapeType.Circle, 10, 20, 30, 40); + Assert.IsNotNull(hi, "Object should not be null after initializing"); + Assert.IsInstanceOf(hi, "Object should be instance of Highlight"); + hi.W = 20; + Assert.AreEqual(20, hi.W); + } + + [Test] + [Category("P2")] + [Description("Test : Sets Highlight width information with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Highlight.W A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void W_SET_ArgumentException() + { + Highlight hi = new Highlight(ShapeType.Circle, 10, 20, 30, 40); + Assert.IsNotNull(hi, "Object should not be null after initializing"); + Assert.IsInstanceOf(hi, "Object should be instance of Highlight"); + Assert.Throws(() => hi.W = -1); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether X is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Highlight.X A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void X_GET_SET() + { + Highlight hi = new Highlight(ShapeType.Circle, 10, 20, 30, 40); + Assert.IsNotNull(hi, "Object should not be null after initializing"); + Assert.IsInstanceOf(hi, "Object should be instance of Highlight"); + hi.X = 70; + Assert.AreEqual(70, hi.X); + } + + [Test] + [Category("P2")] + [Description("Test : Sets Highlight X position information with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Highlight.X A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void X_SET_ArgumentException() + { + Highlight hi = new Highlight(ShapeType.Circle, 10, 20, 30, 40); + Assert.IsNotNull(hi, "Object should not be null after initializing"); + Assert.IsInstanceOf(hi, "Object should be instance of Highlight"); + Assert.Throws(() => hi.X = -1); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether Y is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Highlight.Y A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void Y_GET_SET() + { + Highlight hi = new Highlight(ShapeType.Circle, 10, 20, 30, 40); + Assert.IsNotNull(hi, "Object should not be null after initializing"); + Assert.IsInstanceOf(hi, "Object should be instance of Highlight"); + hi.Y = 70; + Assert.AreEqual(70, hi.Y); + } + + [Test] + [Category("P2")] + [Description("Test : Sets Highlight Y position information with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Highlight.Y A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void Y_SET_ArgumentException() + { + Highlight hi = new Highlight(ShapeType.Circle, 10, 20, 30, 40); + Assert.IsNotNull(hi, "Object should not be null after initializing"); + Assert.IsInstanceOf(hi, "Object should be instance of Highlight"); + Assert.Throws(() => hi.Y = -1); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether ShapeType is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.Highlight.ShapeType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ShapeType_GET_SET() + { + Highlight hi = new Highlight(ShapeType.Rectangle, 10, 20, 30, 40); + Assert.IsNotNull(hi, "Object should not be null after initializing"); + Assert.IsInstanceOf(hi, "Object should be instance of Highlight"); + hi.ShapeType = ShapeType.Circle; + Assert.AreEqual(ShapeType.Circle, hi.ShapeType); + } + } +} \ No newline at end of file diff --git a/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSIconData.cs b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSIconData.cs new file mode 100644 index 0000000..21992d2 --- /dev/null +++ b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSIconData.cs @@ -0,0 +1,126 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + +namespace Tizen.Applications.WatchfaceComplication.Tests +{ + + [TestFixture] + [Description("Tizen.Applications.WatchfaceComplication Test icon data")] + public class IconDataTests + { + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for complication provider TEST"); + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for complication provider TEST"); + } + + [Test] + [Category("P1")] + [Description("Test : IconData Constructor test")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.IconData.IconData C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + + public void IconData_INIT() + { + var id = new IconData("path", null); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of IconData"); + } + + [Test] + [Category("P2")] + [Description("Test : IconData Constructor test with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.IconData.IconData C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + + public void IconData_INIT_ArgumentException() + { + Assert.Throws(() => new IconData(null, null)); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether ExtraData is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.IconData.ExtraData A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ExtraData_GET_SET() + { + Bundle ctx = new Bundle(); + ctx.AddItem("context", "test"); + + IconData id = new IconData("path", ctx.Encode()); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of IconData"); + Bundle ctx2 = new Bundle(); + ctx2.AddItem("context", "test2"); + id.ExtraData = ctx2.Encode(); + Assert.AreEqual(id.ExtraData, ctx2.Encode()); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether IconData is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.IconData.IconPath A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void IconPath_GET_SET() + { + IconData id = new IconData("path", null); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of IconData"); + id.IconPath = "test"; + Assert.AreEqual("test", id.IconPath); + } + + [Test] + [Category("P2")] + [Description("Test : Sets Highlight icon path information with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.IconData.IconPath A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void IconPath_SET_ArgumentException() + { + IconData id = new IconData("path", null); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of IconData"); + Assert.Throws(() => id.IconPath = null); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether ScreenReaderText is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.IconData.ScreenReaderText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ScreenReaderText_GET_SET() + { + IconData id = new IconData("path", null); + id.ScreenReaderText = "screen reader text"; + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of IconData"); + id.ScreenReaderText = "test"; + Assert.AreEqual("test", id.ScreenReaderText); + } + } +} \ No newline at end of file diff --git a/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSImageData.cs b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSImageData.cs new file mode 100644 index 0000000..869d99b --- /dev/null +++ b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSImageData.cs @@ -0,0 +1,128 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + +namespace Tizen.Applications.WatchfaceComplication.Tests +{ + + [TestFixture] + [Description("Tizen.Applications.WatchfaceComplication Test image data")] + public class ImageDataTests + { + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for complication provider TEST"); + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for complication provider TEST"); + } + + [Test] + [Category("P1")] + [Description("Test : ImageData Constructor test")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ImageData.ImageData C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + + public void ImageData_INIT() + { + var id = new ImageData("path", null); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of ImageData"); + } + + [Test] + [Category("P2")] + [Description("Test : ImageData Constructor test with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ImageData.ImageData C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + + public void ImageData_INIT_ArgumentException() + { + Assert.Throws(() => new ImageData(null, null)); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether ExtraData is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ImageData.ExtraData A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ExtraData_GET_SET() + { + Bundle ctx = new Bundle(); + ctx.AddItem("context", "test"); + + ImageData id = new ImageData("path", ctx.Encode()); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of ImageData"); + Bundle ctx2 = new Bundle(); + ctx2.AddItem("context", "test"); + id.ExtraData = ctx2.Encode(); + Assert.AreEqual(id.ExtraData, ctx2.Encode()); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether ImagePath is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ImageData.ImagePath A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ImagePath_GET_SET() + { + ImageData id = new ImageData("path", null); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of ImageData"); + id.ImagePath = "test"; + Assert.AreEqual("test", id.ImagePath); + } + + [Test] + [Category("P2")] + [Description("Test : Sets Highlight image path information with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ImageData.ImagePath A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ImagePath_SET_ArgumentException() + { + ImageData id = new ImageData("path", null); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of ImageData"); + Assert.Throws(() => id.ImagePath = null); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether ScreenReaderText is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ImageData.ScreenReaderText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ScreenReaderText_GET_SET() + { + ImageData id = new ImageData("path", null) + { + ScreenReaderText = "screen reader text" + }; + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of ImageData"); + id.ScreenReaderText = "test"; + Assert.AreEqual("test", id.ScreenReaderText); + } + } +} \ No newline at end of file diff --git a/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSLongTextData.cs b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSLongTextData.cs new file mode 100644 index 0000000..80dcba9 --- /dev/null +++ b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSLongTextData.cs @@ -0,0 +1,159 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + +namespace Tizen.Applications.WatchfaceComplication.Tests +{ + + [TestFixture] + [Description("Tizen.Applications.WatchfaceComplication Test long text data")] + public class LongTextDataTests + { + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for complication provider TEST"); + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for complication provider TEST"); + } + + [Test] + [Category("P1")] + [Description("Test : LongTextData constructor test")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.LongTextData.LongTextData C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + + public void LongTextData_INIT() + { + var ltd = new LongTextData("long text", "path", "title", null); + Assert.IsNotNull(ltd, "Object should not be null after initializing"); + Assert.IsInstanceOf(ltd, "Object should be instance of LongTextData"); + } + + [Test] + [Category("P2")] + [Description("Test : LongTextData Constructor test with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.LongTextData.LongTextData C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + + public void LongTextData_INIT_ArgumentException() + { + Assert.Throws(() => new LongTextData(null, "path", "title", null)); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether ExtraData is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.LongTextData.ExtraData A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ExtraData_GET_SET() + { + Bundle ctx = new Bundle(); + ctx.AddItem("context", "test"); + + LongTextData ltd = new LongTextData("text", "iconpath", "title", ctx.Encode()); + Assert.IsNotNull(ltd, "Object should not be null after initializing"); + Assert.IsInstanceOf(ltd, "Object should be instance of LongTextData"); + Bundle ctx2 = new Bundle(); + ctx2.AddItem("context", "test2"); + + ltd.ExtraData = ctx2.Encode(); + Assert.AreEqual(ltd.ExtraData, ctx2.Encode()); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether IconPath is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.LongTextData.IconPath A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void IconPath_GET_SET() + { + LongTextData ltd = new LongTextData("long text", "path", "title", null); + Assert.IsNotNull(ltd, "Object should not be null after initializing"); + Assert.IsInstanceOf(ltd, "Object should be instance of LongTextData"); + ltd.IconPath = "test"; + Assert.AreEqual("test", ltd.IconPath); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether Title is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.LongTextData.Title A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void Title_GET_SET() + { + LongTextData ltd = new LongTextData("long text", "path", "title", null); + Assert.IsNotNull(ltd, "Object should not be null after initializing"); + Assert.IsInstanceOf(ltd, "Object should be instance of LongTextData"); + ltd.Title = "test"; + Assert.AreEqual("test", ltd.Title); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether LongText is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.LongTextData.LongText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void LongText_GET_SET() + { + LongTextData id = new LongTextData("long text", "path", "title", null); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of LongTextData"); + id.LongText = "test"; + Assert.AreEqual("test", id.LongText); + } + + [Test] + [Category("P2")] + [Description("Test : Sets Highlight long path information with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.LongTextData.LongText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void LongText_SET_ArgumentException() + { + LongTextData id = new LongTextData("long text", "path", "title", null); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of LongTextData"); + Assert.Throws(() => id.LongText = null); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether ScreenReaderText is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.LongTextData.ScreenReaderText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ScreenReaderText_GET_SET() + { + LongTextData ltd = new LongTextData("long text", "path", "title", null); + ltd.ScreenReaderText = "screen reader text"; + Assert.IsNotNull(ltd, "Object should not be null after initializing"); + Assert.IsInstanceOf(ltd, "Object should be instance of LongTextData"); + ltd.ScreenReaderText = "test"; + Assert.AreEqual("test", ltd.ScreenReaderText); + } + } +} \ No newline at end of file diff --git a/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSRangedValueData.cs b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSRangedValueData.cs new file mode 100644 index 0000000..a6aec10 --- /dev/null +++ b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSRangedValueData.cs @@ -0,0 +1,253 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + +namespace Tizen.Applications.WatchfaceComplication.Tests +{ + + [TestFixture] + [Description("Tizen.Applications.WatchfaceComplication Test ranged value data")] + public class RangedValueDataTests + { + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for complication provider TEST"); + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for complication provider TEST"); + } + + [Test] + [Category("P1")] + [Description("Test : RangedValueData constructor test")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.RangedValueData.RangedValueData C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + + public void RangedValueData_INIT() + { + var rvd = new RangedValueData(50, 1, 100, "text", "path", "title", null); + Assert.IsNotNull(rvd, "Object should not be null after initializing"); + Assert.IsInstanceOf(rvd, "Object should be instance of RangedValueData"); + } + + [Test] + [Category("P2")] + [Description("Test : RangedValueData Constructor test with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.RangedValueData.RangedValueData C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + + public void RangedValueData_INIT_ArgumentException() + { + Assert.Throws(() => new RangedValueData(200, 1, 100, "text", "path", "title", null)); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether ExtraData is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.RangedValueData.ExtraData A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ExtraData_GET_SET() + { + Bundle ctx = new Bundle(); + ctx.AddItem("context", "test"); + + RangedValueData rvd = new RangedValueData(50, 1, 100, "text", "path", "title", ctx.Encode()); + Assert.IsNotNull(rvd, "Object should not be null after initializing"); + Assert.IsInstanceOf(rvd, "Object should be instance of RangedValueData"); + + Bundle ctx2 = new Bundle(); + ctx2.AddItem("context", "test2"); + rvd.ExtraData = ctx2.Encode(); + + Assert.AreEqual(rvd.ExtraData, ctx2.Encode()); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether IconPath is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.RangedValueData.IconPath A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void IconPath_GET_SET() + { + RangedValueData rvd = new RangedValueData(50, 1, 100, "text", "path", "title", null); + Assert.IsNotNull(rvd, "Object should not be null after initializing"); + Assert.IsInstanceOf(rvd, "Object should be instance of RangedValueData"); + rvd.IconPath = "test"; + Assert.AreEqual("test", rvd.IconPath); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether Title is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.RangedValueData.Title A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void Title_GET_SET() + { + RangedValueData rvd = new RangedValueData(50, 1, 100, "text", "path", "title", null); + Assert.IsNotNull(rvd, "Object should not be null after initializing"); + Assert.IsInstanceOf(rvd, "Object should be instance of RangedValueData"); + rvd.Title = "test"; + Assert.AreEqual("test", rvd.Title); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether ShortText is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.RangedValueData.ShortText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ShortText_GET_SET() + { + RangedValueData id = new RangedValueData(50, 1, 100, "text", "path", "title", null); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of RangedValueData"); + id.ShortText = "test"; + Assert.AreEqual("test", id.ShortText); + } + + [Test] + [Category("P2")] + [Description("Test : Sets Highlight long path information with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.RangedValueData.ShortText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ShortText_SET_ArgumentException() + { + RangedValueData id = new RangedValueData(50, 1, 100, "text", "path", "title", null); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of RangedValueData"); + Assert.Throws(() => id.ShortText = null); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether RangeCurrent is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.RangedValueData.RangeCurrent A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void RangeCurrent_GET_SET() + { + RangedValueData id = new RangedValueData(50, 1, 100, "text", "path", "title", null); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of RangedValueData"); + id.RangeCurrent = 10; + Assert.AreEqual(10, id.RangeCurrent); + } + + [Test] + [Category("P2")] + [Description("Test : Sets RangedValueData current value information with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.RangedValueData.RangeCurrent A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void RangeCurrent_SET_ArgumentException() + { + RangedValueData id = new RangedValueData(50, 1, 100, "text", "path", "title", null); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of RangedValueData"); + Assert.Throws(() => id.RangeCurrent = -1); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether RangeMax is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.RangedValueData.RangeMax A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void RangeMax_GET_SET() + { + RangedValueData id = new RangedValueData(50, 1, 100, "text", "path", "title", null); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of RangedValueData"); + id.RangeMax = 60; + Assert.AreEqual(60, id.RangeMax); + } + + [Test] + [Category("P2")] + [Description("Test : Check whether RangeMin is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.RangedValueData.RangeMax A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void RangeMax_SET_ArgumentException() + { + RangedValueData id = new RangedValueData(50, 1, 100, "text", "path", "title", null); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of RangedValueData"); + Assert.Throws(() => id.RangeMax = -1); + } + + [Test] + [Category("P1")] + [Description("Test : Sets RangedValueData max value information")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.RangedValueData.RangeMin A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void RangeMin_GET_SET() + { + RangedValueData id = new RangedValueData(50, 1, 100, "text", "path", "title", null); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of RangedValueData"); + id.RangeMin = 10; + Assert.AreEqual(10, id.RangeMin); + } + + [Test] + [Category("P2")] + [Description("Test : Sets RangedValueData max value information with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.RangedValueData.RangeMin A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void RangeMin_SET_ArgumentException() + { + RangedValueData id = new RangedValueData(50, 1, 100, "text", "path", "title", null); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of RangedValueData"); + Assert.Throws(() => id.RangeMin = 100); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether ScreenReaderText is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.RangedValueData.ScreenReaderText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ScreenReaderText_GET_SET() + { + RangedValueData rvd = new RangedValueData(50, 1, 100, "text", "path", "title", null); + Assert.IsNotNull(rvd, "Object should not be null after initializing"); + Assert.IsInstanceOf(rvd, "Object should be instance of RangedValueData"); + rvd.ScreenReaderText = "test"; + Assert.AreEqual("test", rvd.ScreenReaderText); + } + } +} + diff --git a/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSShortTextData.cs b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSShortTextData.cs new file mode 100644 index 0000000..d7045ce --- /dev/null +++ b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSShortTextData.cs @@ -0,0 +1,157 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + +namespace Tizen.Applications.WatchfaceComplication.Tests +{ + + [TestFixture] + [Description("Tizen.Applications.WatchfaceComplication Test short text data")] + public class ShortTextDataTests + { + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for complication provider TEST"); + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for complication provider TEST"); + } + + [Test] + [Category("P1")] + [Description("Test : ShortTextData constructor test")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ShortTextData.ShortTextData C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + + public void ShortTextData_INIT() + { + var std = new ShortTextData("short text", "path", "title", null); + Assert.IsNotNull(std, "Object should not be null after initializing"); + Assert.IsInstanceOf(std, "Object should be instance of ShortTextData"); + } + + [Test] + [Category("P2")] + [Description("Test : ShortTextData Constructor test with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ShortTextData.ShortTextData C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + + public void ShortTextData_INIT_ArgumentException() + { + Assert.Throws(() => new ShortTextData(null, "path", "title", null)); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether ExtraData is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ShortTextData.ExtraData A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ExtraData_GET_SET() + { + Bundle ctx = new Bundle(); + ctx.AddItem("context", "test"); + + ShortTextData std = new ShortTextData("short text", "path", "title", ctx.Encode()); + Assert.IsNotNull(std, "Object should not be null after initializing"); + Assert.IsInstanceOf(std, "Object should be instance of ShortTextData"); + Bundle ctx2 = new Bundle(); + ctx2.AddItem("context", "test2"); + std.ExtraData = ctx2.Encode(); + Assert.AreEqual(std.ExtraData, ctx2.Encode()); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether IconPath is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ShortTextData.IconPath A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void IconPath_GET_SET() + { + ShortTextData std = new ShortTextData("short text", "path", "title", null); + Assert.IsNotNull(std, "Object should not be null after initializing"); + Assert.IsInstanceOf(std, "Object should be instance of ShortTextData"); + std.IconPath = "test"; + Assert.AreEqual("test", std.IconPath); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether Title is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ShortTextData.Title A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void Title_GET_SET() + { + ShortTextData std = new ShortTextData("short text", "path", "title", null); + Assert.IsNotNull(std, "Object should not be null after initializing"); + Assert.IsInstanceOf(std, "Object should be instance of ShortTextData"); + std.Title = "test"; + Assert.AreEqual("test", std.Title); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether ShortText is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ShortTextData.ShortText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ShortText_GET_SET() + { + ShortTextData id = new ShortTextData("short text", "path", "title", null); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of ShortTextData"); + id.ShortText = "test"; + Assert.AreEqual("test", id.ShortText); + } + + [Test] + [Category("P2")] + [Description("Test : Sets ShortTextData short text information with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ShortTextData.ShortText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ShortText_SET_ArgumentException() + { + ShortTextData id = new ShortTextData("short text", "path", "title", null); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of ShortTextData"); + Assert.Throws(() => id.ShortText = null); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether ScreenReaderText is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.ShortTextData.ScreenReaderText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ScreenReaderText_GET_SET() + { + ShortTextData std = new ShortTextData("short text", "path", "title", null); + Assert.IsNotNull(std, "Object should not be null after initializing"); + Assert.IsInstanceOf(std, "Object should be instance of ShortTextData"); + std.ScreenReaderText = "test"; + Assert.AreEqual("test", std.ScreenReaderText); + } + } +} \ No newline at end of file diff --git a/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSTimeData.cs b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSTimeData.cs new file mode 100644 index 0000000..6f224df --- /dev/null +++ b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSTimeData.cs @@ -0,0 +1,142 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + +namespace Tizen.Applications.WatchfaceComplication.Tests +{ + + [TestFixture] + [Description("Tizen.Applications.WatchfaceComplication Test time data")] + public class TimeDataTests + { + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for complication provider TEST"); + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for complication provider TEST"); + } + + [Test] + [Category("P1")] + [Description("Test : TimeData constructor test")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.TimeData.TimeData C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + + public void TimeData_INIT() + { + var td = new TimeData(10, "path", null); + Assert.IsNotNull(td, "Object should not be null after initializing"); + Assert.IsInstanceOf(td, "Object should be instance of TimeData"); + } + + [Test] + [Category("P2")] + [Description("Test : TimeData Constructor test with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.TimeData.TimeData C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + + public void TimeData_INIT_ArgumentException() + { + Assert.Throws(() => new TimeData(-1, "path", null)); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether ExtraData is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.TimeData.ExtraData A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ExtraData_GET_SET() + { + Bundle ctx = new Bundle(); + ctx.AddItem("context", "test"); + + TimeData td = new TimeData(10, "path", ctx.Encode()); + Assert.IsNotNull(td, "Object should not be null after initializing"); + Assert.IsInstanceOf(td, "Object should be instance of TimeData"); + Bundle ctx2 = new Bundle(); + ctx2.AddItem("context", "test2"); + td.ExtraData = ctx2.Encode(); + + Assert.AreEqual(td.ExtraData, ctx2.Encode()); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether IconPath is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.TimeData.IconPath A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void IconPath_GET_SET() + { + TimeData td = new TimeData(10, "path", null); + Assert.IsNotNull(td, "Object should not be null after initializing"); + Assert.IsInstanceOf(td, "Object should be instance of TimeData"); + td.IconPath = "test"; + Assert.AreEqual("test", td.IconPath); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether Timestamp is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.TimeData.Timestamp A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void Timestamp_GET_SET() + { + TimeData id = new TimeData(10, "path", null); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of TimeData"); + id.Timestamp = 30; + Assert.AreEqual(30, id.Timestamp); + } + + [Test] + [Category("P2")] + [Description("Test : Sets Highlight TimeData timestamp information with ArgumentException")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.TimeData.Timestamp A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void Timestamp_SET_ArgumentException() + { + TimeData id = new TimeData(10, "path", null); + Assert.IsNotNull(id, "Object should not be null after initializing"); + Assert.IsInstanceOf(id, "Object should be instance of TimeData"); + Assert.Throws(() => id.Timestamp = -1); + } + + [Test] + [Category("P1")] + [Description("Test : Check whether ScreenReaderText is readable and writable")] + [Property("SPEC", "Tizen.Applications.WatchfaceComplication.TimeData.ScreenReaderText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")] + public void ScreenReaderText_GET_SET() + { + TimeData td = new TimeData(10, "path", null); + Assert.IsNotNull(td, "Object should not be null after initializing"); + Assert.IsInstanceOf(td, "Object should be instance of TimeData"); + td.ScreenReaderText = "screen reader text"; + Assert.AreEqual("screen reader text", td.ScreenReaderText); + } + } +} \ No newline at end of file diff --git a/tct-suite-vs/Tizen.WatchfaceComplication.Tests/tizen-manifest.xml b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/tizen-manifest.xml new file mode 100644 index 0000000..46c55f5 --- /dev/null +++ b/tct-suite-vs/Tizen.WatchfaceComplication.Tests/tizen-manifest.xml @@ -0,0 +1,53 @@ + + + + + Tizen.WatchfaceComplication.Tests.png + + + + + 10 + + + 10 + + + 10 + 100 + 30 + + + iconicon + + + imageimage + + + 10 + 20 + 15 + + + 60 + + tap + + + + + + + + + + + + http://tizen.org/privilege/appmanager.launch + http://tizen.org/privilege/datasharing + +