using System;
using System.IO;
using System.Threading.Tasks;
+using Tizen.System;
namespace Tizen.Multimedia.Tests
{
private const long Unit = 1_000_000; /* 1 Millisecond = 1,000,000 Nanoseconds */
private long ConvertMillisecondsToNanoseconds(int milliseconds) => milliseconds * Unit;
private MediaUriSource _streamingSource = null;
+ private bool _isInternetSupported;
[OneTimeSetUp]
public void Init()
PreconditionUtils.SetPrecondition();
_streamingSource = new MediaUriSource(PreconditionUtils.STREAMING_URI);
+
+ Information.TryGetValue("http://tizen.org/feature/network.internet", out _isInternetSupported);
}
[Test]
[Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
public void BufferingTime_DEFAULT()
{
- Assert.That(TestPlayer.BufferingTime, Is.EqualTo(new PlayerBufferingTime(0, 0)));
+ try
+ {
+ Assert.That(TestPlayer.BufferingTime, Is.EqualTo(new PlayerBufferingTime(0, 0)));
+ }
+ catch (NotSupportedException)
+ {
+ Assert.IsTrue(_isInternetSupported == false, "Invalid NotSupportedException");
+ }
}
[Test]
[Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
public void BufferingTime_SET_GET()
{
- PlayerBufferingTime newValue = new PlayerBufferingTime(1000, 2000);
+ try
+ {
+ PlayerBufferingTime newValue = new PlayerBufferingTime(1000, 2000);
- TestPlayer.BufferingTime = newValue;
+ 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.");
+ Assert.That(TestPlayer.BufferingTime.PreBufferMillisecond,
+ Is.EqualTo(newValue.PreBufferMillisecond), "Invalid value.");
+ Assert.That(TestPlayer.BufferingTime.ReBufferMillisecond,
+ Is.EqualTo(newValue.ReBufferMillisecond), "Invalid value.");
+ }
+ catch (NotSupportedException)
+ {
+ Assert.IsTrue(_isInternetSupported == false, "Invalid NotSupportedException");
+ }
}
[Test]
[Category("P1")]
+ [Description("BufferingTime check whether default value is correctly applied")]
+ [Property("SPEC", "Tizen.Multimedia.Player.BufferingTime A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PCST")]
+ [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+ public void BufferingTime_DEFAULT_SET_GET()
+ {
+ try
+ {
+ PlayerBufferingTime oldValue = new PlayerBufferingTime(2500, 2500);
+ PlayerBufferingTime newRebuf = new PlayerBufferingTime(reBufferMillisecond: 1000);
+ PlayerBufferingTime newPrebuf = new PlayerBufferingTime(preBufferMillisecond: 3000);
+
+ TestPlayer.BufferingTime = oldValue;
+ Assert.That(TestPlayer.BufferingTime, Is.EqualTo(oldValue));
+
+ TestPlayer.BufferingTime = newRebuf;
+ Assert.That(TestPlayer.BufferingTime.PreBufferMillisecond,
+ Is.EqualTo(oldValue.PreBufferMillisecond), "Invalid value.");
+ Assert.That(TestPlayer.BufferingTime.ReBufferMillisecond,
+ Is.EqualTo(newRebuf.ReBufferMillisecond), "Invalid value.");
+
+ TestPlayer.BufferingTime = newPrebuf;
+ Assert.That(TestPlayer.BufferingTime.PreBufferMillisecond,
+ Is.EqualTo(newPrebuf.PreBufferMillisecond), "Invalid value.");
+ Assert.That(TestPlayer.BufferingTime.ReBufferMillisecond,
+ Is.EqualTo(newRebuf.ReBufferMillisecond), "Invalid value.");
+ }
+ catch (NotSupportedException)
+ {
+ Assert.IsTrue(_isInternetSupported == false, "Invalid NotSupportedException");
+ }
+}
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets and sets the BufferingTime value to its limit. 0(min)")]
+ [Property("SPEC", "Tizen.Multimedia.Player.BufferingTime A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PMIN")]
+ [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+ public void BufferingTime_Progress_CHECK_MIN_VALUE()
+ {
+ try
+ {
+ PlayerBufferingTime Value = new PlayerBufferingTime(0, 0);
+ TestPlayer.BufferingTime = Value;
+ Assert.That(TestPlayer.BufferingTime, Is.EqualTo(Value));
+ }
+ catch (NotSupportedException)
+ {
+ Assert.IsTrue(_isInternetSupported == false, "Invalid NotSupportedException");
+ }
+ }
+
+
+ [Test]
+ [Category("P2")]
[Description("BufferingTime throws exception if out of range")]
[Property("SPEC", "Tizen.Multimedia.Player.BufferingTime A")]
[Property("SPEC_URL", "-")]
[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),
+ try
+ {
+ Assert.That(() => TestPlayer.BufferingTime = new PlayerBufferingTime(0, -2),
Throws.TypeOf<ArgumentOutOfRangeException>());
+ Assert.That(() => TestPlayer.BufferingTime = new PlayerBufferingTime(-2, 0),
+ Throws.TypeOf<ArgumentOutOfRangeException>());
+ }
+ catch (NotSupportedException)
+ {
+ Assert.IsTrue(_isInternetSupported == false, "Invalid NotSupportedException");
+ }
}
[Test]
[Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
public void BufferingTime_DISPOSED()
{
- GetIdlePlayer().Dispose();
+ try
+ {
+ GetIdlePlayer().Dispose();
- Assert.That(() => TestPlayer.BufferingTime, Throws.TypeOf<ObjectDisposedException>());
+ Assert.That(() => TestPlayer.BufferingTime, Throws.TypeOf<ObjectDisposedException>());
+ }
+ catch (NotSupportedException)
+ {
+ Assert.IsTrue(_isInternetSupported == false, "Invalid NotSupportedException");
+ }
}
[Test]
[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);
+ try
+ {
+ var player = await GetPreparedPlayer();
+ Assert.That(() => player.BufferingTime = new PlayerBufferingTime(0, 0), Throws.InvalidOperationException);
+ }
+ catch (NotSupportedException)
+ {
+ Assert.IsTrue(_isInternetSupported == false, "Invalid NotSupportedException");
+ }
}
#endregion
using NUnit.Framework;
+using System;
namespace Tizen.Multimedia.Tests
{
[TestFixture]
[Description("Tizen.Multimedia.PlayerBufferingTime tests")]
- public class PlayerBufferingTimeTests
+ public class PlayerBufferingTimeTests : TestBase
{
[Test]
[Category("P1")]
[Test]
[Category("P1")]
+ [Description("check default value for constructor")]
+ [Property("SPEC", "Tizen.Multimedia.PlayerBufferingTime.PlayerBufferingTime C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+ public void PlayerBufferingTime_DEFAULT()
+ {
+ var pbt = new PlayerBufferingTime(-1, -1);
+ var pre = new PlayerBufferingTime(preBufferMillisecond:4567);
+ var re = new PlayerBufferingTime(reBufferMillisecond:6543);
+ Assert.IsInstanceOf<PlayerBufferingTime>(pbt, "Should return PlayerBufferingTime instance.");
+
+ Assert.That(pbt.PreBufferMillisecond, Is.EqualTo(-1), "invalid PreBufferMillisecond");
+ Assert.That(pbt.ReBufferMillisecond, Is.EqualTo(-1), "invalid ReBufferMillisecond");
+ Assert.That(pre.PreBufferMillisecond, Is.EqualTo(4567), "invalid PreBufferMillisecond");
+ Assert.That(pre.ReBufferMillisecond, Is.EqualTo(-1), "invalid ReBufferMillisecond");
+ Assert.That(re.PreBufferMillisecond, Is.EqualTo(-1), "invalid PreBufferMillisecond");
+ Assert.That(re.ReBufferMillisecond, Is.EqualTo(6543), "invalid ReBufferMillisecond");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("check recommended value")]
+ [Property("SPEC", "Tizen.Multimedia.PlayerBufferingTime.PlayerBufferingTime C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+ public void PlayerBufferingTime_INIT()
+ {
+ var pbt = new PlayerBufferingTime(1000, 1000);
+ Assert.IsInstanceOf<PlayerBufferingTime>(pbt, "Should return PlayerBufferingTime instance.");
+
+ Assert.That(pbt.PreBufferMillisecond, Is.EqualTo(1000), "invalid PreBufferMillisecond");
+ Assert.That(pbt.ReBufferMillisecond, Is.EqualTo(1000), "invalid ReBufferMillisecond");
+ }
+
+ [Test]
+ [Category("P1")]
[Description("PreBuffMs Read/Write")]
[Property("SPEC", "Tizen.Multimedia.PlayerBufferingTime.PreBufferMillisecond A")]
[Property("SPEC_URL", "-")]