summaryrefslogtreecommitdiff
path: root/tct-mediacontent-tizen-tests/src/Testcase/TSMediaFace.cs
blob: 02ecb629b85468b79d10c663c8aefdd995650b30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
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);
        }
    }
}