From: sooyeon.kim Date: Wed, 17 Feb 2021 03:59:18 +0000 (+0900) Subject: [TTS][Non-ACR][Fix to return NotSupportedException] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F66%2F253866%2F1;p=test%2Ftct%2Fcsharp%2Fapi.git [TTS][Non-ACR][Fix to return NotSupportedException] Change-Id: Id76560deedd50f4e524945b360ae6425017e41b6 Signed-off-by: sooyeon.kim (cherry picked from commit b9e0beb7492eebd80d3d00df504ed5d4c67b7ee6) --- diff --git a/tct-suite-vs/Tizen.Tts.Manual.Tests/support/TtsCommon.cs b/tct-suite-vs/Tizen.Tts.Manual.Tests/support/TtsCommon.cs index db87bd1..060e9be 100755 --- a/tct-suite-vs/Tizen.Tts.Manual.Tests/support/TtsCommon.cs +++ b/tct-suite-vs/Tizen.Tts.Manual.Tests/support/TtsCommon.cs @@ -13,8 +13,6 @@ namespace Tizen.Uix.Tts.Tests class TtsHelper { internal static string Tag = "TCT"; - internal static Tizen.Uix.Tts.TtsClient TtsInst = new Tizen.Uix.Tts.TtsClient(); - internal static List list; internal static void PrintLog(Type t, string message) { @@ -28,9 +26,5 @@ namespace Tizen.Uix.Tts.Tests } } - internal static void GetSupportedVoices() - { - TtsHelper.list = (List)TtsHelper.TtsInst.GetSupportedVoices(); - } } } diff --git a/tct-suite-vs/Tizen.Tts.Manual.Tests/support/TtsWrapper.cs b/tct-suite-vs/Tizen.Tts.Manual.Tests/support/TtsWrapper.cs index 6d7638c..fc577f2 100755 --- a/tct-suite-vs/Tizen.Tts.Manual.Tests/support/TtsWrapper.cs +++ b/tct-suite-vs/Tizen.Tts.Manual.Tests/support/TtsWrapper.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using System.Collections.Generic; +using NUnit.Framework; using System; using System.Threading.Tasks; using static Tizen.Uix.Tts.Tests.TtsUiHelper; @@ -41,6 +42,7 @@ namespace Tizen.Uix.Tts.Tests internal string EngineId; internal bool NeedCredential; internal SupportedVoice VoiceType; + internal List list; public TtsWrapper() { @@ -214,8 +216,8 @@ namespace Tizen.Uix.Tts.Tests TtsHelper.PrintLog(Type.DLogAndlogUtil, "GenerateScenario"); DoPrepare(); await WaitFlagCond(FlagType.TtsStateChanged, 30); - TtsHelper.GetSupportedVoices(); - Assert.True(TtsHelper.list.Count > 0, "Languages are not present"); + GetSupportedVoices(); + Assert.True(list.Count > 0, "Languages are not present"); TtsInst.AddText("Hi how are you doing, I am fine today, how is the weather today", "en_US", 0, 0); /* @@ -276,5 +278,11 @@ namespace Tizen.Uix.Tts.Tests task.SetResult(true); return await task.Task; } + + + internal void GetSupportedVoices() + { + list = (List)TtsInst.GetSupportedVoices(); + } } } diff --git a/tct-suite-vs/Tizen.Tts.Manual.Tests/testcase/TSTtsClient.cs b/tct-suite-vs/Tizen.Tts.Manual.Tests/testcase/TSTtsClient.cs index 16bd2f1..d62b3bc 100755 --- a/tct-suite-vs/Tizen.Tts.Manual.Tests/testcase/TSTtsClient.cs +++ b/tct-suite-vs/Tizen.Tts.Manual.Tests/testcase/TSTtsClient.cs @@ -1,4 +1,4 @@ -using NUnit.Framework; +using NUnit.Framework; using System; using System.Threading.Tasks; @@ -9,6 +9,7 @@ namespace Tizen.Uix.Tts.Tests [Description("Tizen.Uix.Tts.TtsClient Tests")] public class TtsClientTests { + TtsWrapper obj = null; private static bool _featureSupported = false; private static string SsFeature = "http://tizen.org/feature/speech.synthesis"; @@ -17,6 +18,25 @@ namespace Tizen.Uix.Tts.Tests { TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing Init"); System.Information.TryGetValue(SsFeature, out _featureSupported); + + try + { + if (obj == null) + obj = new TtsWrapper(); + + Assert.IsInstanceOf(obj.TtsInst, "Tts object is not of correct instance"); + Assert.IsNotNull(obj.TtsInst); + } + catch (Exception e) + { + TtsHelper.PrintLog(Type.DLogAndlogUtil, "Caught Exception :" + e.ToString()); + if (e is NotSupportedException) { + Assert.IsFalse(_featureSupported, "Invalid NotSupportedException"); + Assert.Pass("TTS speech.synthesis is Not supported"); + } else { + Assert.IsTrue(false, "Caught Exception" + e.ToString()); + } + } } [TearDown] @@ -41,7 +61,6 @@ namespace Tizen.Uix.Tts.Tests [Postcondition(1, "N/A")] public async Task Play_Check_Sound() { - TtsWrapper obj = null; try { /* @@ -49,11 +68,10 @@ namespace Tizen.Uix.Tts.Tests * 1. Prepare */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:Play_Check_Sound"); - obj = new TtsWrapper(); obj.DoPrepare(); await obj.WaitFlagCond(FlagType.TtsStateChanged, 30); - TtsHelper.GetSupportedVoices(); - Assert.True(TtsHelper.list.Count > 0, "Languages are not present"); + obj.GetSupportedVoices(); + Assert.True(obj.list.Count > 0, "Languages are not present"); obj.TtsInst.AddText("Hi how are you", null, 0, 0); /* @@ -103,7 +121,6 @@ namespace Tizen.Uix.Tts.Tests [Postcondition(1, "N/A")] public async Task Pause_Check_Pause() { - TtsWrapper obj = null; try { /* @@ -111,11 +128,10 @@ namespace Tizen.Uix.Tts.Tests * 1. Prepare */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:Pause_Check_Pause"); - obj = new TtsWrapper(); obj.DoPrepare(); await obj.WaitFlagCond(FlagType.TtsStateChanged, 30); - TtsHelper.GetSupportedVoices(); - Assert.True(TtsHelper.list.Count > 0, "Languages are not present"); + obj.GetSupportedVoices(); + Assert.True(obj.list.Count > 0, "Languages are not present"); obj.TtsInst.AddText("Hi how are you doing, I am fine today, how is the weather today", "en_US", 0, 0); /* @@ -169,7 +185,6 @@ namespace Tizen.Uix.Tts.Tests [Postcondition(1, "N/A")] public async Task Stop_Check_Stopping() { - TtsWrapper obj = null; try { /* @@ -177,11 +192,10 @@ namespace Tizen.Uix.Tts.Tests * 1. Prepare */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:Stop_Check_Stopping"); - obj = new TtsWrapper(); obj.DoPrepare(); await obj.WaitFlagCond(FlagType.TtsStateChanged, 30); - TtsHelper.GetSupportedVoices(); - Assert.True(TtsHelper.list.Count > 0, "Languages are not present"); + obj.GetSupportedVoices(); + Assert.True(obj.list.Count > 0, "Languages are not present"); obj.TtsInst.AddText("Hi how are you doing, I am fine today, how is the weather today", "en_US", 0, 0); /* diff --git a/tct-suite-vs/Tizen.Tts.Tests/support/TtsCommon.cs b/tct-suite-vs/Tizen.Tts.Tests/support/TtsCommon.cs index 581c3e2..59f5745 100755 --- a/tct-suite-vs/Tizen.Tts.Tests/support/TtsCommon.cs +++ b/tct-suite-vs/Tizen.Tts.Tests/support/TtsCommon.cs @@ -12,12 +12,8 @@ namespace Tizen.Uix.Tts.Tests class TtsHelper { - internal static bool ReadyStateFlag = false; - internal static bool CreatedStateFlag = false; internal static string Tag = "TCT"; internal static bool TestFlag = false; - internal static Tizen.Uix.Tts.TtsClient TtsInst = new Tizen.Uix.Tts.TtsClient(); - internal static List list; internal static void PrintLog(Type t, string message) { @@ -30,42 +26,5 @@ namespace Tizen.Uix.Tts.Tests LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, message); } } - - internal static void DoPrepare() - { - TtsInst = new Tizen.Uix.Tts.TtsClient(); - ReadyStateFlag = false; - TestFlag = false; - TtsInst.Prepare(); - } - - internal static void DoUnprepare() - { - TestFlag = false; - CreatedStateFlag = false; - TtsInst.Unprepare(); - } - - internal static void TtsStateChanged(object sender, StateChangedEventArgs e) - { - PrintLog(Type.DLogAndlogUtil, "State Changed, Previous State:"+e.Previous+" Current State:"+e.Current); - if (e.Current == Tts.State.Ready) - { - ReadyStateFlag = true; - CreatedStateFlag = false; - TestFlag = true; - } - if (e.Current == Tts.State.Created) - { - CreatedStateFlag = true; - ReadyStateFlag = false; - TestFlag = true; - } - } - - internal static void GetSupportedVoices() - { - TtsHelper.list = (List)TtsHelper.TtsInst.GetSupportedVoices(); - } } } diff --git a/tct-suite-vs/Tizen.Tts.Tests/support/TtsWrapper.cs b/tct-suite-vs/Tizen.Tts.Tests/support/TtsWrapper.cs index 7f64453..cea2ed9 100755 --- a/tct-suite-vs/Tizen.Tts.Tests/support/TtsWrapper.cs +++ b/tct-suite-vs/Tizen.Tts.Tests/support/TtsWrapper.cs @@ -1,4 +1,5 @@ -using System.Threading.Tasks; +using System.Collections.Generic; +using System.Threading.Tasks; namespace Tizen.Uix.Tts.Tests { @@ -8,17 +9,21 @@ namespace Tizen.Uix.Tts.Tests internal bool CreatedStateFlag = false; internal bool TestFlag = false; internal Tizen.Uix.Tts.TtsClient TtsInst = null; - internal static Tizen.Uix.Tts.TtsClient TtsStaticInst = new Tizen.Uix.Tts.TtsClient(); internal Tts.State Current; internal Tts.State Previous; internal Tts.Error TtsError; internal bool TtsErrorFlag = false; internal int UtteranceId = 0; internal bool UtteranceIdFlag = false; + internal List list; + + public TtsWrapper() + { + TtsInst = new Tizen.Uix.Tts.TtsClient(); + } internal void DoPrepare() { - TtsInst = TtsStaticInst; ReadyStateFlag = false; TestFlag = false; TtsInst.StateChanged += TtsStateChanged; @@ -93,5 +98,10 @@ namespace Tizen.Uix.Tts.Tests UtteranceIdFlag = true; UtteranceId = e.UtteranceId; } + + internal void GetSupportedVoices() + { + list = (List)TtsInst.GetSupportedVoices(); + } } } diff --git a/tct-suite-vs/Tizen.Tts.Tests/testcase/TSSpeedRange.cs b/tct-suite-vs/Tizen.Tts.Tests/testcase/TSSpeedRange.cs index f18721a..3faf64c 100755 --- a/tct-suite-vs/Tizen.Tts.Tests/testcase/TSSpeedRange.cs +++ b/tct-suite-vs/Tizen.Tts.Tests/testcase/TSSpeedRange.cs @@ -1,4 +1,4 @@ -using NUnit.Framework; +using NUnit.Framework; using System; namespace Tizen.Uix.Tts.Tests @@ -7,6 +7,7 @@ namespace Tizen.Uix.Tts.Tests [Description("Tizen.Uix.Tts.SpeedRange Tests")] public class SpeedRangeTests { + TtsWrapper obj = null; private static bool _featureSupported = false; private static string _ttsFeature = "http://tizen.org/feature/speech.synthesis"; @@ -15,6 +16,25 @@ namespace Tizen.Uix.Tts.Tests { TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing Init"); System.Information.TryGetValue(_ttsFeature, out _featureSupported); + + try + { + if (obj == null) + obj = new TtsWrapper(); + + Assert.IsInstanceOf(obj.TtsInst, "Tts object is not of correct instance"); + Assert.IsNotNull(obj.TtsInst); + } + catch (Exception e) + { + TtsHelper.PrintLog(Type.DLogAndlogUtil, "Caught Exception :" + e.ToString()); + if (e is NotSupportedException) { + Assert.IsFalse(_featureSupported, "Invalid NotSupportedException"); + Assert.Pass("TTS speech.synthesis is Not supported"); + } else { + Assert.IsTrue(false, "Caught Exception" + e.ToString()); + } + } } [TearDown] @@ -38,7 +58,7 @@ namespace Tizen.Uix.Tts.Tests * TEST CODE */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:Max_READ_ONLY"); - var range = TtsHelper.TtsInst.GetSpeedRange(); + var range = obj.TtsInst.GetSpeedRange(); Assert.IsNotNull(range, "Object is Null"); Assert.IsInstanceOf(range, "Object is not of correct type"); Assert.IsNotNull(range.Max, "Object is Null"); @@ -71,7 +91,7 @@ namespace Tizen.Uix.Tts.Tests * TEST CODE */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:Min_READ_ONLY"); - var range = TtsHelper.TtsInst.GetSpeedRange(); + var range = obj.TtsInst.GetSpeedRange(); Assert.IsNotNull(range, "Object is Null"); Assert.IsInstanceOf(range, "Object is not of correct type"); Assert.IsNotNull(range.Min, "Object is Null"); @@ -104,7 +124,7 @@ namespace Tizen.Uix.Tts.Tests * TEST CODE */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:Normal_READ_ONLY"); - var range = TtsHelper.TtsInst.GetSpeedRange(); + var range = obj.TtsInst.GetSpeedRange(); Assert.IsNotNull(range, "Object is Null"); Assert.IsInstanceOf(range, "Object is not of correct type"); Assert.IsNotNull(range.Normal, "Object is Null"); diff --git a/tct-suite-vs/Tizen.Tts.Tests/testcase/TSStateChangedEventArgs.cs b/tct-suite-vs/Tizen.Tts.Tests/testcase/TSStateChangedEventArgs.cs index 5585e16..319ab8c 100755 --- a/tct-suite-vs/Tizen.Tts.Tests/testcase/TSStateChangedEventArgs.cs +++ b/tct-suite-vs/Tizen.Tts.Tests/testcase/TSStateChangedEventArgs.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading.Tasks; using NUnit.Framework; @@ -8,6 +8,7 @@ namespace Tizen.Uix.Tts.Tests [Description("Tizen.Uix.Tts.StateChangedEventArgs Tests")] public class StateChangedEventArgsTests { + TtsWrapper obj = null; private static bool _featureSupported = false; private static string _ttsFeature = "http://tizen.org/feature/speech.synthesis"; @@ -16,6 +17,25 @@ namespace Tizen.Uix.Tts.Tests { TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing Init"); System.Information.TryGetValue(_ttsFeature, out _featureSupported); + + try + { + if (obj == null) + obj = new TtsWrapper(); + + Assert.IsInstanceOf(obj.TtsInst, "Tts object is not of correct instance"); + Assert.IsNotNull(obj.TtsInst); + } + catch (Exception e) + { + TtsHelper.PrintLog(Type.DLogAndlogUtil, "Caught Exception :" + e.ToString()); + if (e is NotSupportedException) { + Assert.IsFalse(_featureSupported, "Invalid NotSupportedException"); + Assert.Pass("TTS speech.synthesis is Not supported"); + } else { + Assert.IsTrue(false, "Caught Exception" + e.ToString()); + } + } } [TearDown] @@ -33,22 +53,20 @@ namespace Tizen.Uix.Tts.Tests [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] public async Task Current_READ_ONLY() { - TtsWrapper obj = new TtsWrapper(); try { /* * PRECONDITION * 1. Prepare */ - obj.TtsInst = new Tizen.Uix.Tts.TtsClient(); obj.ReadyStateFlag = false; obj.TestFlag = false; obj.TtsInst.StateChanged += obj.TtsStateChanged; obj.TtsInst.Prepare(); await obj.WaitFlag(15); - TtsHelper.GetSupportedVoices(); - Assert.True(TtsHelper.list.Count > 0, "Languages are not present"); - obj.TtsInst.AddText("Hai", TtsHelper.list[0].Language, 0, 0); + obj.GetSupportedVoices(); + Assert.True(obj.list.Count > 0, "Languages are not present"); + obj.TtsInst.AddText("Hai", obj.list[0].Language, 0, 0); /* * TEST CODE @@ -92,22 +110,20 @@ namespace Tizen.Uix.Tts.Tests [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] public async Task Previous_READ_ONLY() { - TtsWrapper obj = new TtsWrapper(); try { /* * PRECONDITION * 1. Prepare */ - obj.TtsInst = new Tizen.Uix.Tts.TtsClient(); obj.ReadyStateFlag = false; obj.TestFlag = false; obj.TtsInst.StateChanged += obj.TtsStateChanged; obj.TtsInst.Prepare(); await obj.WaitFlag(15); - TtsHelper.GetSupportedVoices(); - Assert.True(TtsHelper.list.Count > 0, "Languages are not present"); - obj.TtsInst.AddText("Hai", TtsHelper.list[0].Language, 0, 0); + obj.GetSupportedVoices(); + Assert.True(obj.list.Count > 0, "Languages are not present"); + obj.TtsInst.AddText("Hai", obj.list[0].Language, 0, 0); /* * TEST CODE diff --git a/tct-suite-vs/Tizen.Tts.Tests/testcase/TSSupportedVoice.cs b/tct-suite-vs/Tizen.Tts.Tests/testcase/TSSupportedVoice.cs index 6337030..f3143ed 100755 --- a/tct-suite-vs/Tizen.Tts.Tests/testcase/TSSupportedVoice.cs +++ b/tct-suite-vs/Tizen.Tts.Tests/testcase/TSSupportedVoice.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using NUnit.Framework; @@ -8,6 +8,7 @@ namespace Tizen.Uix.Tts.Tests [Description("Tizen.Uix.Tts.SupportedVoice Tests")] public class SupportedVoiceTests { + TtsWrapper obj = null; private static bool _featureSupported = false; private static string _ttsFeature = "http://tizen.org/feature/speech.synthesis"; @@ -16,6 +17,25 @@ namespace Tizen.Uix.Tts.Tests { TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing Init"); System.Information.TryGetValue(_ttsFeature, out _featureSupported); + + try + { + if (obj == null) + obj = new TtsWrapper(); + + Assert.IsInstanceOf(obj.TtsInst, "Tts object is not of correct instance"); + Assert.IsNotNull(obj.TtsInst); + } + catch (Exception e) + { + TtsHelper.PrintLog(Type.DLogAndlogUtil, "Caught Exception :" + e.ToString()); + if (e is NotSupportedException) { + Assert.IsFalse(_featureSupported, "Invalid NotSupportedException"); + Assert.Pass("TTS speech.synthesis is Not supported"); + } else { + Assert.IsTrue(false, "Caught Exception" + e.ToString()); + } + } } [TearDown] @@ -39,11 +59,11 @@ namespace Tizen.Uix.Tts.Tests * TEST CODE */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:VoiceType_READ_ONLY"); - TtsHelper.list = (List)TtsHelper.TtsInst.GetSupportedVoices(); - Assert.IsNotNull(TtsHelper.list, "Object is Null"); - Assert.IsInstanceOf>(TtsHelper.list, "Object is not of correct type"); - Assert.IsTrue(TtsHelper.list.Count > 0, "Value is not proper"); - foreach (SupportedVoice voice in TtsHelper.list) + obj.list = (List)obj.TtsInst.GetSupportedVoices(); + Assert.IsNotNull(obj.list, "Object is Null"); + Assert.IsInstanceOf>(obj.list, "Object is not of correct type"); + Assert.IsTrue(obj.list.Count > 0, "Value is not proper"); + foreach (SupportedVoice voice in obj.list) { Assert.IsNotNull(voice.VoiceType, "Object is Null"); Assert.IsInstanceOf(voice.VoiceType, "Object is not of correct type"); @@ -76,11 +96,11 @@ namespace Tizen.Uix.Tts.Tests * TEST CODE */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:Language_READ_ONLY"); - TtsHelper.list = (List)TtsHelper.TtsInst.GetSupportedVoices(); - Assert.IsNotNull(TtsHelper.list, "Object is Null"); - Assert.IsInstanceOf>(TtsHelper.list, "Object is not of correct type"); - Assert.IsTrue(TtsHelper.list.Count > 0, "Value is not proper"); - foreach (SupportedVoice voice in TtsHelper.list) + obj.list = (List)obj.TtsInst.GetSupportedVoices(); + Assert.IsNotNull(obj.list, "Object is Null"); + Assert.IsInstanceOf>(obj.list, "Object is not of correct type"); + Assert.IsTrue(obj.list.Count > 0, "Value is not proper"); + foreach (SupportedVoice voice in obj.list) { Assert.IsNotNull(voice.Language, "Object is Null"); Assert.IsInstanceOf(voice.Language, "Object is not of correct type"); diff --git a/tct-suite-vs/Tizen.Tts.Tests/testcase/TSTtsClient.cs b/tct-suite-vs/Tizen.Tts.Tests/testcase/TSTtsClient.cs index 534f7d2..ebe2125 100755 --- a/tct-suite-vs/Tizen.Tts.Tests/testcase/TSTtsClient.cs +++ b/tct-suite-vs/Tizen.Tts.Tests/testcase/TSTtsClient.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Threading.Tasks; using NUnit.Framework; @@ -9,6 +9,7 @@ namespace Tizen.Uix.Tts.Tests [Description("Tizen.Uix.Tts.TtsClient Tests")] public class TtsClientTests { + TtsWrapper obj = null; private static bool _featureSupported = false; private static string _ttsFeature = "http://tizen.org/feature/speech.synthesis"; @@ -17,6 +18,25 @@ namespace Tizen.Uix.Tts.Tests { TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing Init"); System.Information.TryGetValue(_ttsFeature, out _featureSupported); + + try + { + if (obj == null) + obj = new TtsWrapper(); + + Assert.IsInstanceOf(obj.TtsInst, "Tts object is not of correct instance"); + Assert.IsNotNull(obj.TtsInst); + } + catch (Exception e) + { + TtsHelper.PrintLog(Type.DLogAndlogUtil, "Caught Exception :" + e.ToString()); + if (e is NotSupportedException) { + Assert.IsFalse(_featureSupported, "Invalid NotSupportedException"); + Assert.Pass("TTS speech.synthesis is Not supported"); + } else { + Assert.IsTrue(false, "Caught Exception" + e.ToString()); + } + } } [TearDown] @@ -64,8 +84,8 @@ namespace Tizen.Uix.Tts.Tests * TEST CODE */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:TtsClient_CONSTRUCTOR"); - Assert.IsInstanceOf(TtsHelper.TtsInst, "Tts object is not of correct instance"); - Assert.IsNotNull(TtsHelper.TtsInst); + Assert.IsInstanceOf(obj.TtsInst, "Tts object is not of correct instance"); + Assert.IsNotNull(obj.TtsInst); TtsHelper.PrintLog(Type.DLogAndlogUtil, "Completed TC:TtsClient_CONSTRUCTOR"); } catch (Exception e) @@ -94,12 +114,12 @@ namespace Tizen.Uix.Tts.Tests * TEST CODE */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:CurrentMode_ENUM_ALL"); - TtsHelper.TtsInst.CurrentMode = Tts.Mode.Notification; - Assert.IsTrue(TtsHelper.TtsInst.CurrentMode == Tts.Mode.Notification, "Mode value should be Notification"); - TtsHelper.TtsInst.CurrentMode = Tts.Mode.Default; - Assert.IsTrue(TtsHelper.TtsInst.CurrentMode == Tts.Mode.Default, "Mode value should be Default"); - TtsHelper.TtsInst.CurrentMode = Tts.Mode.ScreenReader; - Assert.IsTrue(TtsHelper.TtsInst.CurrentMode == Tts.Mode.ScreenReader, "Mode value should be ScreenReader"); + obj.TtsInst.CurrentMode = Tts.Mode.Notification; + Assert.IsTrue(obj.TtsInst.CurrentMode == Tts.Mode.Notification, "Mode value should be Notification"); + obj.TtsInst.CurrentMode = Tts.Mode.Default; + Assert.IsTrue(obj.TtsInst.CurrentMode == Tts.Mode.Default, "Mode value should be Default"); + obj.TtsInst.CurrentMode = Tts.Mode.ScreenReader; + Assert.IsTrue(obj.TtsInst.CurrentMode == Tts.Mode.ScreenReader, "Mode value should be ScreenReader"); TtsHelper.PrintLog(Type.DLogAndlogUtil, "Completed TC:CurrentMode_ENUM_ALL"); } catch (Exception e) @@ -128,7 +148,7 @@ namespace Tizen.Uix.Tts.Tests * TEST CODE */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:DefaultVoice_READ_ONLY"); - var defaultVoice = TtsHelper.TtsInst.DefaultVoice; + var defaultVoice = obj.TtsInst.DefaultVoice; TtsHelper.PrintLog(Type.DLogAndlogUtil, "DefaultVoice " + defaultVoice); Assert.IsNotNull(defaultVoice, "Object is Null"); Assert.IsInstanceOf(defaultVoice, "Object is not of correct type"); @@ -154,7 +174,6 @@ namespace Tizen.Uix.Tts.Tests [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] public async Task CurrentState_GET_ENUM_ALL() { - TtsWrapper obj = new TtsWrapper(); try { /* @@ -165,9 +184,9 @@ namespace Tizen.Uix.Tts.Tests obj.DoPrepare(); await obj.WaitFlag(30); Assert.IsTrue(obj.TtsInst.CurrentState == State.Ready, "State is not Ready"); - TtsHelper.GetSupportedVoices(); - Assert.True(TtsHelper.list.Count > 0, "Languages are not present"); - obj.TtsInst.AddText("Hai how are you doing. What is the current date today. What is the current month. what is the current year", TtsHelper.list[0].Language, 0, 0); + obj.GetSupportedVoices(); + Assert.True(obj.list.Count > 0, "Languages are not present"); + obj.TtsInst.AddText("Hai how are you doing. What is the current date today. What is the current month. what is the current year", obj.list[0].Language, 0, 0); TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:CurrentState_GET_ENUM_ALL"); @@ -217,11 +236,11 @@ namespace Tizen.Uix.Tts.Tests * TEST CODE */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:GetSupportedVoices_RETURN_VALUE"); - TtsHelper.GetSupportedVoices(); - Assert.IsNotNull(TtsHelper.list, "Object is Null"); - Assert.IsInstanceOf>(TtsHelper.list, "Object is not of correct type"); - Assert.IsTrue(TtsHelper.list.Count > 0, "Value is not proper"); - foreach (SupportedVoice voice in TtsHelper.list) + obj.GetSupportedVoices(); + Assert.IsNotNull(obj.list, "Object is Null"); + Assert.IsInstanceOf>(obj.list, "Object is not of correct type"); + Assert.IsTrue(obj.list.Count > 0, "Value is not proper"); + foreach (SupportedVoice voice in obj.list) { TtsHelper.PrintLog(Type.DLogAndlogUtil, voice.VoiceType + " " + voice.Language); } @@ -253,7 +272,7 @@ namespace Tizen.Uix.Tts.Tests * TEST CODE */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:SetCredential_NO_EXCEPTION"); - TtsHelper.TtsInst.SetCredential("Credential"); + obj.TtsInst.SetCredential("Credential"); TtsHelper.PrintLog(Type.DLogAndlogUtil, "Completed TC:SetCredential_NO_EXCEPTION"); } catch (Exception e) @@ -276,15 +295,27 @@ namespace Tizen.Uix.Tts.Tests [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] public void SetCredential_ArgumentException_EXCEPTION() { - /* - * TEST CODE - */ - TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:SetCredential_ArgumentException_EXCEPTION"); - if (_featureSupported) + try + { + /* + * TEST CODE + */ + TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:SetCredential_ArgumentException_EXCEPTION"); + if (_featureSupported) + { + Assert.Throws(() => obj.TtsInst.SetCredential(null)); + } + TtsHelper.PrintLog(Type.DLogAndlogUtil, "Completed TC:SetCredential_ArgumentException_EXCEPTION"); + } + catch (Exception e) { - Assert.Throws(() => TtsHelper.TtsInst.SetCredential(null)); + TtsHelper.PrintLog(Type.DLogAndlogUtil, "Caught Exception :" + e.ToString()); + if (e is NotSupportedException) { + Assert.IsFalse(_featureSupported, "Invalid NotSupportedException"); + } else { + Assert.IsTrue(false, "Caught Exception" + e.ToString()); + } } - TtsHelper.PrintLog(Type.DLogAndlogUtil, "Completed TC:SetCredential_ArgumentException_EXCEPTION"); } [Test] @@ -302,7 +333,7 @@ namespace Tizen.Uix.Tts.Tests * TEST CODE */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:GetSpeedRange_RETURN_VALUE"); - SpeedRange range = TtsHelper.TtsInst.GetSpeedRange(); + SpeedRange range = obj.TtsInst.GetSpeedRange(); Assert.IsNotNull(range, "Object is Null"); Assert.IsInstanceOf(range, "Object is not of correct type"); TtsHelper.PrintLog(Type.DLogAndlogUtil, "Completed TC:GetSpeedRange_RETURN_VALUE"); @@ -333,8 +364,8 @@ namespace Tizen.Uix.Tts.Tests * TEST CODE */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:UtteranceStarted_ADD_EVENT"); - TtsHelper.TtsInst.UtteranceStarted += TtsInst_UtteranceStarted; - TtsHelper.TtsInst.UtteranceStarted -= TtsInst_UtteranceStarted; + obj.TtsInst.UtteranceStarted += TtsInst_UtteranceStarted; + obj.TtsInst.UtteranceStarted -= TtsInst_UtteranceStarted; TtsHelper.PrintLog(Type.DLogAndlogUtil, "Completed TC:UtteranceStarted_ADD_EVENT"); } catch (Exception e) @@ -363,8 +394,8 @@ namespace Tizen.Uix.Tts.Tests * TEST CODE */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:UtteranceCompleted_ADD_EVENT"); - TtsHelper.TtsInst.UtteranceCompleted += TtsInst_UtteranceCompleted; - TtsHelper.TtsInst.UtteranceCompleted -= TtsInst_UtteranceCompleted; + obj.TtsInst.UtteranceCompleted += TtsInst_UtteranceCompleted; + obj.TtsInst.UtteranceCompleted -= TtsInst_UtteranceCompleted; TtsHelper.PrintLog(Type.DLogAndlogUtil, "Completed TC:UtteranceCompleted_ADD_EVENT"); } catch (Exception e) @@ -393,9 +424,9 @@ namespace Tizen.Uix.Tts.Tests * TEST CODE */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:StateChanged_ADD_EVENT"); - TtsHelper.TtsInst.StateChanged += _tts_StateChanged; + obj.TtsInst.StateChanged += _tts_StateChanged; TtsHelper.PrintLog(Type.DLogAndlogUtil, "Completed TC:StateChanged_ADD_EVENT"); - TtsHelper.TtsInst.StateChanged -= _tts_StateChanged; + obj.TtsInst.StateChanged -= _tts_StateChanged; } catch (Exception e) { @@ -423,9 +454,9 @@ namespace Tizen.Uix.Tts.Tests * TEST CODE */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:ErrorOccurred_ADD_EVENT"); - TtsHelper.TtsInst.ErrorOccurred += _tts_ErrorOccurred; + obj.TtsInst.ErrorOccurred += _tts_ErrorOccurred; TtsHelper.PrintLog(Type.DLogAndlogUtil, "Completed TC:ErrorOccurred_ADD_EVENT"); - TtsHelper.TtsInst.ErrorOccurred -= _tts_ErrorOccurred; + obj.TtsInst.ErrorOccurred -= _tts_ErrorOccurred; } catch (Exception e) { @@ -453,8 +484,8 @@ namespace Tizen.Uix.Tts.Tests * TEST CODE */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:EngineChanged_ADD_EVENT"); - TtsHelper.TtsInst.EngineChanged += _tts_EngineChanged; - TtsHelper.TtsInst.EngineChanged -= _tts_EngineChanged; + obj.TtsInst.EngineChanged += _tts_EngineChanged; + obj.TtsInst.EngineChanged -= _tts_EngineChanged; TtsHelper.PrintLog(Type.DLogAndlogUtil, "Completed TC:EngineChanged_ADD_EVENT"); } catch (Exception e) @@ -483,8 +514,8 @@ namespace Tizen.Uix.Tts.Tests * TEST CODE */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:DefaultVoiceChanged_ADD_EVENT"); - TtsHelper.TtsInst.DefaultVoiceChanged += TtsInst_DefaultVoiceChanged; - TtsHelper.TtsInst.DefaultVoiceChanged -= TtsInst_DefaultVoiceChanged; + obj.TtsInst.DefaultVoiceChanged += TtsInst_DefaultVoiceChanged; + obj.TtsInst.DefaultVoiceChanged -= TtsInst_DefaultVoiceChanged; TtsHelper.PrintLog(Type.DLogAndlogUtil, "Completed TC:DefaultVoiceChanged_ADD_EVENT"); } catch (Exception e) @@ -507,7 +538,6 @@ namespace Tizen.Uix.Tts.Tests [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] public async Task Prepare_NO_EXCEPTION() { - TtsWrapper obj = new TtsWrapper(); try { /* @@ -551,7 +581,6 @@ namespace Tizen.Uix.Tts.Tests [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] public async Task SetPrivateData_NO_EXCEPTION() { - TtsWrapper obj = new TtsWrapper(); try { /* @@ -600,7 +629,6 @@ namespace Tizen.Uix.Tts.Tests [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] public async Task SetPrivateData_ARGUMENTEXCEPTION_EXCEPTION() { - TtsWrapper obj = new TtsWrapper(); try { /* @@ -652,7 +680,6 @@ namespace Tizen.Uix.Tts.Tests [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] public async Task GetPrivateData_RETURN_VALUE() { - TtsWrapper obj = new TtsWrapper(); try { /* @@ -706,7 +733,6 @@ namespace Tizen.Uix.Tts.Tests [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] public async Task GetPrivateData_ARGUMENTEXCEPTION() { - TtsWrapper obj = new TtsWrapper(); try { /* @@ -766,7 +792,6 @@ namespace Tizen.Uix.Tts.Tests * PRECONDITION * 1. Prepare */ - TtsWrapper obj = new TtsWrapper(); obj.DoPrepare(); await obj.WaitFlag(30); @@ -805,7 +830,6 @@ namespace Tizen.Uix.Tts.Tests * PRECONDITION * 1. Prepare */ - TtsWrapper obj = new TtsWrapper(); obj.DoPrepare(); await obj.WaitFlag(30); @@ -847,7 +871,6 @@ namespace Tizen.Uix.Tts.Tests [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] public async Task AddText_NO_EXCEPTION() { - TtsWrapper obj = new TtsWrapper(); try { /* @@ -897,14 +920,12 @@ namespace Tizen.Uix.Tts.Tests [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] public async Task AddText_ARGUMENT_COMBINATION() { - TtsWrapper obj = new TtsWrapper(); try { /* * PRECONDITION * 1. Prepare */ - obj.TtsInst = new Tizen.Uix.Tts.TtsClient(); obj.DoPrepare(); await obj.WaitFlag(30); @@ -912,11 +933,11 @@ namespace Tizen.Uix.Tts.Tests /* * TEST CODE */ - TtsHelper.GetSupportedVoices(); + obj.GetSupportedVoices(); TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:AddText_ARGUMENT_COMBINATION"); - Assert.True(TtsHelper.list.Count > 0, "Languages are not present"); - obj.TtsInst.AddText("Hai", TtsHelper.list[0].Language, 0, 0); - obj.TtsInst.AddText("Bye", TtsHelper.list[0].Language, 0, 0); + Assert.True(obj.list.Count > 0, "Languages are not present"); + obj.TtsInst.AddText("Hai", obj.list[0].Language, 0, 0); + obj.TtsInst.AddText("Bye", obj.list[0].Language, 0, 0); TtsHelper.PrintLog(Type.DLogAndlogUtil, "Completed TC:AddText_ARGUMENT_COMBINATION"); } catch (Exception e) @@ -953,7 +974,6 @@ namespace Tizen.Uix.Tts.Tests [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] public async Task Play_NO_EXCEPTION() { - TtsWrapper obj = new TtsWrapper(); try { /* @@ -962,9 +982,9 @@ namespace Tizen.Uix.Tts.Tests */ obj.DoPrepare(); await obj.WaitFlag(30); - TtsHelper.GetSupportedVoices(); - Assert.True(TtsHelper.list.Count > 0, "Languages are not present"); - obj.TtsInst.AddText("Hai", TtsHelper.list[0].Language, 0, 0); + obj.GetSupportedVoices(); + Assert.True(obj.list.Count > 0, "Languages are not present"); + obj.TtsInst.AddText("Hai", obj.list[0].Language, 0, 0); /* * TEST CODE @@ -1008,23 +1028,28 @@ namespace Tizen.Uix.Tts.Tests [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] public void Play_InvalidOperationException_EXCEPTION() { - TtsWrapper obj = new TtsWrapper(); - - /* - * PRECONDITION - * 1. Create Instance - */ - obj.TtsInst = new Tizen.Uix.Tts.TtsClient(); - - /* - * TEST CODE - */ - TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:Play_InvalidOperationException_EXCEPTION"); - if (_featureSupported) + try { - Assert.Throws(() => obj.TtsInst.Play()); + /* + * TEST CODE + */ + TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:Play_InvalidOperationException_EXCEPTION"); + if (_featureSupported) + { + Assert.Throws(() => obj.TtsInst.Play()); + } + TtsHelper.PrintLog(Type.DLogAndlogUtil, "Completed TC:Play_InvalidOperationException_EXCEPTION"); + } + catch (Exception e) + { + TtsHelper.PrintLog(Type.DLogAndlogUtil, "Caught Exception :" + e.ToString()); + if (e is NotSupportedException) { + Assert.IsFalse(_featureSupported, "Invalid NotSupportedException"); + } else { + Assert.IsTrue(false, "Caught Exception" + e.ToString()); + } } - TtsHelper.PrintLog(Type.DLogAndlogUtil, "Completed TC:Play_InvalidOperationException_EXCEPTION"); + } [Test] @@ -1036,23 +1061,27 @@ namespace Tizen.Uix.Tts.Tests [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] public void Pause_InvalidOperationException_EXCEPTION() { - TtsWrapper obj = new TtsWrapper(); - - /* - * PRECONDITION - * 1. Create Instance - */ - obj.TtsInst = new Tizen.Uix.Tts.TtsClient(); - - /* - * TEST CODE - */ - TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:Pause_InvalidOperationException_EXCEPTION"); - if (_featureSupported) + try { - Assert.Throws(() => obj.TtsInst.Pause()); + /* + * TEST CODE + */ + TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:Pause_InvalidOperationException_EXCEPTION"); + if (_featureSupported) + { + Assert.Throws(() => obj.TtsInst.Pause()); + } + TtsHelper.PrintLog(Type.DLogAndlogUtil, "Completed TC:Pause_InvalidOperationException_EXCEPTION"); + } + catch (Exception e) + { + TtsHelper.PrintLog(Type.DLogAndlogUtil, "Caught Exception :" + e.ToString()); + if (e is NotSupportedException) { + Assert.IsFalse(_featureSupported, "Invalid NotSupportedException"); + } else { + Assert.IsTrue(false, "Caught Exception" + e.ToString()); + } } - TtsHelper.PrintLog(Type.DLogAndlogUtil, "Completed TC:Pause_InvalidOperationException_EXCEPTION"); } [Test] @@ -1064,7 +1093,6 @@ namespace Tizen.Uix.Tts.Tests [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] public async Task Pause_NO_EXCEPTION() { - TtsWrapper obj = new TtsWrapper(); try { /* @@ -1073,9 +1101,9 @@ namespace Tizen.Uix.Tts.Tests */ obj.DoPrepare(); await obj.WaitFlag(15); - TtsHelper.GetSupportedVoices(); - Assert.True(TtsHelper.list.Count > 0, "Languages are not present"); - obj.TtsInst.AddText("Hai", TtsHelper.list[0].Language, 0, 0); + obj.GetSupportedVoices(); + Assert.True(obj.list.Count > 0, "Languages are not present"); + obj.TtsInst.AddText("Hai", obj.list[0].Language, 0, 0); obj.TtsInst.Play(); /* @@ -1119,7 +1147,6 @@ namespace Tizen.Uix.Tts.Tests [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] public async Task Stop_NO_EXCEPTION() { - TtsWrapper obj = new TtsWrapper(); try { /* @@ -1128,9 +1155,9 @@ namespace Tizen.Uix.Tts.Tests */ obj.DoPrepare(); await obj.WaitFlag(15); - TtsHelper.GetSupportedVoices(); - Assert.True(TtsHelper.list.Count > 0, "Languages are not present"); - obj.TtsInst.AddText("Hai", TtsHelper.list[0].Language, 0, 0); + obj.GetSupportedVoices(); + Assert.True(obj.list.Count > 0, "Languages are not present"); + obj.TtsInst.AddText("Hai", obj.list[0].Language, 0, 0); obj.TtsInst.Play(); /* @@ -1173,22 +1200,27 @@ namespace Tizen.Uix.Tts.Tests [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] public void Stop_InvalidOperationException_EXCEPTION() { - TtsWrapper obj = new TtsWrapper(); - /* - * PRECONDITION - * 1. Create Instance - */ - obj.TtsInst = new Tizen.Uix.Tts.TtsClient(); - - /* - * TEST CODE - */ - TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:Stop_InvalidOperationException_EXCEPTION"); - if (_featureSupported) + try { - Assert.Throws(() => obj.TtsInst.Stop()); + /* + * TEST CODE + */ + TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:Stop_InvalidOperationException_EXCEPTION"); + if (_featureSupported) + { + Assert.Throws(() => obj.TtsInst.Stop()); + } + TtsHelper.PrintLog(Type.DLogAndlogUtil, "Completed TC:Stop_InvalidOperationException_EXCEPTION"); + } + catch (Exception e) + { + TtsHelper.PrintLog(Type.DLogAndlogUtil, "Caught Exception :" + e.ToString()); + if (e is NotSupportedException) { + Assert.IsFalse(_featureSupported, "Invalid NotSupportedException"); + } else { + Assert.IsTrue(false, "Caught Exception" + e.ToString()); + } } - TtsHelper.PrintLog(Type.DLogAndlogUtil, "Completed TC:Stop_InvalidOperationException_EXCEPTION"); } [Test] @@ -1200,16 +1232,9 @@ namespace Tizen.Uix.Tts.Tests [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] public void Unprepare_INVALIDOPEARTION_EXCEPTION() { - TtsWrapper obj = new TtsWrapper(); try { /* - * PRECONDITION - * 1. Create Instance - */ - obj.TtsInst = new Tizen.Uix.Tts.TtsClient(); - - /* * TEST CODE */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:Unprepare_INVALIDOPEARTION_EXCEPTION"); @@ -1239,16 +1264,9 @@ namespace Tizen.Uix.Tts.Tests [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] public void Dispose_Working() { - TtsWrapper obj = new TtsWrapper(); try { /* - * PRECONDITION - * 1. Create Instance - */ - obj.TtsInst = new Tizen.Uix.Tts.TtsClient(); - - /* * TEST CODE */ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:Dispose_Working"); diff --git a/tct-suite-vs/Tizen.Tts.Tests/testcase/TSUtteranceEventArgs.cs b/tct-suite-vs/Tizen.Tts.Tests/testcase/TSUtteranceEventArgs.cs index 0ebc363..c000701 100755 --- a/tct-suite-vs/Tizen.Tts.Tests/testcase/TSUtteranceEventArgs.cs +++ b/tct-suite-vs/Tizen.Tts.Tests/testcase/TSUtteranceEventArgs.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading.Tasks; using NUnit.Framework; @@ -8,6 +8,7 @@ namespace Tizen.Uix.Tts.Tests [Description("Tizen.Uix.Tts.UtteranceEventArgs Tests")] public class UtteranceEventArgsTests { + TtsWrapper obj = null; private static bool _featureSupported = false; private static string _ttsFeature = "http://tizen.org/feature/speech.synthesis"; @@ -16,6 +17,25 @@ namespace Tizen.Uix.Tts.Tests { TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing Init"); System.Information.TryGetValue(_ttsFeature, out _featureSupported); + + try + { + if (obj == null) + obj = new TtsWrapper(); + + Assert.IsInstanceOf(obj.TtsInst, "Tts object is not of correct instance"); + Assert.IsNotNull(obj.TtsInst); + } + catch (Exception e) + { + TtsHelper.PrintLog(Type.DLogAndlogUtil, "Caught Exception :" + e.ToString()); + if (e is NotSupportedException) { + Assert.IsFalse(_featureSupported, "Invalid NotSupportedException"); + Assert.Pass("TTS speech.synthesis is Not supported"); + } else { + Assert.IsTrue(false, "Caught Exception" + e.ToString()); + } + } } [TearDown] @@ -33,14 +53,12 @@ namespace Tizen.Uix.Tts.Tests [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] public async Task UtteranceId_READ_ONLY() { - TtsWrapper obj = new TtsWrapper(); try { /* * PRECONDITION * 1. Prepare */ - obj.TtsInst = new Tizen.Uix.Tts.TtsClient(); obj.ReadyStateFlag = false; obj.TestFlag = false; obj.TtsInst.StateChanged += obj.TtsStateChanged; @@ -48,9 +66,9 @@ namespace Tizen.Uix.Tts.Tests obj.TtsInst.DefaultVoiceChanged += TtsInst_DefaultVoiceChanged; obj.TtsInst.Prepare(); await obj.WaitFlag(15); - TtsHelper.GetSupportedVoices(); - Assert.True(TtsHelper.list.Count > 0, "Languages are not present"); - obj.TtsInst.AddText("Hai how are you", TtsHelper.list[0].Language, 0, 0); + obj.GetSupportedVoices(); + Assert.True(obj.list.Count > 0, "Languages are not present"); + obj.TtsInst.AddText("Hai how are you", obj.list[0].Language, 0, 0); obj.TtsInst.Play(); obj.TestFlag = false; await obj.WaitFlag(15);