3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 using System.Collections.Generic;
7 using System.Threading.Tasks;
9 namespace Tizen.NUI.Devel.Tests
11 using tlog = Tizen.Log;
14 [Description("public/Images/PixelData")]
15 public class PublicPixelDataTest
17 private const string tag = "NUITEST";
22 tlog.Info(tag, "Init() is called!");
28 tlog.Info(tag, "Destroy() is called!");
33 [Description("PixelData constructor.")]
34 [Property("SPEC", "Tizen.NUI.PixelData.PixelData C")]
35 [Property("SPEC_URL", "-")]
36 [Property("CRITERIA", "CONSTR")]
37 [Property("AUTHOR", "guowei.wang@samsung.com")]
38 public void PixelDataConstructor()
40 tlog.Debug(tag, $"PixelDataConstructor START");
42 byte[] buffer = new byte[1024];
44 var testingTarget = new PixelData(buffer, 1024, 100, 150, PixelFormat.L8);
45 Assert.IsNotNull(testingTarget, "Can't create success object PixelData");
46 Assert.IsInstanceOf<PixelData>(testingTarget, "Should be an instance of PixelData type.");
49 testingTarget.Dispose();
50 tlog.Debug(tag, $"PixelDataConstructor END (OK)");
55 [Description("PixelData constructor. By IntPtr.")]
56 [Property("SPEC", "Tizen.NUI.PixelData.PixelData C")]
57 [Property("SPEC_URL", "-")]
58 [Property("CRITERIA", "CONSTR")]
59 [Property("AUTHOR", "guowei.wang@samsung.com")]
60 public void PixelDataConstructorByIntPtr()
62 tlog.Debug(tag, $"PixelDataConstructorByIntPtr START");
64 byte[] buffer = new byte[10];
66 using (PixelData pixelData = new PixelData(buffer, 10, 1, 2, PixelFormat.L8))
68 var testingTarget = new PixelData(PixelData.getCPtr(pixelData).Handle, true);
69 Assert.IsNotNull(testingTarget, "Can't create success object PixelData");
70 Assert.IsInstanceOf<PixelData>(testingTarget, "Should be an instance of PixelData type.");
72 testingTarget.Dispose();
76 tlog.Debug(tag, $"PixelDataConstructorByIntPtr END (OK)");
81 [Description("PixelData GenerateUrl.")]
82 [Property("SPEC", "Tizen.NUI.PixelData.GenerateUrl M")]
83 [Property("SPEC_URL", "-")]
84 [Property("CRITERIA", "MR")]
85 [Property("AUTHOR", "guowei.wang@samsung.com")]
86 public void PixelDataGenerateUrl()
88 tlog.Debug(tag, $"PixelDataGenerateUrl START");
90 byte[] buffer = new byte[10];
92 var testingTarget = new PixelData(buffer, 10, 1, 2, PixelFormat.L8);
93 Assert.IsNotNull(testingTarget, "Can't create success object PixelData");
94 Assert.IsInstanceOf<PixelData>(testingTarget, "Should be an instance of PixelData type.");
96 var result = testingTarget.GenerateUrl();
97 Assert.IsNotNull(result);
100 testingTarget.Dispose();
101 tlog.Debug(tag, $"PixelDataGenerateUrl END (OK)");
106 [Description("PixelData GetWidth.")]
107 [Property("SPEC", "Tizen.NUI.PixelData.GetWidth M")]
108 [Property("SPEC_URL", "-")]
109 [Property("CRITERIA", "MR")]
110 [Property("AUTHOR", "guowei.wang@samsung.com")]
111 public void PixelGetWidth()
113 tlog.Debug(tag, $"PixelGetWidth START");
115 byte[] buffer = new byte[10];
117 var testingTarget = new PixelData(buffer, 10, 1, 2, PixelFormat.L8);
118 Assert.IsNotNull(testingTarget, "Can't create success object PixelData");
119 Assert.IsInstanceOf<PixelData>(testingTarget, "Should be an instance of PixelData type.");
121 var result = testingTarget.GetWidth();
122 Assert.AreEqual(1, result, "Should be equal!");
125 testingTarget.Dispose();
126 tlog.Debug(tag, $"PixelGetWidth END (OK)");
131 [Description("PixelData GetHeight.")]
132 [Property("SPEC", "Tizen.NUI.PixelData.GetHeight M")]
133 [Property("SPEC_URL", "-")]
134 [Property("CRITERIA", "MR")]
135 [Property("AUTHOR", "guowei.wang@samsung.com")]
136 public void PixelGetHeight()
138 tlog.Debug(tag, $"PixelGetHeight START");
140 byte[] buffer = new byte[10];
142 var testingTarget = new PixelData(buffer, 10, 1, 2, PixelFormat.L8);
143 Assert.IsNotNull(testingTarget, "Can't create success object PixelData");
144 Assert.IsInstanceOf<PixelData>(testingTarget, "Should be an instance of PixelData type.");
146 var result = testingTarget.GetHeight();
147 Assert.AreEqual(2, result, "Should be equal!");
150 testingTarget.Dispose();
151 tlog.Debug(tag, $"PixelGetHeight END (OK)");
156 [Description("PixelData GetPixelFormat.")]
157 [Property("SPEC", "Tizen.NUI.PixelData.GetPixelFormat M")]
158 [Property("SPEC_URL", "-")]
159 [Property("CRITERIA", "MR")]
160 [Property("AUTHOR", "guowei.wang@samsung.com")]
161 public void PixelGetPixelFormat()
163 tlog.Debug(tag, $"PixelGetPixelFormat START");
165 byte[] buffer = new byte[10];
167 var testingTarget = new PixelData(buffer, 10, 1, 2, PixelFormat.BGR8888);
168 Assert.IsNotNull(testingTarget, "Can't create success object PixelData");
169 Assert.IsInstanceOf<PixelData>(testingTarget, "Should be an instance of PixelData type.");
171 var result = testingTarget.GetPixelFormat();
172 Assert.AreEqual(PixelFormat.BGR8888, result, "Should be equal!");
175 testingTarget.Dispose();
176 tlog.Debug(tag, $"PixelGetPixelFormat END (OK)");