[Device][Non-ACR][Add negative TCs for Device] 25/215125/2
authorYoungjae Cho <y0.cho@samsung.com>
Wed, 2 Oct 2019 01:21:30 +0000 (10:21 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Tue, 15 Oct 2019 01:43:33 +0000 (10:43 +0900)
Change-Id: I2255dda484106e4186b86424e03409956e0cf75a
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
tct-suite-vs/Tizen.Device.Tests/testcase/TSIR.cs
tct-suite-vs/Tizen.Device.Tests/testcase/TSLed.cs
tct-suite-vs/Tizen.Device.Tests/testcase/TSPower.cs
tct-suite-vs/Tizen.Device.Tests/testcase/TSVibrator.cs

index 252a3d35245d6a05cd2763308e615bd44a0c7a07..6c6ddf6c0a7ec159e5f285ae7102582bade10352 100755 (executable)
@@ -68,7 +68,42 @@ namespace Tizen.System.Tests
                 }
                 else
                 {
-                    Assert.IsTrue(e.GetType().Name.Equals("NotSupportedException"), "Should be throw NotSupportedException");
+                    Assert.IsTrue(e.GetType().Name.Equals("NotSupportedException"), "Must throw NotSupportedException");
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Test if get for Device.IR.Transmit method is working properly")]
+        [Property("SPEC", "Tizen.System.IR.Transmit M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Youngjae Cho, y0.cho@samsung.com")]
+        public void Transmit_INVALID_PATTERN_ARGUMENT()
+        {
+            /* TEST CODE */
+            bool value;
+            var result = Tizen.System.Information.TryGetValue<bool>("http://tizen.org/feature/consumer_ir", out value);
+            try
+            {
+                //TODO: Not able to find a way to check the transmit success.
+                if (result && value)
+                {
+                    List<int> pattern = new List<int>();
+                    IR.Transmit(10, pattern);
+                    Assert.IsTrue(false, "ArgumentException should be thrown for invalid parameter value.");
+                }
+            }
+            catch (Exception e)
+            {
+                if (result && value)
+                {\r
+                    Assert.IsInstanceOf<ArgumentException>(e, "ArgumentException should be thrown for invalid parameter value.");
+                }
+                else
+                {
+                    Assert.IsTrue(e.GetType().Name.Equals("NotSupportedException"), "Must throw NotSupportedException");
                 }
             }
         }
index 14954b2f9e177e5abc43679875ee36f3b488fadc..eb9faa050013bc0aebcc3a7576563d58d97603a3 100755 (executable)
@@ -75,7 +75,7 @@ namespace Tizen.System.Tests
                 }
                 else
                 {
-                    Assert.IsTrue(e.GetType().Name.Equals("NotSupportedException"), "Should be throw NotSupportedException");
+                    Assert.IsTrue(e.GetType().Name.Equals("NotSupportedException"), "Must throw NotSupportedException");
                 }
             }
         }
@@ -118,7 +118,7 @@ namespace Tizen.System.Tests
                 }
                 else
                 {
-                    Assert.IsTrue(e.GetType().Name.Equals("NotSupportedException"), "Should be throw NotSupportedException");
+                    Assert.IsTrue(e.GetType().Name.Equals("NotSupportedException"), "Must throw NotSupportedException");
                 }
             }
         }
