[MediaController][TCSACR-283] Add capability method for subtitle, 360 mode 43/215443/1
authorHaesu Gwon <haesu.gwon@samsung.com>
Tue, 8 Oct 2019 07:21:23 +0000 (16:21 +0900)
committerHaesu Gwon <haesu.gwon@samsung.com>
Tue, 8 Oct 2019 07:21:23 +0000 (16:21 +0900)
- Additionally, this patch include method name change like the following:
  GetDisplayRotationapability() -> GetDisplayRotationCapability()

Change-Id: I3ec85bd30b5139f6b2b84ed912867a2361401b2c

tct-suite-vs/Tizen.MediaController.Tests/testcase/TSMediaControlServer.cs
tct-suite-vs/Tizen.MediaController.Tests/testcase/TSMediaController.cs

index 9dab844..2edc091 100644 (file)
@@ -1157,7 +1157,7 @@ namespace Tizen.Multimedia.Remoting.Tests
                 foreach (Rotation rotation in Enum.GetValues(typeof(Rotation)))
                 {
                     MediaControlServer.SetDisplayRotationCapability(rotation, MediaControlCapabilitySupport.Supported);
-                    Assert.That(controller.GetDisplayRotationapability().Contains(rotation), "Should be same value.");
+                    Assert.That(controller.GetDisplayRotationCapability().Contains(rotation), "Should be same value.");
                 }
             }
         }
@@ -1226,7 +1226,7 @@ namespace Tizen.Multimedia.Remoting.Tests
 
                 Assert.That(() => MediaControlServer.SetDisplayRotationCapabilities(setRotationsDict), Throws.Nothing);
 
-                var supportedRotations = controller.GetDisplayRotationapability();
+                var supportedRotations = controller.GetDisplayRotationCapability();
                 Assert.That(supportedRotations.Count(), Is.EqualTo(setRotations.Count), "Should be same value.");
 
                 foreach (var rotation in supportedRotations)
@@ -1294,6 +1294,122 @@ namespace Tizen.Multimedia.Remoting.Tests
 
         [Test]
         [Category("P1")]
