[TTS][TCSACR-449][Add new TCs for ScreenReaderChanged event and IsScreenReaderOn... 48/263548/6
authorSuyeon Hwang <stom.hwang@samsung.com>
Mon, 6 Sep 2021 07:36:37 +0000 (16:36 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Wed, 27 Oct 2021 11:58:34 +0000 (20:58 +0900)
Change-Id: I9cfe083e5c6bcbfa5deb44d5a1f28755c33f9507
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
tct-suite-vs/Tizen.Tts.Manual.Tests/support/TtsWrapper.cs
tct-suite-vs/Tizen.Tts.Manual.Tests/testcase/TSScreenReaderChangedEventArgs.cs [new file with mode: 0755]
tct-suite-vs/Tizen.Tts.Tests/testcase/TSTtsClient.cs

index fc577f2..3eb9a6d 100755 (executable)
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
 using NUnit.Framework;
 using System;
 using System.Threading.Tasks;
@@ -28,6 +28,7 @@ namespace Tizen.Uix.Tts.Tests
         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;
@@ -40,6 +41,7 @@ namespace Tizen.Uix.Tts.Tests
         internal string TtsErrorOccurredMsg;
         internal Error TtsErrorOccurredErrorValue;
         internal string EngineId;
+        internal bool isScreenReaderOn;
         internal bool NeedCredential;
         internal SupportedVoice VoiceType;
         internal List<SupportedVoice> list;
@@ -59,6 +61,7 @@ namespace Tizen.Uix.Tts.Tests
             TtsInst.DefaultVoiceChanged += TtsDefaultVoiceChanged;
             TtsInst.ErrorOccurred += TtsErrorOccurred;
             TtsInst.EngineChanged += TtsInst_EngineChanged;
+            TtsInst.ScreenReaderChanged += TtsScreenReaderChanged;
             TtsInst.Prepare();
         }
 
@@ -78,12 +81,14 @@ namespace Tizen.Uix.Tts.Tests
             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;
@@ -153,6 +158,13 @@ namespace Tizen.Uix.Tts.Tests
             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);
@@ -279,6 +291,34 @@ namespace Tizen.Uix.Tts.Tests
             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()
         {
diff --git a/tct-suite-vs/Tizen.Tts.Manual.Tests/testcase/TSScreenReaderChangedEventArgs.cs b/tct-suite-vs/Tizen.Tts.Manual.Tests/testcase/TSScreenReaderChangedEventArgs.cs
new file mode 100755 (executable)
index 0000000..1ca6ea5
--- /dev/null
@@ -0,0 +1,77 @@
+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");
+        }
+    }
+}
index ebe2125..d9bfe3c 100755 (executable)
@@ -65,6 +65,10 @@ namespace Tizen.Uix.Tts.Tests
         {
         }
 
+        private static void _tts_ScreenReaderChanged(object sender, ScreenReaderChangedEventArgs e)
+        {
+        }
+
         private static void TtsInst_DefaultVoiceChanged(object sender, DefaultVoiceChangedEventArgs e)
         {
         }
@@ -167,6 +171,37 @@ namespace Tizen.Uix.Tts.Tests
 
         [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", "-")]
@@ -501,6 +536,36 @@ namespace Tizen.Uix.Tts.Tests
 
         [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", "-")]