[MediaContent][TCSACR-439] Support ebook format 03/263603/5
authorHaesu Gwon <haesu.gwon@samsung.com>
Tue, 7 Sep 2021 02:25:07 +0000 (11:25 +0900)
committerHaesu Gwon <haesu.gwon@samsung.com>
Mon, 27 Sep 2021 01:05:17 +0000 (10:05 +0900)
Change-Id: Id4369dddc5d68ab14a5b6aa21aa7f34dc7e81f44

tct-suite-vs/Tizen.Mediacontent.Tests/res/content/ebook.epub [new file with mode: 0755]
tct-suite-vs/Tizen.Mediacontent.Tests/testcase/TSBookInfo.cs [new file with mode: 0644]
tct-suite-vs/Tizen.Mediacontent.Tests/testcase/TSMediaInfoCommand.cs
tct-suite-vs/Tizen.Mediacontent.Tests/testcase/support/TestBase.cs
tct-suite-vs/Tizen.Mediacontent.Tests/testcase/support/TestConstants.cs

diff --git a/tct-suite-vs/Tizen.Mediacontent.Tests/res/content/ebook.epub b/tct-suite-vs/Tizen.Mediacontent.Tests/res/content/ebook.epub
new file mode 100755 (executable)
index 0000000..5f9a9a7
Binary files /dev/null and b/tct-suite-vs/Tizen.Mediacontent.Tests/res/content/ebook.epub differ
diff --git a/tct-suite-vs/Tizen.Mediacontent.Tests/testcase/TSBookInfo.cs b/tct-suite-vs/Tizen.Mediacontent.Tests/testcase/TSBookInfo.cs
new file mode 100644 (file)
index 0000000..74c3949
--- /dev/null
@@ -0,0 +1,81 @@
+using NUnit.Framework;
+
+namespace Tizen.Content.MediaContent.Tests
+{
+    [TestFixture]
+    [Description("Tizen.Content.MediaContent.BookInfo Tests")]
+    public class BookInfoTests : TestBase
+    {
+        private BookInfo _bookInfo;
+
+        [SetUp]
+        public void SetUp()
+        {
+            Log.Info("Tizen.Mediacontent.Tests", "Enter");
+            _bookInfo = new MediaInfoCommand(_database).Add(TestConstants.EbookFile) as BookInfo;
+
+            Assert.NotNull(_bookInfo, "Failed to get BookInfo");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test whether Subject Property returns expected value or not.")]
+        [Property("SPEC", "Tizen.Content.MediaContent.BookInfo.Subject A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRO")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void Subject_PROPERTY_READ_ONLY()
+        {
+            Log.Info("Tizen.Mediacontent.Tests", "Enter");
+            Assert.That(_bookInfo.Subject, Is.EqualTo("fiction"));
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test whether Author Property returns expected value or not.")]
+        [Property("SPEC", "Tizen.Content.MediaContent.BookInfo.Author A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRO")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void Author_PROPERTY_READ_ONLY()
+        {
+            Assert.That(_bookInfo.Author, Is.EqualTo("creator"));
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test whether DatePublished Property returns expected value or not.")]
+        [Property("SPEC", "Tizen.Content.MediaContent.BookInfo.DatePublished A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRO")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void DatePublished_PROPERTY_READ_ONLY()
+        {
+            Assert.That(_bookInfo.DatePublished, Is.EqualTo("2021"));
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test whether Publisher Property returns expected value or not.")]
+        [Property("SPEC", "Tizen.Content.MediaContent.BookInfo.Publisher A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRO")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void Publisher_PROPERTY_READ_ONLY()
+        {
+            Assert.That(_bookInfo.Publisher, Is.EqualTo("publisher"));
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test whether MediaType Property returns expected value or not.")]
+        [Property("SPEC", "Tizen.Content.MediaContent.BookInfo.MediaType A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRO")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void MediaType_PROPERTY_READ_ONLY()
+        {
+            Assert.That(_bookInfo.MediaType, Is.EqualTo(MediaType.Book));
+        }
+    }
+}
\ No newline at end of file
index e3ddc55..9261678 100644 (file)
@@ -1,3 +1,5 @@
+using System.Runtime.CompilerServices;
+using System.Xml.Linq;
 using NUnit.Framework;
 using System;
 using System.Collections.Generic;
@@ -321,6 +323,93 @@ namespace Tizen.Content.MediaContent.Tests
         }
 
         [Test]
+        [Category("P1")]
+        [Description("Returns BookInfo containing result filtered")]
+        [Property("SPEC", "Tizen.Content.MediaContent.MediaInfoCommand.SelectMedia M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("COVPARAM", "SelectArguments")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void SelectMedia_WITH_MediaType_Book()
+        {
+            var id = _cmd.Add(TestConstants.EbookFile).Id;
+
+            var bookInfo = _cmd.SelectMedia(id) as BookInfo;
+
+            Assert.That(bookInfo.Subject, Is.EqualTo("fiction"),
+                "Should return same value");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test whether SelectEbookPath method throws exception or not")]
+        [Property("SPEC", "Tizen.Content.MediaContent.MediaInfoCommand.SelectEbookPath M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void SelectEbookPath_CHECK_RETURN()
+        {
+            Assert.That(() => _cmd.SelectEbookPath("test"), Throws.Nothing,
+                "Should not throws exception");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test whether returns MediaDataReader containing ebook path or not")]
+        [Property("SPEC", "Tizen.Content.MediaContent.MediaInfoCommand.SelectEbookPath M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void SelectEbookPath_CHECK_RETURN_EXPECTED_VALUE()
+        {
+            var reader = _cmd.SelectEbookPath("test");
+            reader.Read();
+
+            Assert.That(reader.Current.Contains("ebook.epub"), "Should return proper value");
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Throws if argument is null")]
+        [Property("SPEC", "Tizen.Content.MediaContent.MediaInfoCommand.SelectEbookPath M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void SelectEbookPath_THROWS_IF_KEYWORD_NULL()
+        {
+            Assert.That(() => _cmd.SelectEbookPath(null), Throws.ArgumentNullException,
+                "Should throws ArgumentNullException exception");
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Throws if the database has already been disconnected.")]
+        [Property("SPEC", "Tizen.Content.MediaContent.MediaInfoCommand.SelectEbookPath M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void SelectEbookPath_THROWS_IF_DB_DISCONNECTED()
+        {
+            _database.Disconnect();
+            Assert.That(() => _cmd.SelectEbookPath("test"), Throws.InvalidOperationException,
+                "Should throws InvalidOperationException exception");
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Throws if the database has already been disposed.")]
+        [Property("SPEC", "Tizen.Content.MediaContent.MediaInfoCommand.SelectEbookPath M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void SelectEbookPath_THROWS_IF_DB_DISPOSED()
+        {
+            _database.Dispose();
+            Assert.That(() => _cmd.SelectEbookPath("test"), Throws.TypeOf<ObjectDisposedException>(),
+                "Should throws ObjectDisposedException exception");
+        }
+
+        [Test]
         [Category("P2")]
         [Description("Throws if the database has already been disconnected")]
         [Property("SPEC", "Tizen.Content.MediaContent.MediaInfoCommand.CountGroupBy M")]
index 14e99fc..b54b3bf 100644 (file)
@@ -69,6 +69,7 @@ namespace Tizen.Content.MediaContent.Tests
             {
                 { TestConstants.AudioFile, TestConstants.AudioFileBackup},
                 { TestConstants.VideoFile, TestConstants.VideoFileBackup },
+                { TestConstants.EbookFile, TestConstants.EbookFileBackup },
                 { TestConstants.ImageFile, TestConstants.ImageFileBackup },
                 { TestConstants.ImageFileForFolder, TestConstants.ImageFileForFolderBackup }
             };
@@ -88,6 +89,7 @@ namespace Tizen.Content.MediaContent.Tests
             {
                 { TestConstants.AudioFileBackup, TestConstants.AudioFile},
                 { TestConstants.VideoFileBackup, TestConstants.VideoFile },
+                { TestConstants.EbookFileBackup, TestConstants.EbookFile },
                 { TestConstants.ImageFileBackup, TestConstants.ImageFile },
                 { TestConstants.ImageFileForFolderBackup, TestConstants.ImageFileForFolder }
             };
index 49b8296..102446b 100644 (file)
@@ -19,6 +19,7 @@ namespace Tizen.Content.MediaContent.Tests
         internal static readonly string FaceImageFileUnSupported = RootPath + "/face_image_unsupported.gif";
         internal static readonly string AudioFile = RootPath + "/sound.mp3";
         internal static readonly string VideoFile = RootPath + "/movie.mp4";
+        internal static readonly string EbookFile = RootPath + "/ebook.epub";
         internal static readonly string PlaylistFile = RootPath + "/tmp.m3u";
         internal static readonly string FolderPath = RootPath + "/test";
         internal static readonly string ImageFileForFolder = FolderPath + "/test.jpg";
@@ -32,6 +33,7 @@ namespace Tizen.Content.MediaContent.Tests
         internal static readonly string FaceImageFileBackup = RootPath + "/face_image.bak";
         internal static readonly string AudioFileBackup = RootPath + "/sound.bak";
         internal static readonly string VideoFileBackup = RootPath + "/movie.bak";
+        internal static readonly string EbookFileBackup = RootPath + "/ebook.bak";
         internal static readonly string PlaylistFileBackup = RootPath + "/tmp.bak";
         internal static readonly string ImageFileForFolderBackup = FolderPath + "/test.bak";
         internal static readonly string OtherFileBackup = OtherPath + "/other.bak";