[MediaPlayer][ACR-151] add TC for setting/getting adaptive variants and buffering... 38/182438/4
authornam <just.nam@samsung.com>
Mon, 25 Jun 2018 06:40:34 +0000 (15:40 +0900)
committernam <just.nam@samsung.com>
Wed, 27 Jun 2018 05:03:54 +0000 (14:03 +0900)
Change-Id: I1e1c39c9e98ee593ac265325f3271c0447948e83

tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSAdaptiveVariants.cs [new file with mode: 0644]
tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs
tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayerBufferingTime.cs [new file with mode: 0644]
tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSVariantInfo.cs [new file with mode: 0644]

diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSAdaptiveVariants.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSAdaptiveVariants.cs
new file mode 100644 (file)
index 0000000..78fe8af
--- /dev/null
@@ -0,0 +1,158 @@
+using NUnit.Framework;
+using System.Threading.Tasks;
+using System.Linq;
+using System.Collections;
+using System;
+
+namespace Tizen.Multimedia.Tests
+{
+    [TestFixture]
+    [Description("Tizen.Multimedia.AdaptiveVariants Tests")]
+    public class AdaptiveVariantsTests : TestBase
+    {
+        [OneTimeSetUp]
+        public static void Init()
+        {
+            PreconditionUtils.SetPrecondition();
+        }
+        internal static readonly MediaUriSource AdaptiveStreamingSource = new MediaUriSource(PreconditionUtils.ADAPTIVE_STREAMING_URL);
+
+        [Test]
+        [Category("P1")]
+        [Description("check default value of MaxLimit")]
+        [Property("SPEC", "Tizen.Multimedia.AdaptiveVariants.GetMaxLimit M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void GetMaxLimit_DEFAULT()
+        {
+            Assert.That(TestPlayer.AdaptiveVariants.GetMaxLimit, Is.EqualTo(new VariantInfo(-1, -1, -1)));
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Any attempt to access the GetMaxLimit if the player has been disposed of")]
+        [Property("SPEC", "Tizen.Multimedia.AdaptiveVariants.GetMaxLimit M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void GetMaxLimit_DISPOSED()
+        {
+            GetIdlePlayer().Dispose();
+
+            Assert.That(TestPlayer.AdaptiveVariants.GetMaxLimit, Throws.TypeOf<ObjectDisposedException>());
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("check whether MaxLimit is set to default value except for bandwidth")]
+        [Property("SPEC", "Tizen.Multimedia.AdaptiveVariants.SetMaxLimit M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void SetMaxLimit_CHECK_DEFAULT_SET()
+        {
+            const int bandWidth = 1000;
+
+            TestPlayer.AdaptiveVariants.SetMaxLimit(bandWidth);
+
+            Assert.That(TestPlayer.AdaptiveVariants.GetMaxLimit,
+                Is.EqualTo(new VariantInfo(bandWidth)), "Invalid value.");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("check whether MaxLimit is set")]
+        [Property("SPEC", "Tizen.Multimedia.AdaptiveVariants.SetMaxLimit M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void SetMaxLimit_CHECK()
+        {
+            const int newValue = 1111;
+
+            TestPlayer.AdaptiveVariants.SetMaxLimit(newValue, newValue, newValue);
+
+            Assert.That(TestPlayer.AdaptiveVariants.GetMaxLimit,
+                Is.EqualTo(new VariantInfo(newValue, newValue, newValue)), "Invalid value.");
+
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Any attempt to access the MaxLimit if the player has been disposed of")]
+        [Property("SPEC", "Tizen.Multimedia.AdaptiveVariants.SetMaxLimit M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void SetMaxLimit_DISPOSED()
+        {
+            GetIdlePlayer().Dispose();
+
+            Assert.That(() => TestPlayer.AdaptiveVariants.SetMaxLimit(100),
+                Throws.TypeOf<ObjectDisposedException>());
+        }
+
+
+        [Test]
+        [Category("P1")]
+        [Description("SetMaxLimit throws if out of range")]
+        [Property("SPEC", "Tizen.Multimedia.AdaptiveVariants.SetMaxLimit M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void SetMaxLimit_OUT_OF_RANGE()
+        {
+            Assert.That(() => TestPlayer.AdaptiveVariants.SetMaxLimit(123, 0, -2),
+                Throws.TypeOf<ArgumentOutOfRangeException>());
+            Assert.That(() => TestPlayer.AdaptiveVariants.SetMaxLimit(-2),
+                Throws.TypeOf<ArgumentOutOfRangeException>());
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test AdaptiveVariants supported property. Supported list should be greater than 0")]
+        [Property("SPEC", "Tizen.Multimedia.AdaptiveVariants.AvailableAdaptiveVariants A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRO")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public async Task AvailableAdaptiveVariants_PROPERTY_READ_ONLY()
+        {
+            var player = await GetPreparedPlayer(AdaptiveStreamingSource, DefaultDisplay);
+            IList result = player.AdaptiveVariants.AvailableAdaptiveVariants.ToList();
+            Assert.IsNotNull(result, "The list of adaptive variants should not be null.");
+            Assert.IsNotEmpty(result, "The list of adaptive variants should not be empty.");
+            Assert.Greater(result.Count, 0, "The list of adaptive variants should be greater than 0");
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Any attempt to access the AvailableAdaptiveVariants if the player has been disposed of")]
+        [Property("SPEC", "Tizen.Multimedia.AdaptiveVariants.AvailableAdaptiveVariants A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PEX")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void AvailableAdaptiveVariants_DISPOSED()
+        {
+            GetIdlePlayer().Dispose();
+
+            Assert.That(() => TestPlayer.AdaptiveVariants.AvailableAdaptiveVariants.ToList(),
+                Throws.TypeOf<ObjectDisposedException>());
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Any attempt to access the AvailableAdaptiveVariants if the player is not in the specified state")]
+        [Property("SPEC", "Tizen.Multimedia.AdaptiveVariants.AvailableAdaptiveVariants A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PEX")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void AvailableAdaptiveVariants_THROWS_IF_STATE_NOT_VALID()
+        {
+            GetIdlePlayer();
+
+            Assert.That(() => TestPlayer.AdaptiveVariants.AvailableAdaptiveVariants.ToList(),
+                Throws.InvalidOperationException);
+        }
+    }
+}
index 5cf677e..be6bc92 100644 (file)
@@ -586,6 +586,83 @@ namespace Tizen.Multimedia.Tests
         }
         #endregion
 
+        #region BufferingTime
+
+        [Test]
+        [Category("P1")]
+        [Description("BufferingTime default value")]
+        [Property("SPEC", "Tizen.Multimedia.Player.BufferingTime A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PDV")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void BufferingTime_DEFAULT()
+        {
+            Assert.That(TestPlayer.BufferingTime, Is.EqualTo(new PlayerBufferingTime(0, 0)));
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("BufferingTime set")]
+        [Property("SPEC", "Tizen.Multimedia.Player.BufferingTime A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PCST")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void BufferingTime_SET_GET()
+        {
+            PlayerBufferingTime newValue = new PlayerBufferingTime(1000, 2000);
+
+            TestPlayer.BufferingTime = newValue;
+
+            Assert.That(TestPlayer.BufferingTime.PreBufferMillisecond,
+                Is.EqualTo(newValue.PreBufferMillisecond), "Invalid value.");
+            Assert.That(TestPlayer.BufferingTime.ReBufferMillisecond,
+                Is.EqualTo(newValue.ReBufferMillisecond), "Invalid value.");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("BufferingTime throws if out of range")]
+        [Property("SPEC", "Tizen.Multimedia.Player.BufferingTime A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PEX")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void BufferingTime_OUT_OF_RANGE()
+        {
+            Assert.That(() => TestPlayer.BufferingTime = new PlayerBufferingTime(0, -1),
+                Throws.TypeOf<ArgumentOutOfRangeException>());
+            Assert.That(() => TestPlayer.BufferingTime = new PlayerBufferingTime(-1, 0),
+                Throws.TypeOf<ArgumentOutOfRangeException>());
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Any attempt to get the BufferingTime if the player has been disposed of")]
+        [Property("SPEC", "Tizen.Multimedia.Player.BufferingTime A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PEX")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void BufferingTime_DISPOSED()
+        {
+            GetIdlePlayer().Dispose();
+
+            Assert.That(() => TestPlayer.BufferingTime, Throws.TypeOf<ObjectDisposedException>());
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Any attempt to set the BufferingTime if the player is not in the specified state")]
+        [Property("SPEC", "Tizen.Multimedia.Player.BufferingTime A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PEX")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public async Task BufferingTime_THROWS_IF_STATE_NOT_VALID()
+        {
+            var player = await GetPreparedPlayer();
+
+            Assert.That(() => player.BufferingTime = new PlayerBufferingTime(0, 0), Throws.InvalidOperationException);
+        }
+        #endregion
+
         [Test]
         [Category("P1")]
         [Description("BufferingProgressChanged event called while buffering")]
@@ -1375,5 +1452,19 @@ namespace Tizen.Multimedia.Tests
             Assert.That(TestPlayer.SphericalVideo, Is.Not.Null);
         }
         #endregion
+
+        #region AdaptiveVariants
+        [Test]
+        [Category("P1")]
+        [Description("AdaptiveVariants default value")]
+        [Property("SPEC", "Tizen.Multimedia.Player.AdaptiveVariants A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PDV")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void AdaptiveVariants_DEFAULT()
+        {
+            Assert.That(TestPlayer.AdaptiveVariants, Is.Not.Null);
+        }
+        #endregion
     }
 }
diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayerBufferingTime.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayerBufferingTime.cs
new file mode 100644 (file)
index 0000000..e2d0530
--- /dev/null
@@ -0,0 +1,45 @@
+using NUnit.Framework;
+
+namespace Tizen.Multimedia.Tests
+{
+    [TestFixture]
+    [Description("Tizen.Multimedia.PlayerBufferingTime tests")]
+    public static class PlayerBufferingTimeTests
+    {
+        [Test]
+        [Category("P1")]
+        [Description("Constructor test")]
+        [Property("SPEC", "Tizen.Multimedia.PlayerBufferingTime.PlayerBufferingTime C")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "CONSTR")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public static void PlayerBufferingTime_CHECK_RETURN()
+        {
+            Assert.DoesNotThrow(() => new PlayerBufferingTime(0, 0));
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("PreBuffMs Read/Write")]
+        [Property("SPEC", "Tizen.Multimedia.PlayerBufferingTime.PreBufferMillisecond A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public static void PreBufferMillisecond_READ_WRITE()
+        {
+            AssertHelper.PropertyReadWrite<PlayerBufferingTime>(nameof(PlayerBufferingTime.PreBufferMillisecond));
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("ReBuffMs Read/Write")]
+        [Property("SPEC", "Tizen.Multimedia.PlayerBufferingTime.ReBufferMillisecond A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public static void ReBufferMillisecond_READ_WRITE()
+        {
+            AssertHelper.PropertyReadWrite<PlayerBufferingTime>(nameof(PlayerBufferingTime.ReBufferMillisecond));
+        }
+    }
+}
diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSVariantInfo.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSVariantInfo.cs
new file mode 100644 (file)
index 0000000..be98582
--- /dev/null
@@ -0,0 +1,73 @@
+using NUnit.Framework;
+
+namespace Tizen.Multimedia.Tests
+{
+    [TestFixture]
+    [Description("Tizen.Multimedia.VariantInfo tests")]
+    public static class VariantInfoTests
+    {
+        [Test]
+        [Category("P1")]
+        [Description("check default value for constructor")]
+        [Property("SPEC", "Tizen.Multimedia.VariantInfo.VariantInfo C")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "CONSTR")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public static void VariantInfo_DEFAULT()
+        {
+            VariantInfo vi = new VariantInfo(0);
+
+            Assert.That(vi.Bandwidth, Is.EqualTo(0), "invalid bandwidth");
+            Assert.That(vi.Width, Is.EqualTo(-1), "invalid width");
+            Assert.That(vi.Height, Is.EqualTo(-1), "invalid height");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Constructor test")]
+        [Property("SPEC", "Tizen.Multimedia.VariantInfo.VariantInfo C")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "CONSTR")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public static void VariantInfo_INIT()
+        {
+            Assert.DoesNotThrow(() => new VariantInfo(0, 0, 0));
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("BandWidth Read/Write")]
+        [Property("SPEC", "Tizen.Multimedia.VariantInfo.Bandwidth A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public static void Bandwidth_READ_WRITE()
+        {
+            AssertHelper.PropertyReadWrite<VariantInfo>(nameof(VariantInfo.Bandwidth));
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Width Read/Write")]
+        [Property("SPEC", "Tizen.Multimedia.VariantInfo.Width A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public static void Width_READ_WRITE()
+        {
+            AssertHelper.PropertyReadWrite<VariantInfo>(nameof(VariantInfo.Width));
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Height Read/Write")]
+        [Property("SPEC", "Tizen.Multimedia.VariantInfo.Height A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public static void Height_READ_WRITE()
+        {
+            AssertHelper.PropertyReadWrite<VariantInfo>(nameof(VariantInfo.Height));
+        }
+    }
+}