+        [Description("Sets 360 mode capability")]
+        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetMode360Capability M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void SetMode360Capability_RETURN_VALUE()
+        {
+            using (var manager = new MediaControllerManager())
+            {
+                var controller = manager.GetActiveControllers().Single(
+                        c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+                MediaControlServer.SetMode360Capability(MediaControlCapabilitySupport.NotSupported);
+                Assert.That(controller.GetMode360Capability(), Is.EqualTo(MediaControlCapabilitySupport.NotSupported),
+                    "Should be same value");
+
+                MediaControlServer.SetMode360Capability(MediaControlCapabilitySupport.Supported);
+                Assert.That(controller.GetMode360Capability(), Is.EqualTo(MediaControlCapabilitySupport.Supported),
+                    "Should be same value");
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check whether SetMode360Capability throws exception if parameter is invalid")]
+        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetMode360Capability M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void SetMode360Capability_THROWS_IF_PARAM_IS_INVALID()
+        {
+            Assert.Throws<ArgumentException>(() =>
+                MediaControlServer.SetMode360Capability(MediaControlCapabilitySupport.Supported - 1));
+
+            Assert.Throws<ArgumentException>(() =>
+                MediaControlServer.SetMode360Capability(MediaControlCapabilitySupport.NotDecided));
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check whether SetMode360Capability throws exception if server is not running")]
+        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetMode360Capability M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void SetMode360Capability_THROWS_SERVER_IS_NOT_RUNNING()
+        {
+            if (MediaControlServer.IsRunning)
+            {
+                MediaControlServer.Stop();
+            }
+
+            Assert.Throws<InvalidOperationException>(() => MediaControlServer.SetMode360Capability(
+                MediaControlCapabilitySupport.Supported));
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Sets subtitle mode capability")]
+        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetSubtitleModeCapability M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void SetSubtitleModeCapability_RETURN_VALUE()
+        {
+            using (var manager = new MediaControllerManager())
+            {
+                var controller = manager.GetActiveControllers().Single(
+                        c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+                MediaControlServer.SetSubtitleModeCapability(MediaControlCapabilitySupport.NotSupported);
+                Assert.That(controller.GetSubtitleModeCapability(), Is.EqualTo(MediaControlCapabilitySupport.NotSupported),
+                    "Should be same value");
+
+                MediaControlServer.SetSubtitleModeCapability(MediaControlCapabilitySupport.Supported);
+                Assert.That(controller.GetSubtitleModeCapability(), Is.EqualTo(MediaControlCapabilitySupport.Supported),
+                    "Should be same value");
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check whether SetSubtitleModeCapability throws exception if parameter is invalid")]
+        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetSubtitleModeCapability M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void SetSubtitleModeCapability_THROWS_IF_PARAM_IS_INVALID()
+        {
+            Assert.Throws<ArgumentException>(() =>
+                MediaControlServer.SetSubtitleModeCapability(MediaControlCapabilitySupport.Supported - 1));
+
+            Assert.Throws<ArgumentException>(() =>
+                MediaControlServer.SetSubtitleModeCapability(MediaControlCapabilitySupport.NotDecided));
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check whether SetSubtitleModeCapability throws exception if server is not running")]
+        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetSubtitleModeCapability M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void SetSubtitleModeCapability_THROWS_SERVER_IS_NOT_RUNNING()
+        {
+            if (MediaControlServer.IsRunning)
+            {
+                MediaControlServer.Stop();
+            }
+
+            Assert.Throws<InvalidOperationException>(() => MediaControlServer.SetSubtitleModeCapability(
+                MediaControlCapabilitySupport.Supported));
+        }
+
+        [Test]
+        [Category("P1")]
         [Description("Invoked when server sends custom command")]
         [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.CustomCommandReceived E")]
         [Property("SPEC_URL", "-")]
index 5c97bf1..0f76844 100644 (file)
@@ -699,11 +699,11 @@ namespace Tizen.Multimedia.Remoting.Tests
         [Test]
         [Category("P1")]
         [Description("Gets display rotation capabilities")]
-        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetDisplayRotationapability M")]
+        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetDisplayRotationCapability M")]
         [Property("SPEC_URL", "-")]
         [Property("CRITERIA", "MR")]
         [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
-        public void GetDisplayRotationapability_RETURN_VALUE()
+        public void GetDisplayRotationCapability_RETURN_VALUE()
         {
             var setRotations = new List<Rotation>()
             {
@@ -718,7 +718,7 @@ namespace Tizen.Multimedia.Remoting.Tests
 
             Assert.That(() => MediaControlServer.SetDisplayRotationCapabilities(setRotationsDict), Throws.Nothing);
 
-            var supportedRotations = _controller.GetDisplayRotationapability();
+            var supportedRotations = _controller.GetDisplayRotationCapability();
             Assert.That(supportedRotations.Count(), Is.EqualTo(setRotations.Count), "Should be same value.");
 
             foreach (var rotation in supportedRotations)
@@ -729,26 +729,26 @@ namespace Tizen.Multimedia.Remoting.Tests
 
         [Test]
         [Category("P2")]
-        [Description("Check whether GetDisplayRotationapability throws exception if parameter is invalid")]
-        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetDisplayRotationapability M")]
+        [Description("Check whether GetDisplayRotationCapability throws exception if parameter is invalid")]
+        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetDisplayRotationCapability M")]
         [Property("SPEC_URL", "-")]
         [Property("CRITERIA", "MEX")]
         [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
-        public void GetDisplayRotationapability_OBJECT_IS_DISPOSED()
+        public void GetDisplayRotationCapability_OBJECT_IS_DISPOSED()
         {
             _manager.Dispose();
 
-            Assert.Throws<ObjectDisposedException>(() => _controller.GetDisplayRotationapability());
+            Assert.Throws<ObjectDisposedException>(() => _controller.GetDisplayRotationCapability());
         }
 
         [Test]
         [Category("P2")]
-        [Description("Check whether GetDisplayRotationapability throws exception if server has already benn stopped")]
-        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetDisplayRotationapability M")]
+        [Description("Check whether GetDisplayRotationCapability throws exception if server has already benn stopped")]
+        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetDisplayRotationCapability M")]
         [Property("SPEC_URL", "-")]
         [Property("CRITERIA", "MEX")]
         [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
-        public async Task GetDisplayRotationapability_THROWS_SERVER_IS_ALREADY_STOPPED()
+        public async Task GetDisplayRotationCapability_THROWS_SERVER_IS_ALREADY_STOPPED()
         {
             using (var eventWaiter = EventAwaiter<MediaControlServerStoppedEventArgs>.Create())
             {
@@ -758,7 +758,117 @@ namespace Tizen.Multimedia.Remoting.Tests
 
                 await eventWaiter.IsRaisedAsync();
 
-                Assert.Throws<InvalidOperationException>(() => _controller.GetDisplayRotationapability());
+                Assert.Throws<InvalidOperationException>(() => _controller.GetDisplayRotationCapability());
+
+                _manager.ServerStopped -= eventWaiter;
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Sets 360 mode capability and compare it with the value previously set")]
+        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetMode360Capability M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void GetMode360Capability_RETURN_VALUE()
+        {
+            MediaControlServer.SetMode360Capability(MediaControlCapabilitySupport.NotSupported);
+            Assert.That(_controller.GetMode360Capability(), Is.EqualTo(MediaControlCapabilitySupport.NotSupported),
+                "Should be same value");
+
+            MediaControlServer.SetMode360Capability(MediaControlCapabilitySupport.Supported);
+            Assert.That(_controller.GetMode360Capability(), Is.EqualTo(MediaControlCapabilitySupport.Supported),
+                "Should be same value");
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check whether GetMode360Capability throws exception if parameter is invalid")]
+        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetMode360Capability M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void GetMode360Capability_OBJECT_IS_DISPOSED()
+        {
+            _manager.Dispose();
+
+            Assert.Throws<ObjectDisposedException>(() => _controller.GetMode360Capability());
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check whether GetMode360Capability throws exception if server has already benn stopped")]
+        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetMode360Capability M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public async Task GetMode360Capability_THROWS_SERVER_IS_ALREADY_STOPPED()
+        {
+            using (var eventWaiter = EventAwaiter<MediaControlServerStoppedEventArgs>.Create())
+            {
+                _manager.ServerStopped += eventWaiter;
+
+                MediaControlServer.Stop();
+
+                await eventWaiter.IsRaisedAsync();
+
+                Assert.Throws<InvalidOperationException>(() => _controller.GetMode360Capability());
+
+                _manager.ServerStopped -= eventWaiter;
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Sets subtitle mode capability and compare it with the value previously set")]
+        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetSubtitleModeCapability M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void GetSubtitleModeCapability_RETURN_VALUE()
+        {
+            MediaControlServer.SetSubtitleModeCapability(MediaControlCapabilitySupport.NotSupported);
+            Assert.That(_controller.GetSubtitleModeCapability(), Is.EqualTo(MediaControlCapabilitySupport.NotSupported),
+                "Should be same value");
+
+            MediaControlServer.SetSubtitleModeCapability(MediaControlCapabilitySupport.Supported);
+            Assert.That(_controller.GetSubtitleModeCapability(), Is.EqualTo(MediaControlCapabilitySupport.Supported),
+                "Should be same value");
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check whether GetSubtitleModeCapability throws exception if parameter is invalid")]
+        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetSubtitleModeCapability M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void GetSubtitleModeCapability_OBJECT_IS_DISPOSED()
+        {
+            _manager.Dispose();
+
+            Assert.Throws<ObjectDisposedException>(() => _controller.GetSubtitleModeCapability());
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check whether GetSubtitleModeCapability throws exception if server has already benn stopped")]
+        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetSubtitleModeCapability M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public async Task GetSubtitleModeCapability_THROWS_SERVER_IS_ALREADY_STOPPED()
+        {
+            using (var eventWaiter = EventAwaiter<MediaControlServerStoppedEventArgs>.Create())
+            {
+                _manager.ServerStopped += eventWaiter;
+
+                MediaControlServer.Stop();
+
+                await eventWaiter.IsRaisedAsync();
+
+                Assert.Throws<InvalidOperationException>(() => _controller.GetSubtitleModeCapability());
 
                 _manager.ServerStopped -= eventWaiter;
             }