-using System.Collections.Generic;
+using System.Collections.Generic;
using NUnit.Framework;
using System;
using System.Threading.Tasks;
internal bool UtteranceIdFlag = false;
internal bool TtsDefaultVoiceChangedFlag = false;
internal bool TtsEngineChangedFlag = false;
+ internal bool TtsScreenReaderChangedFlag = false;
internal bool TtsErrorOccurredFlag = false;
internal bool TtsUtteranceStartedFlag = false;
internal bool TtsUtteranceCompletedFlag = false;
internal string TtsErrorOccurredMsg;
internal Error TtsErrorOccurredErrorValue;
internal string EngineId;
+ internal bool isScreenReaderOn;
internal bool NeedCredential;
internal SupportedVoice VoiceType;
internal List<SupportedVoice> list;
TtsInst.DefaultVoiceChanged += TtsDefaultVoiceChanged;
TtsInst.ErrorOccurred += TtsErrorOccurred;
TtsInst.EngineChanged += TtsInst_EngineChanged;
+ TtsInst.ScreenReaderChanged += TtsScreenReaderChanged;
TtsInst.Prepare();
}
TtsInst.DefaultVoiceChanged -= TtsDefaultVoiceChanged;
TtsInst.ErrorOccurred -= TtsErrorOccurred;
TtsInst.EngineChanged -= TtsInst_EngineChanged;
+ TtsInst.ScreenReaderChanged -= TtsScreenReaderChanged;
}
private void initFlags()
{
TtsDefaultVoiceChangedFlag = false;
TtsEngineChangedFlag = false;
+ TtsScreenReaderChangedFlag = false;
TtsErrorOccurredFlag = false;
TtsUtteranceStartedFlag = false;
TtsUtteranceCompletedFlag = false;
TtsEngineChangedFlag = true;
}
+ internal void TtsScreenReaderChanged(object sender, ScreenReaderChangedEventArgs e)
+ {
+ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Screen reader Changed, IsOn:" + e.IsOn);
+ isScreenReaderOn = e.IsOn;
+ TtsScreenReaderChangedFlag = true;
+ }
+
internal void TtsStateChanged(object sender, StateChangedEventArgs e)
{
TtsHelper.PrintLog(Type.DLogAndlogUtil, "State Changed, Previous State:" + e.Previous + " Current State:" + e.Current);
return await task.Task;
}
+ internal async Task<bool> GenerateScreenReaderChangeScenario()
+ {
+ var task = new TaskCompletionSource<bool>();
+ try
+ {
+ /*
+ * PRECONDITION
+ * 1. Prepare
+ */
+ TtsHelper.PrintLog(Type.DLogAndlogUtil, "GenerateScreenReaderChangedScenario");
+ initFlags();
+ TtsInst.ScreenReaderChanged += TtsScreenReaderChanged;
+ CreateButton("Screen Reader Changed");
+ await ManualTest.WaitForConfirm();
+ Assert.IsTrue(TtsScreenReaderChangedFlag == true, "Event Did not occur");
+ }
+ catch (Exception e)
+ {
+ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Caught Exception" + e.ToString());
+ Assert.IsTrue(false, "Caught Exception" + e.ToString());
+ }
+ finally
+ {
+ TtsInst.ScreenReaderChanged -= TtsScreenReaderChanged;
+ }
+ task.SetResult(true);
+ return await task.Task;
+ }
internal void GetSupportedVoices()
{
--- /dev/null
+using NUnit.Framework;
+using System;
+using System.Threading.Tasks;
+
+namespace Tizen.Uix.Tts.Tests
+{
+
+ [TestFixture]
+ [Description("Tizen.Uix.Tts.ScreenReaderChangedEventArgs Tests")]
+ public class ScreenReaderChangedTests
+ {
+ private static bool _featureSupported = false;
+ private static bool _isAvailable = false;
+ private static string SsFeature = "http://tizen.org/feature/speech.synthesis";
+
+ [SetUp]
+ public void Init()
+ {
+ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing Init");
+ System.Information.TryGetValue(SsFeature, out _featureSupported);
+
+ string profile;
+ System.Information.TryGetValue("http://tizen.org/feature/profile", out profile);
+ _isAvailable = "wearable".Equals(profile);
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing Destroy");
+ _featureSupported = false;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check propreties of ScreenReaderChanged Event")]
+ [Property("SPEC", "Tizen.Uix.Tts.ScreenReaderChangedEventArgs.IsOn A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Suyeon Hwang, stom.hwang@samsung.com")]
+ [Precondition(1, "Can not test on Wearable profiles. Please mark pass on Wearable profiles. (Impossible to turn on screen reader on Wearable profiles)")]
+ [Precondition(2, "Screen reader option should be turned off")]
+ [Step(1, "Tap the Run button. If Tts feature is not supported, TC will automatically pass.")]
+ [Step(2, "Turn on screen reader from Home > Settings > Accessibility > Screen Reader (On TV : Settings > General > Accessibility > Voice Guide)")]
+ [Step(3, "Click 'Screen Reader Changed Button'")]
+ [Postcondition(1, "N/A")]
+ public async Task IsOn_GET()
+ {
+ if (_isAvailable)
+ {
+ TtsUiHelper.DisplayLabel("Can not test on Wearable profiles.\nPlease mark pass on Wearable profiles.\n(Impossible to turn on screen reader on Wearable profiles)");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:IsOn_GET");
+ try
+ {
+ TtsWrapper obj = new TtsWrapper();
+ await obj.GenerateScreenReaderChangeScenario();
+ if (_featureSupported)
+ {
+ Assert.IsTrue(obj.isScreenReaderOn);
+ }
+ }
+ 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:IsOn_GET");
+ }
+ }
+}
{
}
+ private static void _tts_ScreenReaderChanged(object sender, ScreenReaderChangedEventArgs e)
+ {
+ }
+
private static void TtsInst_DefaultVoiceChanged(object sender, DefaultVoiceChangedEventArgs e)
{
}
[Test]
[Category("P1")]
+ [Description("Check working of Tts IsScreenReaderOn Property for no exception")]
+ [Property("SPEC", "Tizen.Uix.Tts.TtsClient.IsScreenReaderOn A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Suyeon Hwang, stom.hwang@samsung.com")]
+ public void IsScreenReaderOn_READ_ONLY()
+ {
+ try
+ {
+ /*
+ * TEST CODE
+ */
+ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:IsScreenReaderOn_READ_ONLY");
+ var isScreenReaderOn = obj.TtsInst.IsScreenReaderOn;
+ TtsHelper.PrintLog(Type.DLogAndlogUtil, "IsScreenReaderOn: " + isScreenReaderOn);
+ Assert.IsFalse(isScreenReaderOn, "Screen reader should be off by default");
+ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Completed TC:IsScreenReaderOn_READ_ONLY");
+ }
+ 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());
+ }
+ }
+ }
+
+ [Test]
+ [Category("P1")]
[Description("Check working of Tts CurrentState Property")]
[Property("SPEC", "Tizen.Uix.Tts.TtsClient.CurrentState A")]
[Property("SPEC_URL", "-")]
[Test]
[Category("P1")]
+ [Description("Adding Tts ScreenReaderChanged Event and check for no exception")]
+ [Property("SPEC", "Tizen.Uix.Tts.TtsClient.ScreenReaderChanged E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Suyeon Hwang, stom.hwang@samsung.com")]
+ public void ScreenReaderChanged_ADD_EVENT()
+ {
+ try
+ {
+ /*
+ * TEST CODE
+ */
+ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Executing TC:ScreenReaderChanged_ADD_EVENT");
+ obj.TtsInst.ScreenReaderChanged += _tts_ScreenReaderChanged;
+ obj.TtsInst.ScreenReaderChanged -= _tts_ScreenReaderChanged;
+ TtsHelper.PrintLog(Type.DLogAndlogUtil, "Completed TC:ScreenReaderChanged_ADD_EVENT");
+ }
+ 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());
+ }
+ }
+ }
+
+ [Test]
+ [Category("P1")]
[Description("Adding Tts DefaultVoiceChanged Event and check for no exception")]
[Property("SPEC", "Tizen.Uix.Tts.TtsClient.DefaultVoiceChanged E")]
[Property("SPEC_URL", "-")]