{
[TestFixture]
[Description("Tizen.Multimedia.MediaCodec.BufferStatusChangedEventArgs Tests")]
- public class BufferStatusChangedEventArgsTests
+ public class BufferStatusChangedEventArgsTests : TestBase
{
[Test]
[Category("P1")]
[Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
public void BufferStatusChangedEventArgs_CHECK()
{
- if (FeatureChecker.IsSupported(Constants.Feature) == false)
- {
- Assert.Pass("The MediaCodec is not supported.");
- }
-
Assert.That(() => new BufferStatusChangedEventArgs(MediaCodecStatus.EnoughData),
Throws.Nothing);
}
[Test]
[Category("P1")]
- [Description("Constructor test")]
- [Property("SPEC", "Tizen.Multimedia.MediaCodec.BufferStatusChangedEventArgs.BufferStatusChangedEventArgs C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTX")]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public void BufferStatusChangedEventArgs_NOT_SUPPORTED()
- {
- if (FeatureChecker.IsSupported(Constants.Feature))
- {
- Assert.Pass("The MediaCodec is supported. This TC can be tested only if MediaCodec is not supported.");
- }
-
- Assert.That(() => new BufferStatusChangedEventArgs(MediaCodecStatus.EnoughData),
- Throws.InstanceOf<NotSupportedException>());
- }
-
- [Test]
- [Category("P1")]
[Description("Status test")]
[Property("SPEC", "Tizen.Multimedia.MediaCodec.BufferStatusChangedEventArgs.Status A")]
[Property("SPEC_URL", "-")]
[Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
public void Status_CHECK()
{
- if (FeatureChecker.IsSupported(Constants.Feature))
- {
- const MediaCodecStatus status = MediaCodecStatus.LackOfData;
+ const MediaCodecStatus status = MediaCodecStatus.LackOfData;
- Assert.That(new BufferStatusChangedEventArgs(status).Status, Is.EqualTo(status));
- }
- else
- {
- Assert.Pass("The MediaCodec is not supported.");
- }
+ Assert.That(new BufferStatusChangedEventArgs(status).Status, Is.EqualTo(status));
}
}
}
[TestFixture]
[Description("Tizen.Multimedia.MediaCodec.InputProcessedEventArgs Tests")]
- public class InputProcessedEventArgsTests
+ public class InputProcessedEventArgsTests : TestBase
{
[Test]
[Category("P1")]
[Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
public void Packet_CHECK()
{
- if (FeatureChecker.IsSupported(Constants.Feature) == false)
- {
- Assert.Pass("The MediaCodec is not supported.");
- }
-
AssertHelper.PropertyReadOnly<InputProcessedEventArgs>(nameof(InputProcessedEventArgs.Packet));
}
-
}
}
{
[TestFixture]
[Description("Testing Tizen.Multimedia.MediaCodec.MediaCodec class")]
- public class MediaCodecTests
+ public class MediaCodecTests : TestBase
{
private const string VideoFilePath = "/opt/usr/home/owner/share/res/test.h264";
private readonly MediaFormat SimpleFormat =
new VideoMediaFormat(MediaFormatVideoMimeType.Mpeg4SP, 640, 480);
- private MediaCodec _codec;
-
- [SetUp]
- public void SetUp()
- {
- try
- {
- _codec = new MediaCodec();
- }
- catch (NotSupportedException) when (FeatureChecker.IsSupported(Constants.Feature) == false)
- {
- Assert.Pass("The MediaCodec is not supported.");
- }
- }
-
- [TearDown]
- public void TearDown()
- {
- _codec?.Dispose();
- }
-
[Test]
[Category("P1")]
[Description("Check if the MediaCodec constructor can be invoked without any exception")]
[Test]
[Category("P1")]
[Description("GetCodecType returns zero if the specified type is not supported")]
- [Property("SPEC", "Tizen.Multimedia.MediaCodec.MediaCodec.Prepare M")]
+ [Property("SPEC", "Tizen.Multimedia.MediaCodec.MediaCodec.GetCodecType M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "bool, MediaFormatVideoMimeType")]
[Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
public void GetCodecType_ERROR_IF_NOT_SUPPORTED()
{
{
[TestFixture]
[Description("Tizen.Multimedia.MediaCodec.MediaCodecErrorOccurredEventArgs Tests")]
- public class MediaCodecErrorOccurredEventArgsTests
+ public class MediaCodecErrorOccurredEventArgsTests : TestBase
{
[Test]
[Category("P1")]
[Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
public void MediaCodecErrorOccurredEventArgs_CHECK()
{
- if (FeatureChecker.IsSupported(Constants.Feature) == false)
- {
- Assert.Pass("The MediaCodec is not supported.");
- }
-
Assert.That(() => new MediaCodecErrorOccurredEventArgs(MediaCodecError.InternalError),
Throws.Nothing);
}
[Test]
[Category("P1")]
- [Description("Constructor test")]
- [Property("SPEC", "Tizen.Multimedia.MediaCodec.MediaCodecErrorOccurredEventArgs.MediaCodecErrorOccurredEventArgs C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTX")]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public void MediaCodecErrorOccurredEventArgs_NOT_SUPPORTED()
- {
- if (FeatureChecker.IsSupported(Constants.Feature))
- {
- Assert.Pass("The MediaCodec is supported. This TC can be tested only if MediaCodec is not supported.");
- }
-
- Assert.That(() => new MediaCodecErrorOccurredEventArgs(MediaCodecError.InternalError),
- Throws.InstanceOf<NotSupportedException>());
- }
-
- [Test]
- [Category("P1")]
[Description("Error test")]
[Property("SPEC", "Tizen.Multimedia.MediaCodec.MediaCodecErrorOccurredEventArgs.Error A")]
[Property("SPEC_URL", "-")]
[Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
public void Error_CHECK()
{
- if (FeatureChecker.IsSupported(Constants.Feature))
- {
- const MediaCodecError error = MediaCodecError.InvalidStream;
+ const MediaCodecError error = MediaCodecError.InvalidStream;
- Assert.That(new MediaCodecErrorOccurredEventArgs(error).Error, Is.EqualTo(error));
- }
- else
- {
- Assert.Pass("The MediaCodec is not supported.");
- }
+ Assert.That(new MediaCodecErrorOccurredEventArgs(error).Error, Is.EqualTo(error));
}
}
}
[TestFixture]
[Description("Tizen.Multimedia.MediaCodec.OutputAvailableEventArgs Tests")]
- public class OutputAvailableEventArgsTests
+ public class OutputAvailableEventArgsTests : TestBase
{
[Test]
[Category("P1")]
[Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
public void Packet_READONLY()
{
- if (FeatureChecker.IsSupported(Constants.Feature) == false)
- {
- Assert.Pass("The MediaCodec is not supported.");
- }
-
AssertHelper.PropertyReadOnly<OutputAvailableEventArgs>(nameof(OutputAvailableEventArgs.Packet));
}
-
}
}
--- /dev/null
+using NUnit.Framework;
+using System;
+
+namespace Tizen.Multimedia.MediaCodec.Tests
+{
+ public class TestBase
+ {
+ protected MediaCodec _codec;
+
+ [SetUp]
+ public void SetUpBase()
+ {
+ try
+ {
+ _codec = new MediaCodec();
+ }
+ catch (NotSupportedException) when (FeatureChecker.IsSupported(Constants.Feature) == false)
+ {
+ Assert.Pass("The MediaCodec is not supported.");
+ }
+ }
+
+ [TearDown]
+ public void TearDownBase()
+ {
+ _codec?.Dispose();
+ }
+ }
+}