diff options
Diffstat (limited to 'tct-mediacontent-tizen-tests/src/Testcase')
-rw-r--r-- | tct-mediacontent-tizen-tests/src/Testcase/TSAlbum.cs | 143 | ||||
-rw-r--r-- | tct-mediacontent-tizen-tests/src/Testcase/TSBookmark.cs | 127 | ||||
-rw-r--r-- | tct-mediacontent-tizen-tests/src/Testcase/TSContentManager.cs | 147 | ||||
-rw-r--r-- | tct-mediacontent-tizen-tests/src/Testcase/TSFolder.cs | 153 | ||||
-rw-r--r-- | tct-mediacontent-tizen-tests/src/Testcase/TSGroup.cs | 108 | ||||
-rw-r--r-- | tct-mediacontent-tizen-tests/src/Testcase/TSMediaFace.cs | 122 | ||||
-rw-r--r-- | tct-mediacontent-tizen-tests/src/Testcase/TSMediaInformation.cs | 986 | ||||
-rw-r--r-- | tct-mediacontent-tizen-tests/src/Testcase/TSPlayList.cs | 247 | ||||
-rw-r--r-- | tct-mediacontent-tizen-tests/src/Testcase/TSStorage.cs | 136 | ||||
-rw-r--r-- | tct-mediacontent-tizen-tests/src/Testcase/TSTag.cs | 130 |
10 files changed, 2299 insertions, 0 deletions
diff --git a/tct-mediacontent-tizen-tests/src/Testcase/TSAlbum.cs b/tct-mediacontent-tizen-tests/src/Testcase/TSAlbum.cs new file mode 100644 index 0000000..98e089f --- /dev/null +++ b/tct-mediacontent-tizen-tests/src/Testcase/TSAlbum.cs @@ -0,0 +1,143 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using TestFramework; +using Tizen.Content.MediaContent; +namespace TizenTest.MediaInformationT +{ + [TestFixture] + [Description("Tizen.Content.MediaContent.Album Tests")] + class TSAlbum + { + private static string TAG = "TCT"; + private static string _logTag = "TizenTest.MediaInformationT.TSAlbum"; + [SetUp] + public static void Init() + { + //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST"); + } + + [TearDown] + public static void Destroy() + { + //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST"); + } + + [Test] + [Category("P1")] + [Description("Test for Group count ...")] + [Property("SPEC", " Tizen.Content.MediaContent.Album M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static void albumCount_CHECK_RESULT() + { + Tizen.Log.Info(TAG, "Executing TC:albumCount_CHECK_RESULT Album"); + int Count = ContentManager.Database.GetCount<Album>( null); + Tizen.Log.Info(TAG, "Executing TC:albumCount_CHECK_RESULT Album count :"+ Count); + Assert.IsTrue(Count > 0, "Failed to get the group Count"); + Tizen.Log.Info(TAG, "Executing TC:albumCount_CHECK_RESULT Album end"); + } + + [Test] + [Category("P1")] + [Description("Test for Group list ...")] + [Property("SPEC", " Tizen.Content.MediaContent.Album.Nanme A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "P")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static async Task albumList_CHECK_RESULT() + { + Tizen.Log.Info(TAG, "Executing TC:albumList_CHECK_RESULT Album"); + Task<IEnumerable<Album>> albumsTask = ContentManager.Database.SelectAsync<Album>(null); + await albumsTask; + IEnumerable<Album> albums = albumsTask.Result; + foreach (Album album in albums) + { + Tizen.Log.Info(TAG, "Executing TC:albumList_CHECK_RESULT Name :"+ album.Name); + Assert.IsTrue(album.Name.Length > 0, "Failed to get the group information"); + } + Tizen.Log.Info(TAG, "Executing TC:albumList_CHECK_RESULT Album"); + } + + [Test] + [Category("P1")] + [Description("Test for MediaInformation count in Album ...")] + [Property("SPEC", " Tizen.Content.MediaContent.Album M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static async Task albumMediaCount_CHECK_RESULT() + { + Tizen.Log.Info(TAG, "Executing TC:albumMediaCount_CHECK_RESULT Album"); + Task<IEnumerable<Album>> albumsTask = ContentManager.Database.SelectAsync<Album>(null); + await albumsTask; + IEnumerable<Album> albums = albumsTask.Result; + foreach (Album album in albums) + { + int count = album.GetMediaInformationCount(null); + Tizen.Log.Info(TAG, "Executing TC:albumMediaCount_CHECK_RESULT Album mediacount : " + count); + Assert.IsTrue(count > 0, "Failed to get the media information count from album"); + } + Tizen.Log.Info(TAG, "Executing TC:albumMediaCount_CHECK_RESULT Album end"); + } + + [Test] + [Category("P1")] + [Description("Test for MediaInformation in Album ...")] + [Property("SPEC", " Tizen.Content.MediaContent.Album M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static async Task albummediaInfo_CHECK_RESULT() + { + Tizen.Log.Info(TAG, "Executing TC:albummediaInfo_CHECK_RESULT Album"); + IEnumerable<Album> albums = await ContentManager.Database.SelectAsync<Album>(null); + foreach (Album album in albums) + { + try + { + IEnumerable<MediaInformation> mediaList = await album.GetMediaInformationsAsync(null); + Tizen.Log.Info(TAG, "Executing TC:albummediaInfo_CHECK_RESULT Album"); + } + catch (Exception) + { + Assert.Fail(); + } + } + Tizen.Log.Info(TAG, "Executing TC:albummediaInfo_CHECK_RESULT Album end"); + } + + [Test] + [Category("P1")] + [Description("Test for Album properties...")] + [Property("SPEC", " Tizen.Content.MediaContent.Album.Artist A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "P")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static async Task readAlbumProperties_CHECK_RESULT() + { + Tizen.Log.Info(TAG, "Executing TC:readAlbumProperties_CHECK_RESULT Album"); + try + { + Task<IEnumerable<Album>> albumsTask = ContentManager.Database.SelectAsync<Album>(null); + await albumsTask; + IEnumerable<Album> albums = albumsTask.Result; + foreach (Album album in albums) + { + Tizen.Log.Info(TAG, "Executing TC:readAlbumProperties_CHECK_RESULT Album art : "+ album.Art); + LogUtils.write(LogUtils.INFO, _logTag, "Album art is : "+ album.Art); + Tizen.Log.Info(TAG, "Executing TC:readAlbumProperties_CHECK_RESULT Album artist :" +album.Artist); + LogUtils.write(LogUtils.INFO, _logTag, "Album artist is : " + album.Artist); + LogUtils.write(LogUtils.INFO, _logTag, "Album artist is : " + album.Name); + Tizen.Log.Info(TAG, "Executing TC:readAlbumProperties_CHECK_RESULT Album Name :" +album.Name); + } + }catch(Exception e) + { + Assert.Fail(); + } + Tizen.Log.Info(TAG, "Executing TC:readAlbumProperties_CHECK_RESULT Album end"); + } + + } +} diff --git a/tct-mediacontent-tizen-tests/src/Testcase/TSBookmark.cs b/tct-mediacontent-tizen-tests/src/Testcase/TSBookmark.cs new file mode 100644 index 0000000..bac291b --- /dev/null +++ b/tct-mediacontent-tizen-tests/src/Testcase/TSBookmark.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TestFramework; +using Tizen.Content.MediaContent; + +namespace tct.src.testcases +{ + [TestFixture] + [Description("Tizen.Content.MediaContent.Bookmark Tests")] + class BookmarkT + { + private static ContentFilter videoFilter; + private static ContentFilter audioFilter; + private static ContentFilter imageFilter; + private static IEnumerable<MediaInformation> videoList; + private static IEnumerable<MediaInformation> imageList; + private static IEnumerable<MediaInformation> audioList; + private static MediaBookmark bookmarkVideo; + private static MediaBookmark bookmarkAudio; + static async Task MediaBookmarkSetup() + { + await ContentManager.ScanFolderAsync("/home/owner/content", true); + videoFilter = new ContentFilter(); + videoFilter.Condition = "MEDIA_TYPE = 1"; + Task<IEnumerable<MediaInformation>> getVideoListTask = ContentManager.Database.SelectAsync<MediaInformation>(videoFilter); + videoList = await getVideoListTask; + + imageFilter = new ContentFilter(); + imageFilter.Condition = "MEDIA_TYPE = 0"; + Task<IEnumerable<MediaInformation>> getImageListTask = ContentManager.Database.SelectAsync<MediaInformation>(imageFilter); + imageList = await getImageListTask; + + audioFilter = new ContentFilter(); + audioFilter.Condition = "MEDIA_TYPE = 3"; + Task<IEnumerable<MediaInformation>> getAudioListTask = ContentManager.Database.SelectAsync<MediaInformation>(audioFilter); + audioList = await getAudioListTask; + } + + [SetUp] + public static void Init() + { + //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST"); + } + + [TearDown] + public static void Destroy() + { + //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST"); + } + + [Test] + [Category("P1")] + [Description("Test MediaBookmark constructor")] + [Property("SPEC", " Tizen.Content.MediaContent.MediaBookmark.MediaBookmark C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task MediaBookmark_CREATION() + { + await MediaBookmarkSetup(); + Assert.IsTrue(videoList.Count() > 0); + Assert.IsTrue(audioList.Count() > 0); + + ImageInformation thumbnailImage = (ImageInformation)imageList.ElementAt(0); + string thumbnailPath = thumbnailImage.FilePath; + VideoInformation video = (VideoInformation)videoList.ElementAt(0); + AudioInformation audio = (AudioInformation)audioList.ElementAt(0); + + IEnumerable<MediaBookmark> bookmarkVideoList = await video.GetMediaBookmarksAsync(null); + IEnumerable<MediaBookmark> bookmarkAudioList = await audio.GetMediaBookmarksAsync(null); + foreach (MediaBookmark mediaBookmark in bookmarkVideoList) + { + video.DeleteBookmark(mediaBookmark); + } + foreach (MediaBookmark mediaBookmark in bookmarkAudioList) + { + audio.DeleteBookmark(mediaBookmark); + } + bookmarkVideo = await video.AddBookmark(9, thumbnailPath); + bookmarkAudio = await audio.AddBookmark(7); + Assert.IsTrue(bookmarkVideo.Id > 0); + Assert.IsTrue(bookmarkAudio.Id > 0); + } + + [Test] + [Category("P1")] + [Description("Test if get for MediaBookmark:Id is working properly")] + [Property("SPEC", " Tizen.Content.MediaContent.MediaBookmark.Id A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void Id_READ_ONLY() + { + Assert.IsFalse(bookmarkVideo.Id == 0); + Assert.IsFalse(bookmarkAudio.Id == 0); + } + + [Test] + [Category("P1")] + [Description("Test if get for MediaBookmark:ThumbnailPath is working properly")] + [Property("SPEC", " Tizen.Content.MediaContent.MediaBookmark.ThumbnailPath A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void ThumbnailPath_READ_ONLY() + { + Assert.IsInstanceOf<string>(bookmarkVideo.ThumbnailPath); + Assert.IsTrue(bookmarkAudio.ThumbnailPath == null); + } + + [Test] + [Category("P1")] + [Description("Test if get for MediaBookmark:Offset is working properly")] + [Property("SPEC", " Tizen.Content.MediaContent.MediaBookmark.Offset A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void Offset_READ_ONLY() + { + Assert.IsInstanceOf<uint>(bookmarkVideo.Offset); + Assert.IsInstanceOf<uint>(bookmarkAudio.Offset); + } + } +} diff --git a/tct-mediacontent-tizen-tests/src/Testcase/TSContentManager.cs b/tct-mediacontent-tizen-tests/src/Testcase/TSContentManager.cs new file mode 100644 index 0000000..de9e8b5 --- /dev/null +++ b/tct-mediacontent-tizen-tests/src/Testcase/TSContentManager.cs @@ -0,0 +1,147 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using TestFramework; +using Tizen.Content.MediaContent; +using System.IO; + +namespace TizenTest.MediaInformationT +{ + [TestFixture] + [Description("Tizen.Content.MediaContent.ContentManager Tests")] + class TSContentManager + { + private static string TAG = "TCT"; + private static string _logTag = "TizenTest.MediaInformationT.ContentManager"; + private static string _rootPath = "/home/owner/content/uts-media/"; + [SetUp] + public static void Init() + { + //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST"); + } + + [TearDown] + public static void Destroy() + { + //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST"); + } + + [Test] + [Category("P1")] + [Description("Test for ScanFile in ContentManager ...")] + [Property("SPEC", " Tizen.Content.MediaContent.ContentManager.Scan M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static void scanFile_CHECK_RESULT() + { + Tizen.Log.Info(TAG, "Executing TC:scanFile_CHECK_RESULT ContentManager"); + string path = _rootPath + "test_scan.jpg"; + try + { + ContentManager.Scan(path); + }catch(Exception e) + { + Tizen.Log.Info(TAG, "Executing TC:scanFile_CHECK_RESULT ContentManager failed : "+ e.Message ); + Assert.Fail(); + } + Tizen.Log.Info(TAG, "Executing TC:scanFile_CHECK_RESULT ContentManager end"); + } + + [Test] + [Category("P2")] + [Description("Test for ScanFile in ContentManager ...")] + [Property("SPEC", " Tizen.Content.MediaContent.ContentManager.Scan M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static void invalidScanFile_CHECK_RESULT() + { + Tizen.Log.Info(TAG, "Executing TC:invalidScanFile_CHECK_RESULT ContentManager"); + string path = _rootPath +"/Unknown.jpg"; + try + { + ContentManager.Scan(path); + Assert.Fail(); + } + catch (Exception e) + { + Assert.Pass(); + } + Tizen.Log.Info(TAG, "Executing TC:invalidScanFile_CHECK_RESULT ContentManager end"); + } + + [Test] + [Category("P1")] + [Description("Test for ScanFolder in ContentManager ...")] + [Property("SPEC", " Tizen.Content.MediaContent.ContentManager.ScanFolder M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static async Task scanFolder_CHECK_RESULT() + { + Tizen.Log.Info(TAG, "Executing TC:scanFolder_CHECK_RESULT ContentManager"); + string path = _rootPath +"test_scan_folder"; + try + { + await ContentManager.ScanFolderAsync(path); + } + catch (Exception) + { + LogUtils.write(LogUtils.ERROR, _logTag, "Failed to scan folder :" + path); + Assert.Fail(); + } + Tizen.Log.Info(TAG, "Executing TC:scanFolder_CHECK_RESULT ContentManager end"); + } + + [Test] + [Category("P1")] + [Description("Test for ScanFolder in ContentManager ...")] + [Property("SPEC", " Tizen.Content.MediaContent.ContentManager.AddMediaInformationBatchAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static async Task insertBatch_CHECK_RESULT() + { + Tizen.Log.Info(TAG, "Executing TC:insertBatch_CHECK_RESULT ContentManager"); + //string path = "/home/owner/content/test_media_batch"; + string[] files = Directory.GetFiles(_rootPath + "batch", "*.png"); + + try + { + await ContentManager.AddMediaInformationBatchAsync(files); + } + catch (Exception e) + { + Tizen.Log.Info(TAG, "Executing TC:insertBatch_CHECK_RESULT ContentManager failed : " + e.Message ); + Assert.Fail(); + } + Tizen.Log.Info(TAG, "Executing TC:insertBatch_CHECK_RESULT ContentManager end"); + } + + [Test] + [Category("P1")] + [Description("Test for ScanFolder in ContentManager ...")] + [Property("SPEC", " Tizen.Content.MediaContent.ContentManager.RemoveMediaInformationBatchAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static async Task removeBatch_CHECK_RESULT() + { + ContentFilter filter = new ContentFilter(); + filter.Condition = "MEDIA_PATH = " + _rootPath + "batch"; + Tizen.Log.Info(TAG, "Executing TC:removeBatch_CHECK_RESULT ContentManager"); + try + { + await ContentManager.RemoveMediaInformationBatchAsync(filter); + + } + catch (Exception e) + { + Tizen.Log.Info(TAG, "Executing TC:removeBatch_CHECK_RESULT ContentManager failed : "+ e.Message ); + Assert.Fail(); + } + Tizen.Log.Info(TAG, "Executing TC:removeBatch_CHECK_RESULT ContentManager end"); + } + } +} diff --git a/tct-mediacontent-tizen-tests/src/Testcase/TSFolder.cs b/tct-mediacontent-tizen-tests/src/Testcase/TSFolder.cs new file mode 100644 index 0000000..f9a4c49 --- /dev/null +++ b/tct-mediacontent-tizen-tests/src/Testcase/TSFolder.cs @@ -0,0 +1,153 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using TestFramework; +using Tizen.Content.MediaContent; +namespace TizenTest.MediaInformationT +{ + [TestFixture] + [Description("Tizen.Content.MediaContent.Folder Tests")] + class TSFolder + { + private static string TAG = "TCT"; + [SetUp] + public static void Init() + { + //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST"); + } + + [TearDown] + public static void Destroy() + { + //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST"); + } + + [Test] + [Category("P1")] + [Description("Test for Folder count ...")] + [Property("SPEC", " Tizen.Content.MediaContent.Folder.GetCount M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static void folderCount_CHECK_RESULT() + { + Tizen.Log.Info(TAG, "Executing TC:folderCount_CHECK_RESULT"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderCount_CHECK_RESULT "); + ContentFilter filter = new ContentFilter(); + filter.StorageId = "media"; + int Count = ContentManager.Database.GetCount<MediaFolder>(filter); + Tizen.Log.Info(TAG, "Executing TC:folderCount_CHECK_RESULT count "+ Count); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderCount_CHECK_RESULT count "+ Count); + + Assert.IsTrue(Count > 0, "Failed to get the folder Count"); + } + + [Test] + [Category("P1")] + [Description("Test for Group list ...")] + [Property("SPEC", " Tizen.Content.MediaContent.Folder.Nanme A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static async Task folderName_CHECK_RESULT() + { + try + { + Tizen.Log.Info(TAG, "Executing TC:folderName_CHECK_RESULT"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderName_CHECK_RESULT "); + + ContentFilter filter = new ContentFilter(); + filter.Condition = "MEDIA_PATH = \'/opt/media/SDCardA1/Test-media\'"; + IEnumerable<MediaFolder> folders = await ContentManager.Database.SelectAsync<MediaFolder>(filter); + foreach (MediaFolder folder in folders) + { + Assert.IsTrue(folder.Name.Length > 0, "Failed to get the folder information"); + Tizen.Log.Info(TAG, "Executing TC:folderName_CHECK_RESULT before update folder"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderName_CHECK_RESULT before updatefodler"); + //folder.Name = "Test_MediaContent"; + //ContentManager.Database.Update(folder); + Tizen.Log.Info(TAG, "Executing TC:folderName_CHECK_RESULT update folder path "+ folder.FolderPath); + Tizen.Log.Info(TAG, "Executing TC:folderName_CHECK_RESULT update folder Id "+ folder.StorageId); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderName_CHECK_RESULT updated folder"); + Assert.IsTrue(folder.Name.CompareTo("Test_MediaContent") == 0, "Failed to update the folder name"); + Tizen.Log.Info(TAG, "Executing TC:folderName_CHECK_RESULT name "+folder.Name); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderName_CHECK_RESULT name"+folder.Name); + } + } + catch(Exception) + { + Assert.Fail(); + } + } + + [Test] + [Category("P1")] + [Description("Test for Group list ...")] + [Property("SPEC", " Tizen.Content.MediaContent.Folder.MediaCount M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static async Task folderMediaCount_CHECK_RESULT() + { + try + { + Tizen.Log.Info(TAG, "Executing TC:folderMediaCount_CHECK_RESULT"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderMediaCount_CHECK_RESULT "); + + ContentFilter filter = new ContentFilter(); + filter.StorageId = "media"; + IEnumerable<MediaFolder> folders = await ContentManager.Database.SelectAsync<MediaFolder>(filter); + foreach (MediaFolder folder in folders) + { + Tizen.Log.Info(TAG, "Executing TC:folderMediaCount_CHECK_RESULT mediacount "+folder.GetMediaInformationCount(null)); + Tizen.Log.Info(TAG, "Executing TC:folderMediaCount_CHECK_RESULT mediacount "+folder.GetMediaInformationCount(null)); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderMediaCount_CHECK_RESULT "); + Assert.IsTrue(folder.GetMediaInformationCount(null) > 0, "Failed to get the media information count from the folder"); + break; + } + } + catch (Exception) + { + Assert.Fail(); + } + } + + [Test] + [Category("P1")] + [Description("Test for MediaInformation in Folder ...")] + [Property("SPEC", " Tizen.Content.MediaContent.Folder.MediaInfo M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static async Task folderMediaInfo_CHECK_RESULT() + { + Tizen.Log.Info(TAG, "Executing TC:folderMediaInfo_CHECK_RESULT"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderMediaInfo_CHECK_RESULT "); + ContentFilter filter = new ContentFilter(); + filter.StorageId = "media"; + IEnumerable<MediaFolder> folders = await ContentManager.Database.SelectAsync<MediaFolder>(filter); + foreach (MediaFolder folder in folders) + { + try + { + if (folder.GetMediaInformationCount(null) > 0) + { + IEnumerable<MediaInformation> infos = await folder.GetMediaInformationsAsync(null); + } + } + catch (Exception) + { + Tizen.Log.Info(TAG, "Executing TC:folderMediaInfo_CHECK_RESULT failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderMediaInfo_CHECK_RESULT failed"); + + Assert.Fail(); + } + } + Tizen.Log.Info(TAG, "Executing TC:folderMediaInfo_CHECK_RESULT done"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderMediaInfo_CHECK_RESULT done"); + + Assert.Pass(); + } + + } +} diff --git a/tct-mediacontent-tizen-tests/src/Testcase/TSGroup.cs b/tct-mediacontent-tizen-tests/src/Testcase/TSGroup.cs new file mode 100644 index 0000000..1eb1422 --- /dev/null +++ b/tct-mediacontent-tizen-tests/src/Testcase/TSGroup.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using TestFramework; +using Tizen.Content.MediaContent; +namespace TizenTest.MediaInformationT +{ + [TestFixture] + [Description("Tizen.Content.MediaContent.Group Tests")] + class TSGroup + { + [SetUp] + public static void Init() + { + //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST"); + } + + [TearDown] + public static void Destroy() + { + //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST"); + } + + [Test] + [Category("P1")] + [Description("Test for Group count ...")] + [Property("SPEC", " Tizen.Content.MediaContent.Group M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static void groupCount_CHECK_RESULT() + { + ContentFilter filter = new ContentFilter(); + filter.GroupType = MediaGroupType.DisplayName; + int Count = ContentManager.Database.GetCount<Group>(filter); + Assert.IsTrue(Count > 0, "Failed to get the group Count"); + } + + [Test] + [Category("P1")] + [Description("Test for Group list ...")] + [Property("SPEC", " Tizen.Content.MediaContent.Group.Nanme A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "P")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static async Task groupList_CHECK_RESULT() + { + ContentFilter filter = new ContentFilter(); + filter.GroupType = MediaGroupType.DisplayName; + Task<IEnumerable<Group>> groupListTask = ContentManager.Database.SelectAsync<Group>(filter); + await groupListTask; + IEnumerable<Group> groups = groupListTask.Result; + foreach( Group group in groups) + { + Assert.IsTrue(group.Name.Length > 0, "Failed to get the group information"); + } + } + + [Test] + [Category("P1")] + [Description("Test for MediaInformation count in Group ...")] + [Property("SPEC", " Tizen.Content.MediaContent.Group M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static async Task groupmediaCount_CHECK_RESULT() + { + ContentFilter filter = new ContentFilter(); + filter.GroupType = MediaGroupType.DisplayName; + Task<IEnumerable<Group>> groupListTask = ContentManager.Database.SelectAsync<Group>(filter); + await groupListTask; + IEnumerable<Group> groups = groupListTask.Result; + foreach (Group group in groups) + { + Assert.IsTrue(group.GetMediaInformationCount(filter) > 0, "Failed to get the media information count from group"); + } + } + + [Test] + [Category("P1")] + [Description("Test for MediaInformation in Group ...")] + [Property("SPEC", " Tizen.Content.MediaContent.Group M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static async Task groupmediaInfo_CHECK_RESULT() + { + ContentFilter filter = new ContentFilter(); + filter.GroupType = MediaGroupType.DisplayName; + Task<IEnumerable<Group>> groupListTask = ContentManager.Database.SelectAsync<Group>(filter); + await groupListTask; + IEnumerable<Group> groups = groupListTask.Result; + foreach (Group group in groups) + { + try + { + Task<IEnumerable<MediaInformation>> mediaListTask = group.GetMediaInformationsAsync(filter); + await mediaListTask; + } + catch(Exception) + { + Assert.Fail(); + } + } + } + + } +} diff --git a/tct-mediacontent-tizen-tests/src/Testcase/TSMediaFace.cs b/tct-mediacontent-tizen-tests/src/Testcase/TSMediaFace.cs new file mode 100644 index 0000000..02ecb62 --- /dev/null +++ b/tct-mediacontent-tizen-tests/src/Testcase/TSMediaFace.cs @@ -0,0 +1,122 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TestFramework; +using Tizen.Content.MediaContent; + +namespace tct.src.testcases +{ + [TestFixture] + [Description("Tizen.Content.MediaContent.Bookmark Tests")] + class MediaFaceT + { + private static ContentFilter imageFilter; + private static IEnumerable<MediaInformation> imageList; + private static MediaFace face; + static async Task MediaFaceSetup() + { + await ContentManager.ScanFolderAsync("/home/owner/content", true); + imageFilter = new ContentFilter(); + imageFilter.Condition = "MEDIA_TYPE = 0"; + Task<IEnumerable<MediaInformation>> getImageListTask = ContentManager.Database.SelectAsync<MediaInformation>(imageFilter); + imageList = await getImageListTask; + } + [SetUp] + public static void Init() + { + //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST"); + } + + [TearDown] + public static void Destroy() + { + //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST"); + } + + [Test] + [Category("P1")] + [Description("Test MediaFace constructor")] + [Property("SPEC", " Tizen.Content.MediaContent.MediaFace.MediaFace C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task MediaFace_CONSTRUCTOR() + { + await MediaFaceSetup(); + ImageInformation image = (ImageInformation)imageList.ElementAt(0); + face = new MediaFace(image, new FaceRect(2, 2, 5, 5)); + Assert.IsInstanceOf<MediaFace>(face); + Assert.IsTrue(face.Id == null); + image.AddFace(face); + Assert.IsInstanceOf<string>(face.Id); + } + + [Test] + [Category("P1")] + [Description("Test if get for MediaFace:Id is working properly")] + [Property("SPEC", " Tizen.Content.MediaContent.MediaFace.Id A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void Id_READ_ONLY() + { + Assert.IsInstanceOf<string>(face.Id); + } + + [Test] + [Category("P1")] + [Description("Test if get for MediaFace:MediaInformationId is working properly")] + [Property("SPEC", " Tizen.Content.MediaContent.MediaFace.MediaInformationId A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void MediaInformationId_READ_ONLY() + { + Assert.IsInstanceOf<string>(face.MediaInformationId); + } + + [Test] + [Category("P1")] + [Description("Test if get/set for MediaFace:Rect is working properly")] + [Property("SPEC", " Tizen.Content.MediaContent.MediaFace.Rect A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void Rect_READ_ONLY() + { + face.Rect = new FaceRect(3, 3, 6, 6); + Assert.IsTrue(face.Rect.X == 3); + Assert.IsTrue(face.Rect.Y == 3); + Assert.IsTrue(face.Rect.Width == 6); + Assert.IsTrue(face.Rect.Height == 6); + } + + [Test] + [Category("P1")] + [Description("Test if get/set for MediaFace:Tag is working properly")] + [Property("SPEC", " Tizen.Content.MediaContent.MediaFace.Tag A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void Tag_READ_ONLY() + { + face.Tag = "custom_tag"; + Assert.IsTrue(face.Tag.CompareTo("custom_tag") == 0); + } + + [Test] + [Category("P1")] + [Description("Test if get/set for MediaFace:Orientation is working properly")] + [Property("SPEC", " Tizen.Content.MediaContent.MediaFace.Orientation A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void Orientation_READ_ONLY() + { + face.Orientation = MediaContentOrientation.Transpose; + Assert.IsTrue(face.Orientation == MediaContentOrientation.Transpose); + } + } +} diff --git a/tct-mediacontent-tizen-tests/src/Testcase/TSMediaInformation.cs b/tct-mediacontent-tizen-tests/src/Testcase/TSMediaInformation.cs new file mode 100644 index 0000000..9697c23 --- /dev/null +++ b/tct-mediacontent-tizen-tests/src/Testcase/TSMediaInformation.cs @@ -0,0 +1,986 @@ +using System; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Collections; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using System.Runtime.CompilerServices; +using System.Diagnostics; +using TestFramework; +using Tizen; +using Tizen.Applications; +using Tizen.UI; +using Tizen.Content.MediaContent; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.Runtime.InteropServices; + + +namespace TizenTest.MediaInformationT { + + + [TestFixture] + [Description("Tizen.Content.MediaContent.MediaInformation Tests")] + public class MediaInformationTest + { + + private static string TAG = "TCT"; + private static string ImagePath = "/home/owner/content/Chrysanthemum.jpg"; + private static string Path = "/home/owner/content/"; + private static string MovedImagePath = "/home/owner/content/Images/Chrysanthemum.jpg"; + private static string AudioPath = "/home/owner/content/Airlift.mp3"; + private static string VideoPath = "/home/owner/content/Wildlife.wmv"; + + [SetUp] + public static void Init() + { + //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST"); + } + + [TearDown] + public static void Destroy() + { + //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST"); + } + + [Test] + [Category("P1")] + [Description("Test for GetMediaInformationAsync ...")] + [Property("SPEC", " Tizen.Content.MediaContent.MediaInformation.GetMediaInformationAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] + public static async Task GetMediaInformationAsync_RETURN_VALUE() + { + /* PRECONDITION + * Scan the test files + */ + ContentManager.Scan (VideoPath); + ContentManager.Scan (ImagePath); + ContentManager.Scan (AudioPath); + /** TEST */ + Tizen.Log.Info(TAG, "Executing TC:GetMediaInformationAsync_RETURN_VALUE"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:GetMediaInformationAsync_RETURN_VALUE"); + try + { + int mediacount = 0; + IEnumerable<MediaInformation> res = await ContentManager.Database.SelectAsync<MediaInformation>(null); + foreach (MediaInformation i in res) + { + mediacount += 1; + } + if(mediacount == 0) + { + Tizen.Log.Info(TAG, "Fail"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Fail"); + Assert.Fail(); + } + else + { + Tizen.Log.Info(TAG, "Pass"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Pass"); + Assert.Pass(); + } + } + catch (Exception e) + { + Tizen.Log.Info(TAG, "Got Exception" + e.ToString()); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Got Exception" + e.ToString()); + Assert.Fail(); + } + Tizen.Log.Info(TAG, "Executing TC:GetMediaInformationAsync_RETURN_VALUE Completed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:GetMediaInformationAsync_RETURN_VALUE Completed"); + + } + + [Test] + [Category("P1")] + [Description("Test for MediaInformation Getters ...")] + [Property("SPEC", " Tizen.Content.MediaContent.MediaInformation U")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] + public static async Task Getters_USAGE() + { + /** PRECONDITION + * 1. Get the MediaInformation + */ + Tizen.Log.Info(TAG, "Executing TC:Getters_USAGE"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:Getters_USAGE"); + try + { + IEnumerable<MediaInformation> res = await ContentManager.Database.SelectAsync<MediaInformation>(null); + foreach (MediaInformation i in res) + { + if((String.Compare(AudioPath,i.FilePath)==0) || (String.Compare(ImagePath,i.FilePath)==0) || (String.Compare(VideoPath,i.FilePath)==0)) + { + /* TEST */ + Tizen.Log.Info(TAG, "Executing TC:Getters_USAGE in loop"); + Tizen.Log.Info(TAG, "Media MediaId " + i.MediaId); + Tizen.Log.Info(TAG, "Media FilePath " + i.FilePath); + Tizen.Log.Info(TAG, "Media DisplayName " + i.DisplayName); + Tizen.Log.Info(TAG, "Media MediaType " + i.MediaType); + Tizen.Log.Info(TAG, "Media MimeType " + i.MimeType); + Tizen.Log.Info(TAG, "Media Size " + i.Size); + Tizen.Log.Info(TAG, "Media AddedAt " + i.AddedAt); + Tizen.Log.Info(TAG, "Media ModifiedAt " + i.ModifiedAt); + Tizen.Log.Info(TAG, "Media TimeLine " + i.TimeLine); + Tizen.Log.Info(TAG, "Media ThumbnailPath " + i.ThumbnailPath); + Tizen.Log.Info(TAG, "Media Description " + i.Description); + Tizen.Log.Info(TAG, "Media Longitude " + i.Longitude); + Tizen.Log.Info(TAG, "Media Latitude " + i.Latitude); + Tizen.Log.Info(TAG, "Media Altitude " + i.Altitude); + Tizen.Log.Info(TAG, "Media Weather " + i.Weather); + Tizen.Log.Info(TAG, "Media Rating " + i.Rating); + Tizen.Log.Info(TAG, "Media IsFavourite " + i.IsFavourite); + Tizen.Log.Info(TAG, "Media Author " + i.Author); + Tizen.Log.Info(TAG, "Media Provider " + i.Provider); + Tizen.Log.Info(TAG, "Media ContentName " + i.ContentName); + Tizen.Log.Info(TAG, "Media Title " + i.Title); + Tizen.Log.Info(TAG, "Media Category " + i.Category); + Tizen.Log.Info(TAG, "Media LocationTag " + i.LocationTag); + Tizen.Log.Info(TAG, "Media AgeRating " + i.AgeRating); + Tizen.Log.Info(TAG, "Media Keyword " + i.Keyword); + Tizen.Log.Info(TAG, "Media StorageId " + i.StorageId); + Tizen.Log.Info(TAG, "Media IsDRM " + i.IsDrm); + Tizen.Log.Info(TAG, "Media StorageType " + i.StorageType); + Tizen.Log.Info(TAG, "Media PlayedCount " + i.PlayedCount); + Tizen.Log.Info(TAG, "Media PlayedAt " + i.PlayedAt); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:Setters_USAGE in loop"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media MediaId " + i.MediaId); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media FilePath " + i.FilePath); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media DisplayName " + i.DisplayName); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media MediaType " + i.MediaType); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media MimeType " + i.MimeType); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Size " + i.Size); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media AddedAt " + i.AddedAt); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media ModifiedAt " + i.ModifiedAt); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media TimeLine " + i.TimeLine); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media ThumbnailPath " + i.ThumbnailPath); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Description " + i.Description); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Longitude " + i.Longitude); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Latitude " + i.Latitude); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Altitude " + i.Altitude); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Weather " + i.Weather); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Rating " + i.Rating); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media IsFavourite " + i.IsFavourite); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Author " + i.Author); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Provider " + i.Provider); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media ContentName " + i.ContentName); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Title " + i.Title); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Category " + i.Category); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media LocationTag " + i.LocationTag); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media AgeRating " + i.AgeRating); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Keyword " + i.Keyword); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media StorageId " + i.StorageId); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media IsDRM " + i.IsDrm); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media StorageType " + i.StorageType); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media PlayedCount " + i.PlayedCount); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media PlayedAt " + i.PlayedAt); + + if (i.MediaType == MediaContentType.Image) + { + Tizen.Log.Info(TAG, "Image found"); + ImageInformation img = (ImageInformation)i; + Tizen.Log.Info(TAG, "GetIamge Done"); + Tizen.Log.Info(TAG, "Image MediaId " + img.MediaId); + Tizen.Log.Info(TAG, "Image Width " + img.Width); + Tizen.Log.Info(TAG, "Image Height " + img.Height); + Tizen.Log.Info(TAG, "Image Orientation " + img.Orientation); + Tizen.Log.Info(TAG, "Image TakenDate " + img.TakenDate); + Tizen.Log.Info(TAG, "Image BurstId " + img.BurstId); + Tizen.Log.Info(TAG, "Image ExposureTime " + img.ExposureTime); + Tizen.Log.Info(TAG, "Image FNumber " + img.FNumber); + Tizen.Log.Info(TAG, "Image ISO " + img.Iso); + Tizen.Log.Info(TAG, "Image Model " + img.Model); + Tizen.Log.Info(TAG, "Image IsBurstShot " + img.IsBurstShot); + + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "GetIamge Done"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image MediaId " + img.MediaId); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image Width " + img.Width); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image Height " + img.Height); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image Orientation " + img.Orientation); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image TakenDate " + img.TakenDate); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image BurstId " + img.BurstId); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image ExposureTime " + img.ExposureTime); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image FNumber " + img.FNumber); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image ISO " + img.Iso); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image Model " + img.Model); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image IsBurstShot " + img.IsBurstShot); + + } + if (i.MediaType == MediaContentType.Video) + { + Tizen.Log.Info(TAG, "Video found"); + VideoInformation vid = (VideoInformation)i; + Tizen.Log.Info(TAG, "GetVideo Done"); + Tizen.Log.Info(TAG, "Video MediaId " + vid.MediaId); + Tizen.Log.Info(TAG, "Video Album " + vid.Album); + Tizen.Log.Info(TAG, "Video Artist " + vid.Artist); + Tizen.Log.Info(TAG, "Video AlbumArtist " + vid.AlbumArtist); + Tizen.Log.Info(TAG, "Video Genre " + vid.Genre); + Tizen.Log.Info(TAG, "Video Composer " + vid.Composer); + Tizen.Log.Info(TAG, "Video Year " + vid.Year); + Tizen.Log.Info(TAG, "Video RecordedDate " + vid.RecordedDate); + Tizen.Log.Info(TAG, "Video Copyright " + vid.Copyright); + Tizen.Log.Info(TAG, "Video TrackNumber " + vid.TrackNumber); + Tizen.Log.Info(TAG, "Video BitRate " + vid.BitRate); + Tizen.Log.Info(TAG, "Video Duration " + vid.Duration); + Tizen.Log.Info(TAG, "Video Width " + vid.Width); + Tizen.Log.Info(TAG, "Video Height " + vid.Height); + Tizen.Log.Info(TAG, "Video PlayedCount " + vid.PlayedCount); + Tizen.Log.Info(TAG, "Video PlayedAt " + vid.PlayedAt); + Tizen.Log.Info(TAG, "Video PlayedPosition " + vid.PlayedPosition); + + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video MediaId " + vid.MediaId); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video Album " + vid.Album); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video Artist " + vid.Artist); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video AlbumArtist " + vid.AlbumArtist); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video Genre " + vid.Genre); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video Composer " + vid.Composer); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video Year " + vid.Year); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video RecordedDate " + vid.RecordedDate); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video Copyright " + vid.Copyright); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video TrackNumber " + vid.TrackNumber); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video BitRate " + vid.BitRate); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video Duration " + vid.Duration); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video Width " + vid.Width); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video Height " + vid.Height); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video PlayedCount " + vid.PlayedCount); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video PlayedAt " + vid.PlayedAt); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video PlayedPosition " + vid.PlayedPosition); + + } + if (i.MediaType == MediaContentType.Music) + { + + Tizen.Log.Info(TAG, "Audio found"); + AudioInformation aud = (AudioInformation)i; + Tizen.Log.Info(TAG, "GetAudio Done"); + + + Tizen.Log.Info(TAG, "Audio MediaId " + aud.MediaId); + Tizen.Log.Info(TAG, "Audio Album " + aud.Album); + Tizen.Log.Info(TAG, "Audio Artist " + aud.Artist); + Tizen.Log.Info(TAG, "Audio AlbumArtist " + aud.AlbumArtist); + Tizen.Log.Info(TAG, "Audio Genre " + aud.Genre); + Tizen.Log.Info(TAG, "Audio Composer " + aud.Composer); + Tizen.Log.Info(TAG, "Audio Year " + aud.Year); + Tizen.Log.Info(TAG, "Audio RecordedDate " + aud.RecordedDate); + Tizen.Log.Info(TAG, "Audio Copyright " + aud.Copyright); + Tizen.Log.Info(TAG, "Audio TrackNumber " + aud.TrackNumber); + Tizen.Log.Info(TAG, "Audio BitRate " + aud.BitRate); + Tizen.Log.Info(TAG, "Audio BitPerSample " + aud.BitPerSample); + Tizen.Log.Info(TAG, "Audio SampleRate " + aud.SampleRate); + Tizen.Log.Info(TAG, "Audio Channel " + aud.Channel); + Tizen.Log.Info(TAG, "Audio Duration " + aud.Duration); + Tizen.Log.Info(TAG, "Audio PlayedCount " + aud.PlayedCount); + Tizen.Log.Info(TAG, "Audio PlayedAt " + aud.PlayedAt); + Tizen.Log.Info(TAG, "Audio PlayedPosition " + aud.PlayedPosition); + + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio MediaId " + aud.MediaId); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio Album " + aud.Album); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio Artist " + aud.Artist); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio AlbumArtist " + aud.AlbumArtist); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio Genre " + aud.Genre); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio Composer " + aud.Composer); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio Year " + aud.Year); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio RecordedDate " + aud.RecordedDate); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio Copyright " + aud.Copyright); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio TrackNumber " + aud.TrackNumber); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio BitRate " + aud.BitRate); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio BitPerSample " + aud.BitPerSample); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio SampleRate " + aud.SampleRate); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio Channel " + aud.Channel); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio Duration " + aud.Duration); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio PlayedCount " + aud.PlayedCount); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio PlayedAt " + aud.PlayedAt); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio PlayedPosition " + aud.PlayedPosition); + } + if (i.MediaType == MediaContentType.Sound) + { + Tizen.Log.Info(TAG, "Sound found"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Sound found"); + } + if (i.MediaType == MediaContentType.Others) + { + Tizen.Log.Info(TAG, "Others found"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Others found"); + } + } + } + Assert.Pass(); + } + catch (Exception e) + { + Tizen.Log.Info(TAG, "Got Exception" + e.ToString()); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Got Exception" + e.ToString()); + Assert.Fail(); + } + Tizen.Log.Info(TAG, "Executing TC:Getters_USAGE Completed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:Getters_USAGE Completed"); + } + + public static void setMedia(MediaInformation i) + { + i.AddedAt = DateTime.Now; + i.Description = "Test"; + i.Longitude = 200; + i.Latitude = 300; + i.Altitude = 400; + i.Weather = "Good"; + i.Rating = 10; + i.IsFavourite = true; + i.Author = "Manish"; + i.Provider = "Man"; + i.ContentName = "TestImage"; + i.Category = "ImageTest"; + i.LocationTag = "Bangalore"; + i.AgeRating = "Old"; + i.Keyword = "M"; + i.PlayedCount = 6; + i.PlayedAt = DateTime.Now; + ContentManager.Database.Update(i); + } + + public static void setImage(ImageInformation i) + { + i.Orientation = MediaContentOrientation.HFlip; + ContentManager.Database.Update(i); + } + + public static void setVideo(VideoInformation i) + { + i.PlayedAt = DateTime.Now; + i.PlayedPosition = 5; + ContentManager.Database.Update(i); + } + + public static void setAudio(AudioInformation i) + { + i.PlayedCount = 6; + i.PlayedAt = DateTime.Now; + i.PlayedPosition = 5; + ContentManager.Database.Update(i); + } + + public static bool checkMedia(MediaInformation i) + { + bool pass = true; + if(String.Compare(i.Description , "Test")!=0) + { + Tizen.Log.Info(TAG, "Check Failed"+String.Compare(i.Description , "Test")); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"+String.Compare(i.Description , "Test")); + Assert.Fail(); + pass = false; + } + //TODO: Fix me + //i.AddedAt = DateTime.Now; + if(i.Longitude != 200) + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + pass = false; + } + if(i.Latitude != 300) + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + pass = false; + } + if(i.Altitude != 400) + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + pass = false; + } + if(String.Compare(i.Weather , "Good")!=0) + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + pass = false; + } + if(i.Rating != 10) + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + pass = false; + } + if(i.IsFavourite != true) + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + pass = false; + } + if(String.Compare(i.Author , "Manish")!=0) + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + pass = false; + } + if(String.Compare(i.Provider , "Man")!=0) + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + pass = false; + } + if(String.Compare(i.ContentName , "TestImage")!=0) + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + pass = false; + } + if(String.Compare(i.Category , "ImageTest")!=0) + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + pass = false; + } + if(String.Compare(i.LocationTag , "Bangalore")!=0) + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + pass = false; + } + if(String.Compare(i.AgeRating , "Old")!=0) + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + pass = false; + } + if(String.Compare(i.Keyword , "M")!=0) + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + pass = false; + } + //TODO: Fix me + /*if(i.PlayedCount != 6) + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + pass = false; + }*/ + //TODO: Fix me + //i.PlayedAt = DateTime.Now; + return pass; + } + + public static bool checkImage(ImageInformation i) + { + bool pass = true; + if(i.Orientation != MediaContentOrientation.HFlip) + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + pass = false; + } + return pass; + } + + public static bool checkVideo(VideoInformation i) + { + bool pass = true; + //i.PlayedAt = DateTime.Now; + if(i.PlayedPosition != 5) + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + pass = false; + } + return pass; + } + + public static bool checkAudio(AudioInformation i) + { + bool pass = true; + if(i.PlayedCount != 6) + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + pass = false; + } + //i.PlayedAt = DateTime.Now; + if(i.PlayedPosition != 5) + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + pass = false; + } + return pass; + } + + [Test] + [Category("P1")] + [Description("Test for MediaInformation Setters ...")] + [Property("SPEC", " Tizen.Content.MediaContent.MediaInformation U")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] + public static async Task Setters_USAGE() + { + /** PRECONDITION + * 1. Get the MediaInformation + */ + Tizen.Log.Info(TAG, "Executing TC:Setters_USAGE"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:Setters_USAGE"); + try + { + IEnumerable<MediaInformation> res = await ContentManager.Database.SelectAsync<MediaInformation>(null); + foreach (MediaInformation i in res) + { + if((String.Compare(AudioPath,i.FilePath)==0) || (String.Compare(ImagePath,i.FilePath)==0) || (String.Compare(VideoPath,i.FilePath)==0)) + { + setMedia(i); + /* TEST */ + Tizen.Log.Info(TAG, "Executing TC:Setters_USAGE in loop"); + Tizen.Log.Info(TAG, "Media MediaId " + i.MediaId); + Tizen.Log.Info(TAG, "Media FilePath " + i.FilePath); + Tizen.Log.Info(TAG, "Media DisplayName " + i.DisplayName); + Tizen.Log.Info(TAG, "Media MediaType " + i.MediaType); + Tizen.Log.Info(TAG, "Media MimeType " + i.MimeType); + Tizen.Log.Info(TAG, "Media Size " + i.Size); + Tizen.Log.Info(TAG, "Media AddedAt " + i.AddedAt); + Tizen.Log.Info(TAG, "Media ModifiedAt " + i.ModifiedAt); + Tizen.Log.Info(TAG, "Media TimeLine " + i.TimeLine); + Tizen.Log.Info(TAG, "Media ThumbnailPath " + i.ThumbnailPath); + Tizen.Log.Info(TAG, "Media Description " + i.Description); + Tizen.Log.Info(TAG, "Media Longitude " + i.Longitude); + Tizen.Log.Info(TAG, "Media Latitude " + i.Latitude); + Tizen.Log.Info(TAG, "Media Altitude " + i.Altitude); + Tizen.Log.Info(TAG, "Media Weather " + i.Weather); + Tizen.Log.Info(TAG, "Media Rating " + i.Rating); + Tizen.Log.Info(TAG, "Media IsFavourite " + i.IsFavourite); + Tizen.Log.Info(TAG, "Media Author " + i.Author); + Tizen.Log.Info(TAG, "Media Provider " + i.Provider); + Tizen.Log.Info(TAG, "Media ContentName " + i.ContentName); + Tizen.Log.Info(TAG, "Media Title " + i.Title); + Tizen.Log.Info(TAG, "Media Category " + i.Category); + Tizen.Log.Info(TAG, "Media LocationTag " + i.LocationTag); + Tizen.Log.Info(TAG, "Media AgeRating " + i.AgeRating); + Tizen.Log.Info(TAG, "Media Keyword " + i.Keyword); + Tizen.Log.Info(TAG, "Media StorageId " + i.StorageId); + Tizen.Log.Info(TAG, "Media IsDRM " + i.IsDrm); + Tizen.Log.Info(TAG, "Media StorageType " + i.StorageType); + Tizen.Log.Info(TAG, "Media PlayedCount " + i.PlayedCount); + Tizen.Log.Info(TAG, "Media PlayedAt " + i.PlayedAt); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:Setters_USAGE in loop"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media MediaId " + i.MediaId); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media FilePath " + i.FilePath); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media DisplayName " + i.DisplayName); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media MediaType " + i.MediaType); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media MimeType " + i.MimeType); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Size " + i.Size); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media AddedAt " + i.AddedAt); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media ModifiedAt " + i.ModifiedAt); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media TimeLine " + i.TimeLine); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media ThumbnailPath " + i.ThumbnailPath); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Description " + i.Description); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Longitude " + i.Longitude); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Latitude " + i.Latitude); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Altitude " + i.Altitude); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Weather " + i.Weather); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Rating " + i.Rating); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media IsFavourite " + i.IsFavourite); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Author " + i.Author); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Provider " + i.Provider); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media ContentName " + i.ContentName); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Title " + i.Title); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Category " + i.Category); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media LocationTag " + i.LocationTag); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media AgeRating " + i.AgeRating); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media Keyword " + i.Keyword); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media StorageId " + i.StorageId); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media IsDRM " + i.IsDrm); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media StorageType " + i.StorageType); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media PlayedCount " + i.PlayedCount); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media PlayedAt " + i.PlayedAt); + if(checkMedia(i) == true) + { + Assert.Pass(); + } + else + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + } + if (i.MediaType == MediaContentType.Image) + { + Tizen.Log.Info(TAG, "Image found"); + ImageInformation img = (ImageInformation)i; + Tizen.Log.Info(TAG, "GetImage Done"); + setImage(img); + Tizen.Log.Info(TAG, "Image MediaId " + img.MediaId); + Tizen.Log.Info(TAG, "Image Width " + img.Width); + Tizen.Log.Info(TAG, "Image Height " + img.Height); + Tizen.Log.Info(TAG, "Image Orientation " + img.Orientation); + Tizen.Log.Info(TAG, "Image TakenDate " + img.TakenDate); + Tizen.Log.Info(TAG, "Image BurstId " + img.BurstId); + Tizen.Log.Info(TAG, "Image ExposureTime " + img.ExposureTime); + Tizen.Log.Info(TAG, "Image FNumber " + img.FNumber); + Tizen.Log.Info(TAG, "Image ISO " + img.Iso); + Tizen.Log.Info(TAG, "Image Model " + img.Model); + Tizen.Log.Info(TAG, "Image IsBurstShot " + img.IsBurstShot); + + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "GetIamge Done"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image MediaId " + img.MediaId); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image Width " + img.Width); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image Height " + img.Height); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image Orientation " + img.Orientation); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image TakenDate " + img.TakenDate); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image BurstId " + img.BurstId); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image ExposureTime " + img.ExposureTime); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image FNumber " + img.FNumber); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image ISO " + img.Iso); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image Model " + img.Model); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Image IsBurstShot " + img.IsBurstShot); + if(checkImage(img) == true) + { + Assert.Pass(); + } + else + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + } + } + if (i.MediaType == MediaContentType.Video) + { + Tizen.Log.Info(TAG, "Video found"); + VideoInformation vid = (VideoInformation)i; + Tizen.Log.Info(TAG, "GetVideo Done"); + setVideo(vid); + Tizen.Log.Info(TAG, "Video MediaId " + vid.MediaId); + Tizen.Log.Info(TAG, "Video Album " + vid.Album); + Tizen.Log.Info(TAG, "Video Artist " + vid.Artist); + Tizen.Log.Info(TAG, "Video AlbumArtist " + vid.AlbumArtist); + Tizen.Log.Info(TAG, "Video Genre " + vid.Genre); + Tizen.Log.Info(TAG, "Video Composer " + vid.Composer); + Tizen.Log.Info(TAG, "Video Year " + vid.Year); + Tizen.Log.Info(TAG, "Video RecordedDate " + vid.RecordedDate); + Tizen.Log.Info(TAG, "Video Copyright " + vid.Copyright); + Tizen.Log.Info(TAG, "Video TrackNumber " + vid.TrackNumber); + Tizen.Log.Info(TAG, "Video BitRate " + vid.BitRate); + Tizen.Log.Info(TAG, "Video Duration " + vid.Duration); + Tizen.Log.Info(TAG, "Video Width " + vid.Width); + Tizen.Log.Info(TAG, "Video Height " + vid.Height); + Tizen.Log.Info(TAG, "Video PlayedCount " + vid.PlayedCount); + Tizen.Log.Info(TAG, "Video PlayedAt " + vid.PlayedAt); + Tizen.Log.Info(TAG, "Video PlayedPosition " + vid.PlayedPosition); + + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video MediaId " + vid.MediaId); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video Album " + vid.Album); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video Artist " + vid.Artist); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video AlbumArtist " + vid.AlbumArtist); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video Genre " + vid.Genre); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video Composer " + vid.Composer); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video Year " + vid.Year); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video RecordedDate " + vid.RecordedDate); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video Copyright " + vid.Copyright); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video TrackNumber " + vid.TrackNumber); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video BitRate " + vid.BitRate); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video Duration " + vid.Duration); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video Width " + vid.Width); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video Height " + vid.Height); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video PlayedCount " + vid.PlayedCount); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video PlayedAt " + vid.PlayedAt); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Video PlayedPosition " + vid.PlayedPosition); + if(checkVideo(vid) == true) + { + Assert.Pass(); + } + else + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + } + } + if (i.MediaType == MediaContentType.Music) + { + Tizen.Log.Info(TAG, "Audio found"); + AudioInformation aud = (AudioInformation)i; + Tizen.Log.Info(TAG, "GetAudio Done"); + setAudio(aud); + Tizen.Log.Info(TAG, "Audio MediaId " + aud.MediaId); + Tizen.Log.Info(TAG, "Audio Album " + aud.Album); + Tizen.Log.Info(TAG, "Audio Artist " + aud.Artist); + Tizen.Log.Info(TAG, "Audio AlbumArtist " + aud.AlbumArtist); + Tizen.Log.Info(TAG, "Audio Genre " + aud.Genre); + Tizen.Log.Info(TAG, "Audio Composer " + aud.Composer); + Tizen.Log.Info(TAG, "Audio Year " + aud.Year); + Tizen.Log.Info(TAG, "Audio RecordedDate " + aud.RecordedDate); + Tizen.Log.Info(TAG, "Audio Copyright " + aud.Copyright); + Tizen.Log.Info(TAG, "Audio TrackNumber " + aud.TrackNumber); + Tizen.Log.Info(TAG, "Audio BitRate " + aud.BitRate); + Tizen.Log.Info(TAG, "Audio BitPerSample " + aud.BitPerSample); + Tizen.Log.Info(TAG, "Audio SampleRate " + aud.SampleRate); + Tizen.Log.Info(TAG, "Audio Channel " + aud.Channel); + Tizen.Log.Info(TAG, "Audio Duration " + aud.Duration); + Tizen.Log.Info(TAG, "Audio PlayedCount " + aud.PlayedCount); + Tizen.Log.Info(TAG, "Audio PlayedAt " + aud.PlayedAt); + Tizen.Log.Info(TAG, "Audio PlayedPosition " + aud.PlayedPosition); + + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio MediaId " + aud.MediaId); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio Album " + aud.Album); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio Artist " + aud.Artist); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio AlbumArtist " + aud.AlbumArtist); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio Genre " + aud.Genre); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio Composer " + aud.Composer); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio Year " + aud.Year); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio RecordedDate " + aud.RecordedDate); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio Copyright " + aud.Copyright); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio TrackNumber " + aud.TrackNumber); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio BitRate " + aud.BitRate); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio BitPerSample " + aud.BitPerSample); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio SampleRate " + aud.SampleRate); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio Channel " + aud.Channel); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio Duration " + aud.Duration); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio PlayedCount " + aud.PlayedCount); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio PlayedAt " + aud.PlayedAt); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Audio PlayedPosition " + aud.PlayedPosition); + if(checkAudio(aud) == true) + { + Assert.Pass(); + } + else + { + Tizen.Log.Info(TAG, "Check Failed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Check Failed"); + Assert.Fail(); + } + } + if (i.MediaType == MediaContentType.Sound) + { + Tizen.Log.Info(TAG, "Sound found"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Sound found"); + Assert.Pass(); + } + if (i.MediaType == MediaContentType.Others) + { + Tizen.Log.Info(TAG, "Others found"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Others found"); + Assert.Pass(); + } + } + } + } + catch (Exception e) + { + Tizen.Log.Info(TAG, "Got Exception" + e.ToString()); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Got Exception" + e.ToString()); + Assert.Fail(); + } + Tizen.Log.Info(TAG, "Executing TC:Setters_USAGE Completed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:Setters_USAGE Completed"); + } + + [Test] + [Category("P1")] + [Description("Test for CreateThumbnailAsync ...")] + [Property("SPEC", " Tizen.Content.MediaContent.MediaInformation M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] + public static async Task CreateThumbnailAsync_RETURN_VALUE() + { + /* PRECONDITION */ + Tizen.Log.Info(TAG, "Executing TC:CreateThumbnailAsync_RETURN_VALUE"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:CreateThumbnailAsync_RETURN_VALUE"); + try + { + IEnumerable<MediaInformation> res = await ContentManager.Database.SelectAsync<MediaInformation>(null); + foreach (MediaInformation i in res) + { + if((String.Compare(AudioPath,i.FilePath)==0) || (String.Compare(ImagePath,i.FilePath)==0) || (String.Compare(VideoPath,i.FilePath)==0)) + { + /* TEST */ + Tizen.Log.Info(TAG, "Create Thumbnail called for: "+i.FilePath); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Create Thumbnail called for: "+i.FilePath); + string path = await i.CreateThumbnailAsync(); + Tizen.Log.Info(TAG, "FilePath: "+path); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "FilePath: "+path); + if(String.IsNullOrEmpty(path)) + { + Assert.Fail(); + } + else + { + Assert.Pass(); + } + } + } + } + catch (Exception e) + { + Tizen.Log.Info(TAG, "Got Exception" + e.ToString()); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Got Exception" + e.ToString()); + } + Tizen.Log.Info(TAG, "Executing TC:CreateThumbnailAsync_RETURN_VALUE Completed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:CreateThumbnailAsync_RETURN_VALUE Completed"); + } + + [Test] + [Category("P1")] + [Description("Test for CreateThumbnailAsync with Cancellation...")] + [Property("SPEC", " Tizen.Content.MediaContent.MediaInformation M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] + public static async Task CreateThumbnailAsyncCancel_RETURN_VALUE() + { + /* PRECONDITION */ + Tizen.Log.Info(TAG, "Executing TC:CreateThumbnailAsyncCancel_RETURN_VALUE"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:CreateThumbnailAsyncCancel_RETURN_VALUE"); + try + { + IEnumerable<MediaInformation> res = await ContentManager.Database.SelectAsync<MediaInformation>(null); + foreach (MediaInformation i in res) + { + if((String.Compare(AudioPath,i.FilePath)==0) || (String.Compare(ImagePath,i.FilePath)==0) || (String.Compare(VideoPath,i.FilePath)==0)) + { + /* TEST */ + CancellationTokenSource cancellationToken = new CancellationTokenSource(); + Tizen.Log.Info(TAG, "Create Thumbnail called for: "+i.FilePath); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Create Thumbnail called for: "+i.FilePath); + Task<string> thumbnailResTask = i.CreateThumbnailAsync(cancellationToken.Token); + cancellationToken.Cancel(); + Tizen.Log.Info(TAG, "After Cancel"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "After Cancel"); + string thumbnailRes = await thumbnailResTask; + Assert.IsTrue(false, "Cancel Exception Not Received"); + } + } + } + catch (Exception e) + { + Tizen.Log.Info(TAG, "Got Exception" + e.ToString()); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Got Exception" + e.ToString()); + Assert.IsTrue(e is TaskCanceledException, "Cancel Exception Not of Type TaskCanceledException "); + } + Tizen.Log.Info(TAG, "Executing TC:CreateThumbnailAsyncCancel_RETURN_VALUE Completed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:CreateThumbnailAsyncCancel_RETURN_VALUE Completed"); + } + + [Test] + [Category("P1")] + [Description("Test for Refresh ...")] + [Property("SPEC", " Tizen.Content.MediaContent.MediaInformation M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] + public static async Task Refresh_RETURN_VALUE() + { + Tizen.Log.Info(TAG, "Executing TC:Refresh_RETURN_VALUE"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:Refresh_RETURN_VALUE"); + try + { + ContentManager.Scan (AudioPath); + await ContentManager.ScanFolderAsync(Path); + IEnumerable<MediaInformation> res = await ContentManager.Database.SelectAsync<MediaInformation>(null); + foreach (MediaInformation i in res) + { + if(String.Compare(AudioPath,i.FilePath)==0) + { + /* TEST */ + Tizen.Log.Info(TAG, "Media PlayedAt " + i.ModifiedAt); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media ModifiedAt " + i.ModifiedAt); + + Tizen.Log.Info(TAG, "Media IsFavourite " + i.IsFavourite); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media IsFavourite " + i.IsFavourite); + bool oldValue = i.IsFavourite; + Tizen.Log.Info(TAG, "Calling Refresh for: "+i.FilePath); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Calling Refresh for: "+i.FilePath); + i.IsFavourite = !i.IsFavourite; + i.Refresh(); + Tizen.Log.Info(TAG, "Media IsFavourite after Refresh " + i.IsFavourite); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Media IsFavourite after Refresh " + i.IsFavourite); + Assert.IsTrue(oldValue != i.IsFavourite, "Favourite Value Not Updated, Refresh Failed"); + } + } + } + catch (Exception e) + { + Tizen.Log.Info(TAG, "Got Exception" + e.ToString()); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Got Exception" + e.ToString()); + Assert.Fail(); + } + Tizen.Log.Info(TAG, "Executing TC:Refresh_RETURN_VALUE Completed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:Refresh_RETURN_VALUE Completed"); + } + + [Test] + [Category("P1")] + [Description("Test for Move ...")] + [Property("SPEC", " Tizen.Content.MediaContent.MediaInformation M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Manish Rathod, manish.r@samsung.com")] + public static async Task Move_RETURN_VALUE() + { + Tizen.Log.Info(TAG, "Executing TC:Move_RETURN_VALUE"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:Move_RETURN_VALUE"); + try + { + ContentManager.Scan (ImagePath); + await ContentManager.ScanFolderAsync(Path); + IEnumerable<MediaInformation> res = await ContentManager.Database.SelectAsync<MediaInformation>(null); + foreach (MediaInformation i in res) + { + if(String.Compare(ImagePath,i.FilePath)==0) + { + /* TEST */ + File.Move(ImagePath, MovedImagePath); + + Tizen.Log.Info(TAG, "Calling Move for: "+i.FilePath); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Calling Move for: "+i.FilePath); + i.Move(MovedImagePath); + IEnumerable<MediaInformation> coll = await ContentManager.Database.SelectAsync<MediaInformation>(null); + bool flag = false; + foreach (MediaInformation m in coll) + { + if(String.Compare(MovedImagePath,m.FilePath)==0) + { + flag = true; + ContentManager.Database.Delete(m); + Assert.Pass(); + } + } + Assert.IsTrue(flag, "Item not found"); + File.Move(MovedImagePath, ImagePath); + } + } + } + catch (Exception e) + { + Tizen.Log.Info(TAG, "Got Exception" + e.ToString()); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Got Exception" + e.ToString()); + Assert.Fail(); + } + Tizen.Log.Info(TAG, "Executing TC:Move_RETURN_VALUE Completed"); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:Move_RETURN_VALUE Completed"); + } + } +} diff --git a/tct-mediacontent-tizen-tests/src/Testcase/TSPlayList.cs b/tct-mediacontent-tizen-tests/src/Testcase/TSPlayList.cs new file mode 100644 index 0000000..447e5c3 --- /dev/null +++ b/tct-mediacontent-tizen-tests/src/Testcase/TSPlayList.cs @@ -0,0 +1,247 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TestFramework; +using Tizen.Content.MediaContent; + +namespace TizenTest.PlayListT +{ + + [TestFixture] + [Description("Tizen.Content.MediaContent.PlayList Tests")] + class PlayListT + { + private static ContentFilter audioFilter; + private static PlayList playList = null; + private static MediaInformation[] audioArray = new MediaInformation[1000]; + private static IEnumerable<MediaInformation> audioList; + static async Task PlayListSetup() + { + //Get files from the media folder + await ContentManager.ScanFolderAsync("/home/owner/content", true); + audioFilter = new ContentFilter(); + audioFilter.Condition = "MEDIA_TYPE = 3"; + Task<IEnumerable<MediaInformation>> getAudioListTask = ContentManager.Database.SelectAsync<MediaInformation>(audioFilter); + audioList = await getAudioListTask; + int i = 0; + foreach (MediaInformation audio in audioList) + { + audioArray[i++] = audio; + } + Task<IEnumerable<PlayList>> getPlayListsTask = ContentManager.Database.SelectAsync<PlayList>(null); + IEnumerable<PlayList> allPlayLists = await getPlayListsTask; + foreach (PlayList p in allPlayLists) + { + ContentManager.Database.Delete(p); + } + } + + [SetUp] + public static void Init() + { + //get a mediainformation object + + //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST"); + } + + [TearDown] + public static void Destroy() + { + + //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST"); + } + + [Test] + [Category("P1")] + [Description("Test PlayList constructor")] + [Property("SPEC", " Tizen.Content.MediaContent.PlayList.PlayList C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task PlayList_CONSTRUCTOR() + { + await PlayListSetup(); + string playListName = "playlist_work"; + playList = new PlayList(playListName); + Assert.IsInstanceOf<PlayList>(playList); + Assert.IsTrue(playListName.CompareTo(playList.Name) == 0); + Assert.IsTrue(playList.Id == 0); + ContentManager.Database.Insert(playList); + Assert.IsFalse(playList.Id == 0); + } + + [Test] + [Category("P1")] + [Description("Test if get for PlayList:Id is working properly")] + [Property("SPEC", " Tizen.Content.MediaContent.PlayList.Id A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void Id_READ_ONLY() + { + Assert.IsFalse(playList.Id == 0); + } + + [Test] + [Category("P1")] + [Description("Test if get/set for PlayList:Name is working properly")] + [Property("SPEC", "Tizen.Content.MediaContent.PlayList.Name A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void Name_READ_WRITE() + { + try + { + string name = playList.Name; + string setValue = name + "_Modified"; + playList.Name = setValue; + ContentManager.Database.Update(playList); + Assert.IsTrue(setValue.CompareTo(playList.Name) == 0, "Set value and get value of the property should be same"); + } + catch (Exception e) + { + Assert.Fail(); + Tizen.Log.Info("TCT", "Name_READ_WRITE Exception: " + e.Message); + } + } + + [Test] + [Category("P1")] + [Description("Test if get/set for PlayList:ThumbnailPath is working properly")] + [Property("SPEC", "Tizen.Content.MediaContent.PlayList.ThumbnailPath A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void ThumbnailPath_READ_WRITE() + { + Assert.IsFalse(playList.Id == 0); + // TODO dummy thumbnail path value. instead push a jpg in test case preperation + string setValue = "/home/owner/content/Camera/20150103-101850.jpg"; + playList.ThumbnailPath = setValue; + ContentManager.Database.Update(playList); + string getValue = playList.ThumbnailPath; + Assert.IsTrue(setValue.CompareTo(playList.ThumbnailPath) == 0, "Set value and get value of the property should be same"); + } + + [Test] + [Category("P1")] + [Description("Test if PlayList:AddItem & PlayList:GetMediaInformationCount APIs are working properly")] + [Property("SPEC", "Tizen.Content.MediaContent.PlayList.AddItem Tizen.Content.MediaContent.PlayList.GetMediaInformationCount M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR MCST")] + [Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void AddItem_CHECK_LENGTH() + { + Assert.IsFalse(playList.Id == 0 && audioArray.Length == 0); + playList.AddItem(audioArray[0]); + ContentManager.Database.Update(playList); + Assert.IsTrue(1 == playList.GetMediaInformationCount(null)); + playList.AddItem(audioArray[1]); + ContentManager.Database.Update(playList); + Assert.IsTrue(2 == playList.GetMediaInformationCount(null)); + playList.AddItem(audioArray[2]); + ContentManager.Database.Update(playList); + Assert.IsTrue(3 == playList.GetMediaInformationCount(null)); + + } + + [Test] + [Category("P1")] + [Description("Test if PlayList:RemoveItem & PlayList:GetMediaInformationCount APIs are working properly")] + [Property("SPEC", "Tizen.Content.MediaContent.PlayList.RemoveItem Tizen.Content.MediaContent.PlayList.GetMediaInformationCount M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void RemoveItem_CHECK_LENGTH() + { + try + { + Assert.IsFalse(playList.Id == 0 && playList.GetMediaInformationCount(null) == 0); + playList.RemoveItem(audioArray[2]); + ContentManager.Database.Update(playList); + Assert.IsTrue(2 == playList.GetMediaInformationCount(null)); + playList.RemoveItem(audioArray[1]); + ContentManager.Database.Update(playList); + Assert.IsTrue(1 == playList.GetMediaInformationCount(null)); + playList.RemoveItem(audioArray[0]); + ContentManager.Database.Update(playList); + Assert.IsTrue(0 == playList.GetMediaInformationCount(null)); + } + catch (Exception e) + { + Assert.Fail(); + Tizen.Log.Info("TCT", "RemoveItem_CHECK_LENGTH Exception: " + e.Message); + } + } + + [Test] + [Category("P1")] + [Description("Test if PlayList:SetPlayOrder & PlayList:GetPlayOrder APIs are working properly")] + [Property("SPEC", "Tizen.Content.MediaContent.PlayList.SetPlayOrder Tizen.Content.MediaContent.PlayList.GetPlayOrder M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR MCST")] + [Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void PlayOrder_READ_WRITE() + { + Assert.IsFalse(playList.Id == 0); + playList.AddItem(audioArray[0]); + ContentManager.Database.Update(playList); + playList.AddItem(audioArray[1]); + ContentManager.Database.Update(playList); + playList.AddItem(audioArray[2]); + ContentManager.Database.Update(playList); + Tizen.Log.Info("TCT", "PlayList member count: " + playList.GetMediaInformationCount(null)); + Tizen.Log.Info("TCT", "******Setting play order*****"); + playList.SetPlayOrder(audioArray[0], 2); + Tizen.Log.Info("TCT", "******play order set*****"); + ContentManager.Database.Update(playList); + Tizen.Log.Info("TCT", "******play order updated to database*****"); + int p = playList.GetPlayOrder(audioArray[0]); + Tizen.Log.Info("TCT", "Got play order as " + p); + Assert.IsTrue(2 == p); + } + + [Test] + [Category("P1")] + [Description("Test if PlayList:Import & PlayList:Export APIs are working properly")] + [Property("SPEC", "Tizen.Content.MediaContent.PlayList.Import Tizen.Content.MediaContent.PlayList.Export M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR MCST")] + [Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static void PlayList_READ_WRITE() + { + Assert.IsFalse(playList.Id == 0); + Tizen.Log.Info("TCT", "#########Export#####"); + string path = "/home/owner/content/Music/playlist_work_imported.m3u"; + PlayList.Export(playList, path); + Tizen.Log.Info("TCT", "#########Import#####"); + PlayList importedPlayList = PlayList.Import("playlist_work_imported", path); + Assert.IsTrue(playList.GetMediaInformationCount(null) == importedPlayList.GetMediaInformationCount(null)); + Assert.IsTrue(playList.Name.CompareTo(importedPlayList.Name) == 0); + Assert.IsTrue(playList.ThumbnailPath.CompareTo(importedPlayList.ThumbnailPath) == 0); + } + + [Test] + [Category("P1")] + [Description("Test if PlayList:GetMediaInformationsAsync is working properly")] + [Property("SPEC", "Tizen.Content.MediaContent.PlayList.GetMediaInformationsAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")] + public static async Task GetMediaInformationsAsync_MEDIA_INFORMATION() + { + Assert.IsFalse(playList.Id == 0 && playList.GetMediaInformationCount(null) == 0); + IEnumerable<MediaInformation> extract = null; + Task<IEnumerable<MediaInformation>> getMembersTask = playList.GetMediaInformationsAsync(null); + extract = await getMembersTask; + //foreach (MediaInformation media in extract) + //{ + // Tizen.Log.Info("TCT", "Media File Path: " + media.FilePath); + //} + Assert.IsTrue(audioList.Count() == extract.Count<MediaInformation>()); + } + } +} diff --git a/tct-mediacontent-tizen-tests/src/Testcase/TSStorage.cs b/tct-mediacontent-tizen-tests/src/Testcase/TSStorage.cs new file mode 100644 index 0000000..4f7cd3f --- /dev/null +++ b/tct-mediacontent-tizen-tests/src/Testcase/TSStorage.cs @@ -0,0 +1,136 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using TestFramework; +using Tizen.Content.MediaContent; + +namespace TizenTest.MediaInformationT +{ + [TestFixture] + [Description("Tizen.Content.MediaContent.Storage Tests")] + class TSStorage + { + private static string TAG = "TCT"; + private const string _storaageId = "media"; + static Storage _store = null; + [SetUp] + public static void Init() + { + Tizen.Log.Info(TAG, "Executing TC:Init store"); + _store = (Storage) ContentManager.Database.Select<Storage>(_storaageId); + Tizen.Log.Info(TAG, "Executing TC:Init store end"); + //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST"); + } + + [TearDown] + public static void Destroy() + { + } + + [Test] + [Category("P1")] + [Description("Test for Storage Properties Getter ...")] + [Property("SPEC", " Tizen.Content.MediaContent.Storage.Id A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static void StorageId_READ() + { + Tizen.Log.Info(TAG, "Executing TC:StorageId_READ store"); + if (_store != null) + { + string id = _store.Id; + Tizen.Log.Info(TAG, "Executing TC:StorageId_READ store Id" + id); + Assert.IsTrue(id.CompareTo(_storaageId) == 0, "storage Id is not equal"); + } + Tizen.Log.Info(TAG, "Executing TC:StorageId_READ store end"); + } + + [Test] + [Category("P1")] + [Description("Test for Storage Properties Getter ...")] + [Property("SPEC", " Tizen.Content.MediaContent.Storage.Path A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static void StoragePath_READ() + { + Tizen.Log.Info(TAG, "Executing TC:StoragePath_READ store"); + if (_store != null) + { + string path = _store.StoragePath; + Tizen.Log.Info(TAG, "Executing TC:StoragePath_READ store path: " + path); + if (path.Length == 0) + Assert.Fail(); + } + Tizen.Log.Info(TAG, "Executing TC:StoragePath_READ store end"); + } + + [Test] + [Category("P1")] + [Description("Test for Storage Properties Getter ...")] + [Property("SPEC", " Tizen.Content.MediaContent.Storage.Type A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static void StorageType_READ() + { + Tizen.Log.Info(TAG, "Executing TC:StorageType_READ store"); + if (_store != null) + { + ContentStorageType type = _store.StorageType; + Tizen.Log.Info(TAG, "Executing TC:StorageType_READ store type:" + type); + if (type != ContentStorageType.External) + Assert.Fail(); + } + Tizen.Log.Info(TAG, "Executing TC:StorageType_READ store end"); + } + + [Test] + [Category("P1")] + [Description("Test for Storage Properties Getter ...")] + [Property("SPEC", " Tizen.Content.MediaContent.Storage.GetMediaInformationCount M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static void StorageMediaCount_READ() + { + Tizen.Log.Info(TAG, "Executing TC:StorageMediaCount_READ store"); + if (_store != null) + { + try + { + int count = _store.GetMediaInformationCount(null); + Tizen.Log.Info(TAG, "Executing TC:StorageMediaCount_READ store count : "+ count); + Assert.Pass(); + }catch(Exception) + { + Assert.Fail(); + } + } + Tizen.Log.Info(TAG, "Executing TC:StorageMediaCount_READ store end"); + } + + [Test] + [Category("P1")] + [Description("Test for Storage Properties Getter ...")] + [Property("SPEC", " Tizen.Content.MediaContent.Storage.GetMediaInformationCount M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static async Task StorageMediaInformation_READ() + { + Tizen.Log.Info(TAG, "Executing TC:StorageMediaInformation_READ store"); + try + { + IEnumerable<MediaInformation> mediaList = await _store.GetMediaInformationsAsync(null); + Assert.Pass(); + } + catch (Exception) + { + Assert.Fail(); + } + Tizen.Log.Info(TAG, "Executing TC:StorageMediaInformation_READ store end"); + } + } +} diff --git a/tct-mediacontent-tizen-tests/src/Testcase/TSTag.cs b/tct-mediacontent-tizen-tests/src/Testcase/TSTag.cs new file mode 100644 index 0000000..2bbcb89 --- /dev/null +++ b/tct-mediacontent-tizen-tests/src/Testcase/TSTag.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using TestFramework; +using Tizen.Content.MediaContent; + +namespace TizenTest.MediaInformationT +{ + [TestFixture] + [Description("Tizen.Content.MediaContent.Tag Tests")] + class TSTag + { + private static string TAG = "TCT"; + private static string _mediaTag = "ut.xyz.tagTest"; + static Tag _myTag = null; + static MediaInformation _myMedia; + [SetUp] + public static void Init() + { + } + + [TearDown] + public static void Destroy() + { + //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST"); + } + [Test] + [Category("P1")] + [Description("Test for Tag Properties Getter ...")] + [Property("SPEC", " Tizen.Content.MediaContent.Tag.Id A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static void TagId_READ() + { + _mediaTag = "TAGSUPER5"; + Tag tag = new Tag(_mediaTag); + try + { + Tizen.Log.Info(TAG, "Executing TC:TagId_READ"); + ContentManager.Database.Insert(tag); + int id = tag.Id; + Tizen.Log.Info(TAG, "Executing TC:TagId_READ Id" + id); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:TagId_READ Name : "+ id); + ContentManager.Database.Delete(tag); + Tizen.Log.Info(TAG, "Executing TC:TagId_READ delete"); + } + catch (Exception e) + { + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:TagName_READ Name : "+ e.Message); + Tizen.Log.Info(TAG, "Executing TC:TagId_READ delete "+ e.Message); + Assert.Fail(); + } + } + + [Test] + [Category("P1")] + [Description("Test for Tag Properties Getter ...")] + [Property("SPEC", " Tizen.Content.MediaContent.Tag.Name A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static void TagName_READ() + { + _mediaTag = "TAGSUPER3"; + Tag tag = new Tag(_mediaTag); + try + { + Tizen.Log.Info(TAG, "Executing TC:TagName_READ"); + ContentManager.Database.Insert(tag); + string name = tag.Name; + Tizen.Log.Info(TAG, "Executing TC:TagName_READ Name : "+ name); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:TagName_READ Name : "+ name); + ContentManager.Database.Delete(tag); + if (name.CompareTo(_mediaTag) != 0) + Assert.Fail(); + + } + catch (Exception e) + { + Tizen.Log.Info(TAG, "Executing TC:TagName_READ Name : "+ e.Message); + LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:TagName_READ Name : "+ e.Message); + Assert.Fail(); + } + } + + [Test] + [Category("P1")] + [Description("Test for Tag add/remove Methods ...")] + [Property("SPEC", " Tizen.Content.MediaContent.Tag.AddItem M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static async Task TagAddAndRemoveItem_CHECK_RESULT() + { + int tagCount = 0; + try + { + _mediaTag = "TAGSUPERCOUNT"; + Tag tag = new Tag(_mediaTag); + Tizen.Log.Info(TAG, "Executing TC:TagAddAndRemoveItem_CHECK_RESULT"); + ContentManager.Database.Insert(tag); + IEnumerable<MediaInformation> list = await ContentManager.Database.SelectAsync<MediaInformation>(null); + foreach(MediaInformation info in list) + { + _myMedia = info; + tagCount = info.GetTagCount(null); + Tizen.Log.Info(TAG, "Executing TC:TagAddAndRemoveItem_CHECK_RESULT tagCount " + tagCount ); + tag.AddItem(info); + ContentManager.Database.Update(tag); + int newTagCount = info.GetTagCount(null); + Tizen.Log.Info(TAG, "Executing TC:TagAddAndRemoveItem_CHECK_RESULT tagCount " + newTagCount ); + Assert.IsTrue(tagCount+1 == info.GetTagCount(null), "After Adding new Tag , tag count be incremented."); + break; + } + tag.RemoveItem(_myMedia); + ContentManager.Database.Update(tag); + Assert.IsTrue(tagCount == _myMedia.GetTagCount(null), "After Removing new Tag , tag count should be same."); + ContentManager.Database.Delete(tag); + Assert.Pass(); + } + catch (Exception e) + { + Tizen.Log.Info(TAG, "Executing TC:TagAddAndRemoveItem_CHECK_RESULT exception " + e.Message); + Assert.Fail(); + } + } + + } +} |