[MediaPlayer][ACR-164] add TCs related with setting/getting playback in nanoseconds 09/185009/6
authornam <just.nam@samsung.com>
Wed, 25 Jul 2018 07:34:21 +0000 (16:34 +0900)
committernam <just.nam@samsung.com>
Mon, 30 Jul 2018 02:58:40 +0000 (11:58 +0900)
Change-Id: I51243edbbf1ee01c4de67fd09867a36dade1350d

tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs
tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSStreamInfo.Audio.cs

index 067f2db..eed0be6 100755 (executable)
@@ -806,7 +806,7 @@ namespace Tizen.Multimedia.Tests
 
         [Test]
         [Category("P2")]
-        [Description("SetPlayPositionAsync throws if the player is in the idle state")]
+        [Description("SetPlayPositionAsync throws exception if the player is in the idle state")]
         [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionAsync M")]
         [Property("SPEC_URL", "-")]
         [Property("CRITERIA", "MEX")]
@@ -820,10 +820,10 @@ namespace Tizen.Multimedia.Tests
 
         [Test]
         [Category("P2")]
-        [Description("SetPlayPositionAsync throws if the specified position is invalid")]
+        [Description("SetPlayPositionAsync throws exception if the specified position is invalid")]
         [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionAsync M")]
         [Property("SPEC_URL", "-")]
-        [Property("CRITERIA", "MEX")]
+        [Property("CRITERIA", "MAR")]
         [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
         public async Task SetPlayPositionAsync_GREATER_THAN_LIMIT()
         {
@@ -836,10 +836,10 @@ namespace Tizen.Multimedia.Tests
 
         [Test]
         [Category("P2")]
-        [Description("SetPlayPositionAsync throws if the specified position is invalid")]
+        [Description("SetPlayPositionAsync throws exception if the specified position is invalid")]
         [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionAsync M")]
         [Property("SPEC_URL", "-")]
-        [Property("CRITERIA", "MEX")]
+        [Property("CRITERIA", "MAR")]
         [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
         public async Task SetPlayPositionAsync_LESS_THAN_ZERO()
         {
@@ -850,6 +850,153 @@ namespace Tizen.Multimedia.Tests
             Assert.That(() => task, Throws.TypeOf<ArgumentOutOfRangeException>());
         }
 
+        [Test]
+        [Category("P1")]
+        [Description("GetPlayPosition test")]
+        [Property("SPEC", "Tizen.Multimedia.Player.GetPlayPosition M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public async Task GetPlayPositionNanoseconds_CHECK()
+        {
+            var player = await GetPreparedPlayer();
+
+            Assert.That(player.GetPlayPositionNanoseconds(), Is.Zero);
+
+            await player.SetPlayPositionNanosecondsAsync(5000, true);
+
+            Assert.That(player.GetPlayPositionNanoseconds(), Is.EqualTo(5000));
+
+            await player.SetPlayPositionNanosecondsAsync(15000, true);
+
+            Assert.That(player.GetPlayPositionNanoseconds(), Is.EqualTo(15000));
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Any attempt to access the GetPlayPositionNanoseconds if the player has been disposed of")]
+        [Property("SPEC", "Tizen.Multimedia.Player.GetPlayPositionNanoseconds M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void GetPlayPositionNanoseconds_DISPOSED()
+        {
+            GetIdlePlayer().Dispose();
+
+            Assert.That(() => TestPlayer.GetPlayPositionNanoseconds(),
+                Throws.TypeOf<ObjectDisposedException>());
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("GetPlayPositionNanoseconds throws exception if the player is in the idle state")]
+        [Property("SPEC", "Tizen.Multimedia.Player.GetPlayPositionNanoseconds M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void GetPlayPositionNanoseconds_THROWS_IN_IDLE_STATE()
+        {
+            Assert.That(() => TestPlayer.GetPlayPositionNanoseconds(), Throws.InvalidOperationException);
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("SetPlayPositionNanosecondsAsync without accuracy")]
+        [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionNanosecondsAsync M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MCST")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public async Task SetPlayPositionNanosecondsAsync_INACCURATE()
+        {
+            var player = await GetPreparedPlayer();
+
+            const int targetPos = 700000;
+
+            await player.SetPlayPositionNanosecondsAsync(targetPos, false);
+
+            Assert.That(Math.Abs(targetPos - player.GetPlayPositionNanoseconds()), Is.LessThan(100000),
+                "The difference is too big.");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("SetPlayPositionNanosecondsAsync with accuracy")]
+        [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionNanosecondsAsync M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MCST")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public async Task SetPlayPositionNanosecondsAsync_ACCURATE()
+        {
+            var player = await GetPreparedPlayer();
+
+            const int targetPos = 700000;
+
+            await player.SetPlayPositionNanosecondsAsync(targetPos, true);
+
+            Assert.That(player.GetPlayPositionNanoseconds(), Is.EqualTo(targetPos));
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Any attempt to access the SetPlayPositionNanosecondsAsync if the player has been disposed of")]
+        [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionNanosecondsAsync M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void SetPlayPositionNanosecondsAsync_DISPOSED()
+        {
+            GetIdlePlayer().Dispose();
+
+            Assert.That(() => TestPlayer.SetPlayPositionNanosecondsAsync(15, false),
+                Throws.TypeOf<ObjectDisposedException>());
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("SetPlayPositionNanosecondsAsync throws exception if the player is in the idle state")]
+        [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionNanosecondsAsync M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public async Task SetPlayPositionNanosecondsAsync_THROWS_IN_IDLE_STATE()
+        {
+            var task = await AsyncWrapper.Wrap(() => TestPlayer.SetPlayPositionNanosecondsAsync(0, true));
+
+            Assert.That(() => task, Throws.InvalidOperationException);
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("SetPlayPositionNanosecondsAsync throws exception if the specified position is invalid")]
+        [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionNanosecondsAsync M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MAR")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public async Task SetPlayPositionNanosecondsAsync_GREATER_THAN_LIMIT()
+        {
+            var player = await GetPreparedPlayer();
+
+            var task = await AsyncWrapper.Wrap(() => player.SetPlayPositionNanosecondsAsync(40000000000, false));
+
+            Assert.That(() => task, Throws.TypeOf<ArgumentOutOfRangeException>());
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("SetPlayPositionNanosecondsAsync throws exception if the specified position is invalid")]
+        [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionNanosecondsAsync M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MAR")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public async Task SetPlayPositionNanosecondsAsync_LESS_THAN_ZERO()
+        {
+            var player = await GetPreparedPlayer();
+
+            var task = await AsyncWrapper.Wrap(() => player.SetPlayPositionNanosecondsAsync(-1, false));
+
+            Assert.That(() => task, Throws.TypeOf<ArgumentOutOfRangeException>());
+        }
+
         #endregion
 
         #region Subtitle
index 9975a99..d8d5897 100755 (executable)
@@ -12,6 +12,7 @@ namespace Tizen.Multimedia.Tests
         {
             public const string Codec = "MPEG-1 Layer 3 (MP3)";
             public const int Duration = 33380;
+            public const long DurationNanoseconds = 33380000000;
             public const int SampleRate = 22050;
             public const int Channels = 2;
             public const int BitRate = 128012;
@@ -69,6 +70,48 @@ namespace Tizen.Multimedia.Tests
 
         [Test]
         [Category("P1")]
+        [Description("Duration returns the length of the media")]
+        [Property("SPEC", "Tizen.Multimedia.StreamInfo.GetDurationNanoseconds M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public async Task GetDurationNanoseconds_CHECK_RETURN()
+        {
+            var streamInfo = await GetAudioStreamInfo();
+
+            Assert.That(Math.Abs(ExpectedValues.DurationNanoseconds - streamInfo.GetDurationNanoseconds()),
+                Is.LessThan(10000000));
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Any attempt to access the GetDurationNanoseconds if the player has been disposed of")]
+        [Property("SPEC", "Tizen.Multimedia.StreamInfo.GetDurationNanoseconds M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void GetDurationNanoseconds_DISPOSED()
+        {
+            GetIdlePlayer().Dispose();
+
+            Assert.That(() => TestPlayer.StreamInfo.GetDurationNanoseconds(),
+                Throws.TypeOf<ObjectDisposedException>());
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("GetDurationNanoseconds throws exception if the player is in the idle state")]
+        [Property("SPEC", "Tizen.Multimedia.StreamInfo.GetDurationNanoseconds M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void GetDurationNanoseconds_THROWS_IN_IDLE_STATE()
+        {
+            Assert.That(() => TestPlayer.StreamInfo.GetDurationNanoseconds(), Throws.InvalidOperationException);
+        }
+
+        [Test]
+        [Category("P1")]
         [Description("AudioStreamProperties returns audio stream info")]
         [Property("SPEC", "Tizen.Multimedia.StreamInfo.GetAudioProperties M")]
         [Property("SPEC_URL", "-")]