@@ -150,7 +150,73 @@ namespace Tizen.System.Tests
                 }
                 else
                 {
-                    Assert.IsTrue(e.GetType().Name.Equals("NotSupportedException"), "Should be throw NotSupportedException");
+                    Assert.IsTrue(e.GetType().Name.Equals("NotSupportedException"), "Must throw NotSupportedException");
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Test if get for Device.Led:Play Method is working properly")]
+        [Property("SPEC", "Tizen.System.Led.Play M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Youngjae Cho, y0.cho@samsung.com")]
+        public void Play_INVALID_ON_ARGUMENT()
+        {
+            /* TEST CODE */
+            bool value;
+            var result = Tizen.System.Information.TryGetValue<bool>("http://tizen.org/feature/led", out value);
+            try
+            {
+                if (result && value)
+                {
+                    Led.Play(-1, 200, Color.FromRgba(255, 255, 255, 1));
+                    Assert.IsTrue(false, "ArgumentException should be thorwn for negative on value.");
+                }
+            }
+            catch (Exception e)
+            {
+                if (result && value)
+                {
+                    Assert.IsInstanceOf<ArgumentException>(e, "ArgumentException should be thrown for negative on value.");
+                }
+                else
+                {
+                    Assert.IsTrue(e.GetType().Name.Equals("NotSupportedException"), "Must throw NotSupportedException");
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Test if get for Device.Led:Play Method is working properly")]
+        [Property("SPEC", "Tizen.System.Led.Play M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Youngjae Cho, y0.cho@samsung.com")]
+        public void Play_INVALID_OFF_ARGUMENT()
+        {
+            /* TEST CODE */
+            bool value;
+            var result = Tizen.System.Information.TryGetValue<bool>("http://tizen.org/feature/led", out value);
+            try
+            {
+                if (result && value)
+                {
+                    Led.Play(500, -1, Color.FromRgba(255, 255, 255, 1));
+                    Assert.IsTrue(false, "ArgumentException should be thorwn for negative off value.");
+                }
+            }
+            catch (Exception e)
+            {
+                if (result && value)
+                {
+                    Assert.IsInstanceOf<ArgumentException>(e, "ArgumentException should be thrown for negative off value.");
+                }
+                else
+                {
+                    Assert.IsTrue(e.GetType().Name.Equals("NotSupportedException"), "Must throw NotSupportedException");
                 }
             }
         }
@@ -189,7 +255,7 @@ namespace Tizen.System.Tests
                 }
                 else
                 {
-                    Assert.IsTrue(e.GetType().Name.Equals("NotSupportedException"), "Should be throw NotSupportedException");
+                    Assert.IsTrue(e.GetType().Name.Equals("NotSupportedException"), "Must throw NotSupportedException");
                 }
             }
         }
index 5d1da8d40de212ed78e40ad04f77d58fcd647897..7dab570ae899228046ac8e28a008a1c8fd328336 100755 (executable)
@@ -30,7 +30,7 @@ namespace Tizen.System.Tests
             /* TEST CODE */
             try
             {
-                Power.RequestCpuLock(2000);
+                Power.RequestLock(PowerLock.Cpu, 2000);
             }
             catch (Exception e)
             {
@@ -38,6 +38,27 @@ namespace Tizen.System.Tests
             }
         }
 
+        [Test]
+        [Category("P2")]
+        [Description("Test if get for Tizen.System.Power:RequestCpuLock method is working properly")]
+        [Property("SPEC", "Tizen.System.Power.RequestCpuLock M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Youngjae Cho, y0.cho@samsung.com")]
+        public void RequestCpuLock_INVALID_TIMEOUT_ARGUMENT()
+        {
+            /* TEST CODE */
+            try
+            {
+                Power.RequestLock(PowerLock.Cpu, -1);
+                Assert.IsTrue(false, "ArgumentException should be thrown for negative timeout value.");
+            }
+            catch (Exception e)
+            {
+                Assert.IsInstanceOf<ArgumentException>(e, "ArgumentException should be thrown for negative timeout value.");
+            }
+        }
+
         [Test]
         [Category("P1")]
         [Description("Test if get for Tizen.System.Power:ReleaseCpuLock method is working properly")]
@@ -50,7 +71,7 @@ namespace Tizen.System.Tests
             /* TEST CODE */
             try
             {
-                Power.ReleaseCpuLock();
+                Power.ReleaseLock(PowerLock.Cpu);
             }
             catch (Exception e)
             {
index d6a185712a250b99ddbe3d1662d083d1c6ad0bb1..5aafb994a5e162dabdd36a028f895e583b0db698 100755 (executable)
@@ -96,6 +96,32 @@ namespace Tizen.System.Tests
             }
         }
 
+        [Test]
+        [Category("P1")]
+        [Description("Test if Tizen.System.Vibrator.Vibrate method can throw exception when invalid argument is passed")]
+        [Property("SPEC", "Tizen.System.Vibrator.Vibrate M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Youngjae Cho, y0.cho@samsung.com")]
+        public void Vibrate_INVALID_DURATION_ARGUMENT()
+        {
+            if (!support)
+                return;
+
+            Assert.IsTrue(Vibrator.Vibrators.Count > 0, "Number of vibrators can't be zero");
+            Vibrator vib = Vibrator.Vibrators[0];
+
+            try
+            {
+                vib.Vibrate(-1, 50);
+                Assert.IsTrue(false, "ArgumentException should be thrown for negative duration value.");
+            }
+            catch (Exception e)
+            {
+                Assert.IsInstanceOf<ArgumentException>(e, "ArgumentException should be thrown for negative duration value.");
+            }
+        }
+
         [Test]
         [Category("P1")]
         [Description("Test if Tizen.System.Vibrator.Stop method can be invoked without any exception")]