From: Youngjae Cho Date: Wed, 2 Oct 2019 01:21:30 +0000 (+0900) Subject: [Device][Non-ACR][Add negative TCs for Device] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0aa953f291bf6d3228bf0394160080a3477c268f;p=test%2Ftct%2Fcsharp%2Fapi.git [Device][Non-ACR][Add negative TCs for Device] Change-Id: I2255dda484106e4186b86424e03409956e0cf75a Signed-off-by: Youngjae Cho --- diff --git a/tct-suite-vs/Tizen.Device.Tests/testcase/TSIR.cs b/tct-suite-vs/Tizen.Device.Tests/testcase/TSIR.cs index 252a3d352..6c6ddf6c0 100755 --- a/tct-suite-vs/Tizen.Device.Tests/testcase/TSIR.cs +++ b/tct-suite-vs/Tizen.Device.Tests/testcase/TSIR.cs @@ -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("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 pattern = new List(); + IR.Transmit(10, pattern); + Assert.IsTrue(false, "ArgumentException should be thrown for invalid parameter value."); + } + } + catch (Exception e) + { + if (result && value) + { + Assert.IsInstanceOf(e, "ArgumentException should be thrown for invalid parameter value."); + } + else + { + Assert.IsTrue(e.GetType().Name.Equals("NotSupportedException"), "Must throw NotSupportedException"); } } } diff --git a/tct-suite-vs/Tizen.Device.Tests/testcase/TSLed.cs b/tct-suite-vs/Tizen.Device.Tests/testcase/TSLed.cs index 14954b2f9..eb9faa050 100755 --- a/tct-suite-vs/Tizen.Device.Tests/testcase/TSLed.cs +++ b/tct-suite-vs/Tizen.Device.Tests/testcase/TSLed.cs @@ -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("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(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("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(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"); } } } diff --git a/tct-suite-vs/Tizen.Device.Tests/testcase/TSPower.cs b/tct-suite-vs/Tizen.Device.Tests/testcase/TSPower.cs index 5d1da8d40..7dab570ae 100755 --- a/tct-suite-vs/Tizen.Device.Tests/testcase/TSPower.cs +++ b/tct-suite-vs/Tizen.Device.Tests/testcase/TSPower.cs @@ -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(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) { diff --git a/tct-suite-vs/Tizen.Device.Tests/testcase/TSVibrator.cs b/tct-suite-vs/Tizen.Device.Tests/testcase/TSVibrator.cs index d6a185712..5aafb994a 100755 --- a/tct-suite-vs/Tizen.Device.Tests/testcase/TSVibrator.cs +++ b/tct-suite-vs/Tizen.Device.Tests/testcase/TSVibrator.cs @@ -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(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")]