private const string Path = "/opt/usr/home/owner/share/res/test_thumbnail.jpg";
private const string PathDefaultSize = "/opt/usr/home/owner/share/res/test_thumb_size.jpg";
private const string PathInvalid = "/opt/usr/home/owner/share/res/";
+ private const string PathInvalidFormat = "/opt/usr/home/owner/share/res/test_tiff.tiff";
private const string PathNotSupported = "/opt/usr/home/owner/share/res/unknown_format";
+ private const string ResultPath = "/opt/usr/home/owner/share/res/generated_thumbnail.jpg";
private CancellationTokenSource cts;
{
if (cts != null)
cts.Dispose();
+
+ if (File.Exists(ResultPath))
+ {
+ File.Delete(ResultPath);
+ }
}
[Test]
Assert.That(() => cts.Cancel(), Throws.Nothing);
}
+
+ [Test]
+ [Category("P1")]
+ [Description("Extract thumbnail with default size")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ThumbnailExtractor.Extract M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "string")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Extract_CHECK_RETURNS()
+ {
+ // The resolution of input image is 900x500, so it has different ratio with 320x240.
+ // So, the resolution of generated thumbnail will be changed.
+ Assert.That(() => ThumbnailExtractor.Extract(Path).Size,
+ Is.Not.EqualTo(new Size(320, 240)));
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Throws ArgumentNullException if path is null")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ThumbnailExtractor.Extract M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Extract_WITH_NULL_PATH()
+ {
+ Assert.Throws<ArgumentNullException>(() => ThumbnailExtractor.Extract(null));
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Throws FileNotFoundException if file doesn't exist")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ThumbnailExtractor.Extract M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Extract_WITH_INVALID_PATH()
+ {
+ Assert.Throws<FileNotFoundException>(() => ThumbnailExtractor.Extract(PathInvalid));
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Throws FileFormatException if invalid file format")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ThumbnailExtractor.Extract M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Extract_WITH_INVALID_FILE_FORMAT()
+ {
+ Assert.Throws<FileFormatException>(() => ThumbnailExtractor.Extract(PathInvalidFormat));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Extract thumbnail with valid size")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ThumbnailExtractor.Extract M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "string, Size")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Extract_WITH_SIZE_CHECK_RETURNS()
+ {
+ var thumbSize = new Size(432, 240);
+
+ Assert.That(() => ThumbnailExtractor.Extract(Path, thumbSize).Size,
+ Is.EqualTo(thumbSize));
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Throws ArgumentNullException if path is null")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ThumbnailExtractor.Extract M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, Size")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Extract_WITH_SIZE_WITH_NULL_PATH()
+ {
+ Assert.Throws<ArgumentNullException>(
+ () => ThumbnailExtractor.Extract(null, new Size(432, 240)));
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Throws ArgumentOutOfRangeException if size is out of range")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ThumbnailExtractor.Extract M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, Size")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Extract_WITH_SIZE_WITH_OUT_OF_RANGE_WIDTH_HEIGHT()
+ {
+ Assert.Throws<ArgumentOutOfRangeException>(
+ () => ThumbnailExtractor.Extract(Path, new Size(0, 0)));
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Throws FileNotFoundException if file doesn't exist")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ThumbnailExtractor.Extract M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, Size")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Extract_WITH_SIZE_WITH_INVALID_PATH()
+ {
+ Assert.Throws<FileNotFoundException>(
+ () => ThumbnailExtractor.Extract(PathInvalid, new Size(432, 240)));
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Throws FileFormatException if invalid file format")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ThumbnailExtractor.Extract M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, Size")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Extract_WITH_SIZE_WITH_INVALID_FILE_FORMAT()
+ {
+ Assert.Throws<FileFormatException>(
+ () => ThumbnailExtractor.Extract(PathInvalidFormat, new Size(432, 240)));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Extract thumbnail with default size and save it to result path")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ThumbnailExtractor.Extract M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "string, string")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Extract_WITH_RESULTPATH_CHECK_FILE_EXIST()
+ {
+ Assert.That(() => ThumbnailExtractor.Extract(Path, ResultPath), Throws.Nothing);
+
+ Assert.That(File.Exists(ResultPath), Is.True);
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Throws ArgumentNullException if path is null")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ThumbnailExtractor.Extract M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, string")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Extract_WITH_RESULTPATH_WITH_NULL_PATH()
+ {
+ Assert.Throws<ArgumentNullException>(
+ () => ThumbnailExtractor.Extract(null, ResultPath));
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Throws FileNotFoundException if file doesn't exist")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ThumbnailExtractor.Extract M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, string")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Extract_WITH_RESULTPATH_WITH_INVALID_PATH()
+ {
+ Assert.Throws<FileNotFoundException>(
+ () => ThumbnailExtractor.Extract(PathInvalid, ResultPath));
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Throws FileFormatException if invalid file format")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ThumbnailExtractor.Extract M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, string")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Extract_WITH_RESULTPATH_WITH_INVALID_FILE_FORMAT()
+ {
+ Assert.Throws<FileFormatException>(
+ () => ThumbnailExtractor.Extract(PathInvalidFormat, ResultPath));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Extract thumbnail with size and save it to result path")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ThumbnailExtractor.Extract M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "string, Size, string")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Extract_WITH_RESULTPATH_AND_SIZE_CHECK_FILE_EXIST()
+ {
+ Assert.That(() => ThumbnailExtractor.Extract(Path, new Size(432, 240), ResultPath),
+ Throws.Nothing);
+
+ Assert.That(File.Exists(ResultPath), Is.True);
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Throws ArgumentNullException if path is null")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ThumbnailExtractor.Extract M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, Size, string")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Extract_WITH_RESULTPATH_AND_SIZE_WITH_NULL_PATH()
+ {
+ Assert.Throws<ArgumentNullException>(
+ () => ThumbnailExtractor.Extract(null, new Size(432, 240), ResultPath));
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Throws ArgumentOutOfRangeException if size is out of range")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ThumbnailExtractor.Extract M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, Size, string")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Extract_WITH_RESULTPATH_AND_SIZE_WITH_OUT_OF_RANGE_WIDTH_HEIGHT()
+ {
+ Assert.Throws<ArgumentOutOfRangeException>(
+ () => ThumbnailExtractor.Extract(Path, new Size(0, 0), ResultPath));
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Throws FileNotFoundException if file doesn't exist")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ThumbnailExtractor.Extract M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, Size, string")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Extract_WITH_RESULTPATH_AND_SIZE_WITH_INVALID_PATH()
+ {
+ Assert.Throws<FileNotFoundException>(
+ () => ThumbnailExtractor.Extract(PathInvalid, new Size(432, 240), ResultPath));
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Throws FileFormatException if invalid file format")]
+ [Property("SPEC", "Tizen.Multimedia.Util.ThumbnailExtractor.Extract M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, Size, string")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Extract_WITH_RESULTPATH_AND_SIZE_WITH_INVALID_FILE_FORMAT()
+ {
+ Assert.Throws<FileFormatException>(
+ () => ThumbnailExtractor.Extract(PathInvalidFormat, new Size(432, 240), ResultPath));
+ }
}
}