[NUI] Update TCs of NUI.Devel.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / Common / TSNativeImageInterface.cs
1 using global::System;
2 using NUnit.Framework;
3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6
7 namespace Tizen.NUI.Devel.Tests
8 {
9     using tlog = Tizen.Log;
10
11     [TestFixture]
12     [Description("internal/Common/NativeImageInterface")]
13     public class InternalNativeImageInterfaceTest
14     {
15         private const string tag = "NUITEST";
16
17         [SetUp]
18         public void Init()
19         {
20             tlog.Info(tag, "Init() is called!");
21         }
22
23         [TearDown]
24         public void Destroy()
25         {
26             tlog.Info(tag, "Destroy() is called!");
27         }
28
29         [Test]
30         [Category("P1")]
31         [Description("NativeImageInterface constructor.")]
32         [Property("SPEC", "Tizen.NUI.NativeImageInterface.NativeImageInterface C")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "CONSTR")]
35         [Property("AUTHOR", "guowei.wang@samsung.com")]
36         public void NativeImageInterfaceConstructor()
37         {
38             tlog.Debug(tag, $"NativeImageInterfaceConstructor START");
39
40             var testingTarget = new NativeImageSource(100, 50, NativeImageSource.ColorDepth.Default);
41             Assert.IsNotNull(testingTarget, "Should be not null!");
42             Assert.IsInstanceOf<NativeImageSource>(testingTarget, "Should be an Instance of NativeImageSource!");
43
44             tlog.Debug(tag, "getCPtr : " + NativeImageInterface.getCPtr(testingTarget));
45            
46             testingTarget.Dispose();
47             tlog.Debug(tag, $"NativeImageInterfaceConstructor END (OK)");
48         }
49
50         [Test]
51         [Category("P1")]
52         [Description("NativeImageInterface TargetTexture.")]
53         [Property("SPEC", "Tizen.NUI.NativeImageInterface.TargetTexture M")]
54         [Property("SPEC_URL", "-")]
55         [Property("CRITERIA", "MR")]
56         [Property("AUTHOR", "guowei.wang@samsung.com")]
57         public void NativeImageInterfaceTargetTexture()
58         {
59             tlog.Debug(tag, $"NativeImageInterfaceTargetTexture START");
60
61             var testingTarget = new NativeImageSource(100, 50, NativeImageSource.ColorDepth.Default);
62             Assert.IsNotNull(testingTarget, "Should be not null!");
63             Assert.IsInstanceOf<NativeImageSource>(testingTarget, "Should be an Instance of NativeImageSource!");
64
65             try
66             {
67                 testingTarget.TargetTexture();
68             }
69             catch (Exception e)
70             {
71                 tlog.Debug(tag, e.Message.ToString());
72                 Assert.Fail("Caught Exception : Failed!");
73             }
74
75             tlog.Debug(tag, $"NativeImageInterfaceTargetTexture END (OK)");
76         }
77
78         [Test]
79         [Category("P1")]
80         [Description("NativeImageInterface PrepareTexture.")]
81         [Property("SPEC", "Tizen.NUI.NativeImageInterface.PrepareTexture M")]
82         [Property("SPEC_URL", "-")]
83         [Property("CRITERIA", "MR")]
84         [Property("AUTHOR", "guowei.wang@samsung.com")]
85         public void NativeImageInterfacePrepareTexture()
86         {
87             tlog.Debug(tag, $"NativeImageInterfacePrepareTexture START");
88
89             var testingTarget = new NativeImageSource(100, 50, NativeImageSource.ColorDepth.Default);
90             Assert.IsNotNull(testingTarget, "Should be not null!");
91             Assert.IsInstanceOf<NativeImageSource>(testingTarget, "Should be an Instance of NativeImageSource!");
92
93             try
94             {
95                 testingTarget.PrepareTexture();
96             }
97             catch (Exception e)
98             {
99                 tlog.Debug(tag, e.Message.ToString());
100                 Assert.Fail("Caught Exception : Failed!");
101             }
102
103             tlog.Debug(tag, $"NativeImageInterfacePrepareTexture END (OK)");
104         }
105
106         [Test]
107         [Category("P1")]
108         [Description("NativeImageInterface GetWidth.")]
109         [Property("SPEC", "Tizen.NUI.NativeImageInterface.GetWidth M")]
110         [Property("SPEC_URL", "-")]
111         [Property("CRITERIA", "MR")]
112         [Property("AUTHOR", "guowei.wang@samsung.com")]
113         public void NativeImageInterfaceGetWidth()
114         {
115             tlog.Debug(tag, $"NativeImageInterfaceGetWidth START");
116
117             var testingTarget = new NativeImageSource(100, 50, NativeImageSource.ColorDepth.Default);
118             Assert.IsNotNull(testingTarget, "Should be not null!");
119             Assert.IsInstanceOf<NativeImageSource>(testingTarget, "Should be an Instance of NativeImageSource!");
120
121             var width = testingTarget.GetWidth();
122             Assert.AreEqual(100, width, "should be equal!");
123             var height = testingTarget.GetHeight();
124             Assert.AreEqual(50, height, "should be equal!");
125
126             testingTarget.Dispose();
127             tlog.Debug(tag, $"NativeImageInterfaceGetWidth END (OK)");
128         }
129
130         [Test]
131         [Category("P1")]
132         [Description("NativeImageInterface RequiresBlending.")]
133         [Property("SPEC", "Tizen.NUI.NativeImageInterface.RequiresBlending M")]
134         [Property("SPEC_URL", "-")]
135         [Property("CRITERIA", "MR")]
136         [Property("AUTHOR", "guowei.wang@samsung.com")]
137         public void NativeImageInterfaceRequiresBlending()
138         {
139             tlog.Debug(tag, $"NativeImageInterfaceRequiresBlending START");
140
141             var testingTarget = new NativeImageSource(100, 50, NativeImageSource.ColorDepth.Default);
142             Assert.IsNotNull(testingTarget, "Should be not null!");
143             Assert.IsInstanceOf<NativeImageSource>(testingTarget, "Should be an Instance of NativeImageSource!");
144
145             var result = testingTarget.RequiresBlending();
146             tlog.Debug(tag, "RequiresBlending : " +  result);
147
148             testingTarget.Dispose();
149             tlog.Debug(tag, $"NativeImageInterfaceRequiresBlending END (OK)");
150         }
151     }
152 }