private BmpDecoder _bmpDecoder;
private GifDecoder _gifDecoder;
private JpegDecoder _jpegDecoder;
+ private JpegXlDecoder _jpegXlDecoder;
private PngDecoder _pngDecoder;
private WebPDecoder _webPDecoder;
private HeifDecoder _heifDecoder;
_bmpDecoder = new BmpDecoder();
_gifDecoder = new GifDecoder();
_jpegDecoder = new JpegDecoder();
+ _jpegXlDecoder = new JpegXlDecoder();
_pngDecoder = new PngDecoder();
_webPDecoder = new WebPDecoder();
_heifDecoder = new HeifDecoder();
+
Assert.IsNotNull(_bmpDecoder, "Object(BmpDecoder) should not be null to start test");
Assert.IsNotNull(_gifDecoder, "Object(GifDecoder) should not be null to start test");
Assert.IsNotNull(_jpegDecoder, "Object(JpegDecoder) should not be null to start test");
+ Assert.IsNotNull(_jpegXlDecoder, "Object(JpegXlDecoder) should not be null to start test");
Assert.IsNotNull(_pngDecoder, "Object(PngDecoder) should not be null to start test");
Assert.IsNotNull(_webPDecoder, "Object(WebPDecoder) should not be null to start test");
Assert.IsNotNull(_heifDecoder, "Object(HeifDecoder) should not be null to start test");
[TearDown]
public void Destroy()
{
- _bmpDecoder.Dispose();
- _gifDecoder.Dispose();
- _jpegDecoder.Dispose();
- _pngDecoder.Dispose();
- _webPDecoder.Dispose();
- _heifDecoder.Dispose();
+ _bmpDecoder?.Dispose();
+ _gifDecoder?.Dispose();
+ _jpegDecoder?.Dispose();
+ _jpegXlDecoder?.Dispose();
+ _pngDecoder?.Dispose();
+ _webPDecoder?.Dispose();
+ _heifDecoder?.Dispose();
}
[Test]
}
[Test]
+ [Category("P1")]
+ [Description("Decode jpegxl image using input buffer")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ImageDecoder.DecodeAsync M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ [Property("COVPARAM", "byte[]")]
+ public async Task DecodeAsync_INPUTBUFFER_JPEGXL_CHECK_RETURN_VALUE()
+ {
+ var frame = (await _jpegXlDecoder.DecodeAsync(File.ReadAllBytes(ImageUtilConstants.JpegXlPath))).FirstOrDefault();
+
+ Assert.That(frame.Size.Height, Is.Positive);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Decode jpegxl image using input path")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ImageDecoder.DecodeAsync M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ [Property("COVPARAM", "string")]
+ public async Task DecodeAsync_INPUTPATH_JPEGXL_CHECK_RETURN_VALUE()
+ {
+ var frame = (await _jpegXlDecoder.DecodeAsync(ImageUtilConstants.JpegXlPath)).FirstOrDefault();
+
+ Assert.That(frame.Size.Height, Is.Positive);
+ }
+
+ [Test]
[Category("P2")]
[Description("Check if it throws argument exception for setting color space with an invalid color space value")]
[Property("SPEC", "Tizen.Multimedia.Util.ImageDecoder.SetColorSpace M")]
{
Assert.That(_heifDecoder.InputFormat, Is.EqualTo(ImageFormat.Heif));
}
+
+ [Test]
+ [Category("P1")]
+ [Description("Get input format for jpegxl object")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ImageDecoder.InputFormat A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRE")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void InputFormat_PROPERTY_GET_ENUM_IMAGEFORMAT_JPEGXL()
+ {
+ Assert.That(_jpegXlDecoder.InputFormat, Is.EqualTo(ImageFormat.JpegXl));
+ }
}
}
private BmpEncoder _bmpEncoder;
private GifEncoder _gifEncoder;
private JpegEncoder _jpegEncoder;
+ private JpegXlEncoder _jpegXlEncoder;
private PngEncoder _pngEncoder;
+ private WebPEncoder _webPEncoder;
[SetUp]
public void Init()
_bmpEncoder = new BmpEncoder();
_gifEncoder = new GifEncoder();
_jpegEncoder = new JpegEncoder();
+ _jpegXlEncoder = new JpegXlEncoder();
_pngEncoder = new PngEncoder();
+ _webPEncoder = new WebPEncoder();
+
Assert.IsNotNull(_bmpEncoder, "Object(BmpEncoder) should not be null to start test");
Assert.IsNotNull(_gifEncoder, "Object(GifEncoder) should not be null to start test");
Assert.IsNotNull(_jpegEncoder, "Object(JpegEncoder) should not be null to start test");
+ Assert.IsNotNull(_jpegXlEncoder, "Object(JpegXlEncoder) should not be null to start test");
Assert.IsNotNull(_pngEncoder, "Object(PngEncoder) should not be null to start test");
+ Assert.IsNotNull(_webPEncoder, "Object(WebPEncoder) should not be null to start test");
}
[TearDown]
public void Destroy()
{
- _bmpEncoder.Dispose();
- _gifEncoder.Dispose();
- _jpegEncoder.Dispose();
- _pngEncoder.Dispose();
+ _bmpEncoder?.Dispose();
+ _gifEncoder?.Dispose();
+ _jpegEncoder?.Dispose();
+ _jpegXlEncoder?.Dispose();
+ _pngEncoder?.Dispose();
+ _webPEncoder?.Dispose();
}
[Test]
[Test]
[Category("P1")]
+ [Description("Test EncodeAsync with WebP whether throws exception or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ImageEncoder.EncodeAsync M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task EncodeAsync_WEBP_CHECK_RETURN_VALUE()
+ {
+ using (var outStream = File.Create(OutputPath))
+ using (var webPDecoder = new WebPDecoder())
+ {
+ var frame = (await webPDecoder.DecodeAsync(ImageUtilConstants.WebPPath)).FirstOrDefault();
+
+ _webPEncoder.SetResolution(new Size(100, 100));
+ Assert.That(() => _webPEncoder.EncodeAsync(frame.Buffer, outStream), Throws.Nothing);
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test EncodeAsync with JpegXl whether throws exception or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ImageEncoder.EncodeAsync M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task EncodeAsync_JPEGXL_CHECK_RETURN_VALUE()
+ {
+ using (var outStream = File.Create(OutputPath))
+ using (var jpegXlDecoder = new JpegXlDecoder())
+ {
+ var frame = (await jpegXlDecoder.DecodeAsync(ImageUtilConstants.JpegXlPath)).FirstOrDefault();
+
+ _jpegXlEncoder.SetResolution(new Size(100, 100));
+ Assert.That(() => _jpegXlEncoder.EncodeAsync(frame.Buffer, outStream), Throws.Nothing);
+ }
+ }
+
+ [Test]
+ [Category("P1")]
[Description("Get output format for jpeg object")]
[Property("SPEC", "Tizen.Multimedia.Util.ImageEncoder.OutputFormat A")]
[Property("SPEC_URL", "-")]
{
Assert.That(_bmpEncoder.OutputFormat, Is.EqualTo(ImageFormat.Bmp));
}
+
+ [Test]
+ [Category("P1")]
+ [Description("Get output format for webp object")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ImageEncoder.OutputFormat A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRE")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void OutputFormat_PROPERTY_GET_ENUM_IMAGEFORMAT_WEBP()
+ {
+ Assert.That(_webPEncoder.OutputFormat, Is.EqualTo(ImageFormat.WebP));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Get output format for jpegxl object")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ImageEncoder.OutputFormat A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRE")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void OutputFormat_PROPERTY_GET_ENUM_IMAGEFORMAT_JPEGXL()
+ {
+ Assert.That(_jpegXlEncoder.OutputFormat, Is.EqualTo(ImageFormat.JpegXl));
+ }
}
}
--- /dev/null
+// Copyright 2022 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
+using NUnit.Framework;
+
+namespace Tizen.Multimedia.Util.Tests
+{
+ [TestFixture]
+ [Description("Tests Tizen.Multimedia.Util.JpegXlDecoder class")]
+ public class JpegXlDecoderTests
+ {
+ [Test]
+ [Category("P1")]
+ [Description("Test: Constructor for JpegXl decoder - Object should not be null after initialization")]
+ [Property("SPEC", "Tizen.Multimedia.Util.JpegXlDecoder.JpegXlDecoder C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void JpegXlDecoder_INIT()
+ {
+ using (var decoder = new JpegXlDecoder())
+ {
+ Assert.IsNotNull(decoder, "Should not null.");
+ Assert.IsInstanceOf<JpegXlDecoder>(decoder, "Should return JpegXlDecoder instance.");
+ }
+ }
+ }
+}
--- /dev/null
+// Copyright 2022 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
+using NUnit.Framework;
+
+namespace Tizen.Multimedia.Util.Tests
+{
+ [TestFixture]
+ [Description("Tests Tizen.Multimedia.Util.JpegXlEncoder class")]
+ public class JpegXlEncoderTests
+ {
+ [Test]
+ [Category("P1")]
+ [Description("Test: Constructor for encoding JpegXl image - object should not be null after initializing")]
+ [Property("SPEC", "Tizen.Multimedia.Util.JpegXlEncoder.JpegXlEncoder C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void JpegXlEncoder_INIT()
+ {
+ using (var encoder = new JpegXlEncoder())
+ {
+ Assert.IsNotNull(encoder, "Should not null.");
+ Assert.IsInstanceOf<JpegXlEncoder>(encoder, "Should return JpegXlEncoder instance.");
+ Assert.AreEqual(encoder.Lossless, false, "The default lossless value Should be false.");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test: Constructor for encoding JpegXl image with lossless- object should not be null after initializing")]
+ [Property("SPEC", "Tizen.Multimedia.Util.JpegXlEncoder.JpegXlEncoder C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "bool")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void JpegXlEncoder_INIT_WITH_Lossless()
+ {
+ using (var encoder = new JpegXlEncoder(true))
+ {
+ Assert.IsNotNull(encoder, "Should not null.");
+ Assert.IsInstanceOf<JpegXlEncoder>(encoder, "Should return JpegXlEncoder instance.");
+ Assert.AreEqual(encoder.Lossless, true, "Should be same value.");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Lossless property is readable and writable.")]
+ [Property("SPEC", "Tizen.Multimedia.Util.JpegXlEncoder.Lossless A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Lossless_READ_WRITE()
+ {
+ using (var encoder = new JpegXlEncoder())
+ {
+ encoder.Lossless = true;
+ Assert.AreEqual(encoder.Lossless, true, "Should be same value.");
+
+ encoder.Lossless = false;
+ Assert.AreEqual(encoder.Lossless, false, "Should be same value.");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether the default value of Lossless property is false.")]
+ [Property("SPEC", "Tizen.Multimedia.Util.JpegXlEncoder.Lossless A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PDV")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Lossless_CHECK_DEFAULT_VALUE()
+ {
+ Assert.AreEqual(new JpegXlEncoder().Lossless, false, "The default value should be false.");
+ }
+ }
+}
internal static class ImageUtilConstants
{
internal const string JpegPath = "/opt/usr/home/owner/share/res/test_jpeg.jpg";
+ internal const string JpegXlPath = "/opt/usr/home/owner/share/res/test_jxl.jxl";
internal const string BitmapPath = "/opt/usr/home/owner/share/res/test_bmp.bmp";
internal const string GifPath = "/opt/usr/home/owner/share/res/test_gif.gif";
internal const string PngPath = "/opt/usr/home/owner/share/res/test_png.png";