[WidgetControl][TCSACR-325][Add TC for new property SetupAppId] 64/237564/7
authorSukHyung, Kang <shine.kang@samsung.com>
Wed, 1 Jul 2020 08:55:22 +0000 (17:55 +0900)
committerSukHyung, Kang <shine.kang@samsung.com>
Tue, 11 Aug 2020 05:05:51 +0000 (14:05 +0900)
Add new TC for new property SetupAppId
- positive TC to get the property
- negative TC for exception
- TC test app is added that has SetupAppId attribute

Change-Id: I6c9774f974c7124b515d9952c5d069d6a1928f17
Signed-off-by: SukHyung, Kang <shine.kang@samsung.com>
tct-suite-vs/Resource/Tizen.WidgetControl.Tests/org.tizen.WidgetCtrlSample2-1.0.0.tpk [new file with mode: 0755]
tct-suite-vs/Tizen.WidgetControl.Tests/testcase/TSWidgetControl.cs

diff --git a/tct-suite-vs/Resource/Tizen.WidgetControl.Tests/org.tizen.WidgetCtrlSample2-1.0.0.tpk b/tct-suite-vs/Resource/Tizen.WidgetControl.Tests/org.tizen.WidgetCtrlSample2-1.0.0.tpk
new file mode 100755 (executable)
index 0000000..1da405b
Binary files /dev/null and b/tct-suite-vs/Resource/Tizen.WidgetControl.Tests/org.tizen.WidgetCtrlSample2-1.0.0.tpk differ
index 2cb131a..cd95b2e 100755 (executable)
@@ -2,6 +2,7 @@ using System.Collections.Generic;
 using NUnit.Framework;
 using NUnit.Framework.TUnit;
 using System;
+using Tizen.System;
 
 namespace Tizen.WidgetControl.Tests
 {
@@ -11,11 +12,17 @@ namespace Tizen.WidgetControl.Tests
     public class WidgetControlTests
     {
         private static Tizen.Applications.WidgetControl _widgetControl;
+        private static Tizen.Applications.WidgetControl _widgetControl2;
+        private static Tizen.Applications.WidgetControl _widgetControl3;
+
         private const string MyWidgetId = "org.tizen.WidgetCtrlSample";
         private const string MyWidgetId1 = "org.tizen.WidgetCtrlSample1";
+        private const string MyWidgetId2 = "org.tizen.WidgetCtrlSample2";
         private const string Lang = "en_US";
         private const string TAG = "WidgetControlTest";
 
+        static bool isWidgetSupported = false;
+
         private static void OnCreated(object sender, Tizen.Applications.WidgetLifecycleEventArgs args)
         {
         }
@@ -36,6 +43,10 @@ namespace Tizen.WidgetControl.Tests
         public void Init()
         {
             _widgetControl = new Tizen.Applications.WidgetControl(MyWidgetId);
+            _widgetControl2 = new Tizen.Applications.WidgetControl(MyWidgetId2);
+            _widgetControl3 = new Tizen.Applications.WidgetControl("");
+
+            Information.TryGetValue("http://tizen.org/feature/shell.appwidget", out isWidgetSupported);
             LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Preconditions for each TEST");
         }
 
@@ -43,6 +54,8 @@ namespace Tizen.WidgetControl.Tests
         public void Destroy()
         {
             _widgetControl = null;
+            _widgetControl2 = null;
+            _widgetControl3 = null;
             LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Postconditions for each TEST");
         }
 
@@ -264,5 +277,55 @@ namespace Tizen.WidgetControl.Tests
             Assert.IsInstanceOf<string>(_widgetControl.PackageId);
             Assert.AreEqual(_widgetControl.PackageId, "WidgetCtrlSample.Tizen");
         }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test : Check whether SetupAppId value is valid")]
+        [Property("SPEC", "Tizen.Applications.WidgetControl.SetupAppId A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRO")]
+        [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+        public void SetupAppId_PROPERTY_GET()
+        {
+            try
+            {
+                Assert.IsInstanceOf<string>(_widgetControl2.SetupAppId);
+                Assert.AreEqual(_widgetControl2.SetupAppId, "org.tizen.setupappid");
+            }
+            catch (NotSupportedException)
+            {
+                Assert.IsTrue(isWidgetSupported == false, "Invalid NotSupportedException");
+            }
+            catch (Exception e)
+            {
+                Assert.Fail("There should be no exception " + e.ToString());
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Test : Check whether SetupAppId value is valid")]
+        [Property("SPEC", "Tizen.Applications.WidgetControl.SetupAppId A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PEX")]
+        [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+        public void SetupAppId_INVALID_OPERATION_EXCEPTION()
+        {
+            try
+            {
+                Assert.Throws<InvalidOperationException>(delegate
+                {
+                    string id = _widgetControl3.SetupAppId;
+                });
+            }
+            catch (NotSupportedException)
+            {
+                Assert.IsTrue(isWidgetSupported == false, "Invalid NotSupportedException");
+            }
+            catch (Exception e)
+            {
+                Assert.Fail("There should be no exception " + e.ToString());
+            }
+        }
     }
 }