[Device][ACR-168][Add testcases for new apis] 06/187106/5
authorpr.jung <pr.jung@samsung.com>
Mon, 20 Aug 2018 04:59:00 +0000 (13:59 +0900)
committerpr.jung <pr.jung@samsung.com>
Thu, 23 Aug 2018 05:11:14 +0000 (14:11 +0900)
Change-Id: I6b4d6054583e3e68c2a6447b6c748968e4b12691
Signed-off-by: pr.jung <pr.jung@samsung.com>
tct-suite-vs/Tizen.Device.Tests/testcase/TSDisplay.cs [changed mode: 0755->0644]
tct-suite-vs/Tizen.Device.Tests/testcase/TSPower.cs [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 878b503..c7aae90
@@ -97,14 +97,15 @@ namespace Tizen.System.Tests
         [Description("Test if get for Device.Display:State property is working properly")]
         [Property("SPEC", "Tizen.System.Display.State A")]
         [Property("SPEC_URL", "-")]
-        [Property("CRITERIA", "PRO")]
+        [Property("CRITERIA", "PRW")]
         [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")]
-        public static void State_PROPERTY_READ_ONLY()
+        public static void State_PROPERTY_READ_WRITE()
         {
             if (isSupport == 1)
             {
+                Display.State = DisplayState.Normal;
                 LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "State_READ  Value:" + Display.State);
-                Assert.IsInstanceOf<DisplayState>(Display.State, "Dsiaply state should be valid");
+                Assert.IsTrue(Display.State == DisplayState.Normal, "Set/Get State value should be the same");
             }
             else
             {
old mode 100755 (executable)
new mode 100644 (file)
index f869991..69c5f22
@@ -58,5 +58,91 @@ namespace Tizen.System.Tests
             }
         }
 
+        [Test]
+        [Category("P1")]
+        [Description("Test if get for Tizen.System.Power:RequestLock method is working properly")]
+        [Property("SPEC", "Tizen.System.Power.RequestLock M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MCST")]
+        [Property("AUTHOR", "Pureum Jung, pr.jung@samsung.com")]
+        public static void RequestLock_CHECK_RESULT()
+        {
+            /* TEST CODE */
+            try
+            {
+                foreach (PowerLock type in Enum.GetValues(typeof(PowerLock)))
+                {
+                    Power.RequestLock(type, 2000);
+                }
+            }
+            catch (Exception e)
+            {
+                Assert.IsTrue(false, "failed to request cpu lock. " + e.Message);
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check ArgumentException for RequestLock with non-existing lock type")]
+        [Property("SPEC", "Tizen.System.Power.RequestLock M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Pureum Jung, pr.jung@samsung.com")]
+        public static void RequestLock_ARGUMENT_EXCEPTION()
+        {
+            /* TEST CODE */
+            try
+            {
+                Power.RequestLock((PowerLock)100, 2000);
+            }
+            catch (Exception e)
+            {
+                Assert.IsInstanceOf<ArgumentException>(e, "ArgumentException should be thrown for invalid lock type" + e.GetType());
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test if get for Tizen.System.Power:ReleaseLock method is working properly")]
+        [Property("SPEC", "Tizen.System.Power.ReleaseLock M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MCST")]
+        [Property("AUTHOR", "Pureum Jung, pr.jung@samsung.com")]
+        public static void ReleaseLock_CHECK_RESULT()
+        {
+            /* TEST CODE */
+            try
+            {
+                foreach (PowerLock type in Enum.GetValues(typeof(PowerLock)))
+                {
+                    Power.ReleaseLock(type);
+                }
+            }
+            catch (Exception e)
+            {
+                Assert.IsTrue(false, "failed to release cpu lock. " + e.Message);
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check ArgumentException for ReleaseLock with non-existing lock type")]
+        [Property("SPEC", "Tizen.System.Power.ReleaseLock M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Pureum Jung, pr.jung@samsung.com")]
+        public static void ReleaseLock_ARGUMENT_EXCEPTION()
+        {
+            /* TEST CODE */
+            try
+            {
+                Power.ReleaseLock((PowerLock)100);
+            }
+            catch (Exception e)
+            {
+                Assert.IsInstanceOf<ArgumentException>(e, "ArgumentException should be thrown for invalid lock type" + e.GetType());
+            }
+        }
+
     }
 }