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/Utility/FontClient")]
17 private const string tag = "NUITEST";
18 private string ttf_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "TizenSansRegular.ttf";
23 tlog.Info(tag, "Init() is called!");
29 tlog.Info(tag, "Destroy() is called!");
32 internal class MySWIGTYPE_p_unsigned_int : SWIGTYPE_p_unsigned_int
34 public MySWIGTYPE_p_unsigned_int() : base()
40 [Description("FontClient constructor.")]
41 [Property("SPEC", "Tizen.NUI.FontClient.FontClient C")]
42 [Property("SPEC_URL", "-")]
43 [Property("CRITERIA", "CONSTR")]
44 [Property("AUTHOR", "guowei.wang@samsung.com")]
45 public void FontClientConstructor()
47 tlog.Debug(tag, $"FontClientConstructor START");
49 var testingTarget = new FontClient();
50 Assert.IsNotNull(testingTarget, "Return a null object of FontClient");
51 Assert.IsInstanceOf<FontClient>(testingTarget, "Should be an instance of FontClient type.");
53 testingTarget.Dispose();
55 tlog.Debug(tag, $"FontClientConstructor END (OK)");
60 [Description("FontClient constructor. With FontClient")]
61 [Property("SPEC", "Tizen.NUI.FontClient.FontClient C")]
62 [Property("SPEC_URL", "-")]
63 [Property("CRITERIA", "CONSTR")]
64 [Property("AUTHOR", "guowei.wang@samsung.com")]
65 public void FontClientConstructorWithFontClient()
67 tlog.Debug(tag, $"FontClientConstructorWithFontClient START");
69 var testingTarget = new FontClient(FontClient.Instance);
70 Assert.IsNotNull(testingTarget, "Return a null object of FontClient");
71 Assert.IsInstanceOf<FontClient>(testingTarget, "Should be an instance of FontClient type.");
73 testingTarget.Dispose();
75 tlog.Debug(tag, $"FontClientConstructorWithFontClient END (OK)");
80 [Description("FontClient DefaultPointSize.")]
81 [Property("SPEC", "Tizen.NUI.FontClient.DefaultPointSize A")]
82 [Property("SPEC_URL", "-")]
83 [Property("CRITERIA", "PRO")]
84 [Property("AUTHOR", "guowei.wang@samsung.com")]
85 public void FontClientDefaultPointSize()
87 tlog.Debug(tag, $"FontClientDefaultPointSize START");
89 var testingTarget = FontClient.DefaultPointSize;
90 Assert.AreEqual(768, testingTarget, "Should be equal!");
92 tlog.Debug(tag, $"FontClientDefaultPointSize END (OK)");
97 [Description("FontClient Assign.")]
98 [Property("SPEC", "Tizen.NUI.FontClient.Assign M")]
99 [Property("SPEC_URL", "-")]
100 [Property("CRITERIA", "MR")]
101 [Property("AUTHOR", "guowei.wang@samsung.com")]
102 public void FontClientAssign()
104 tlog.Debug(tag, $"FontClientAssign START");
106 using (FontClient client = new FontClient())
110 var testingTarget = client.Assign(FontClient.Instance);
111 Assert.IsNotNull(testingTarget, "Return a null object of FontClient");
112 Assert.IsInstanceOf<FontClient>(testingTarget, "Should be an instance of FontClient type.");
114 testingTarget.Dispose();
118 tlog.Debug(tag, e.Message.ToString());
119 Assert.Fail("Caught Exception: Failed!");
123 tlog.Debug(tag, $"FontClientAssign END (OK)");
128 //[Description("FontClient GetDpi.")]
129 //[Property("SPEC", "Tizen.NUI.FontClient.GetDpi M")]
130 //[Property("SPEC_URL", "-")]
131 //[Property("CRITERIA", "MR")]
132 //[Property("AUTHOR", "guowei.wang@samsung.com")]
133 //public void FontClientGetDpi()
135 // tlog.Debug(tag, $"FontClientGetDpi START");
137 // var testingTarget = new FontClient(FontClient.Instance);
138 // Assert.IsNotNull(testingTarget, "Return a null object of FontClient");
139 // Assert.IsInstanceOf<FontClient>(testingTarget, "Should be an instance of FontClient type.");
141 // testingTarget.SetDpi(50, 60);
145 // var horizontalDpi = new SWIGTYPE_p_unsigned_int(testingTarget.GetBaseHandleCPtrHandleRef.Handle);
146 // var verticalDpi = new SWIGTYPE_p_unsigned_int(new FontClient().GetBaseHandleCPtrHandleRef.Handle);
147 // testingTarget.GetDpi(horizontalDpi, verticalDpi);
149 // catch (Exception e)
151 // tlog.Debug(tag, e.Message.ToString());
152 // Assert.Fail("Caught Exception: Failed");
155 // testingTarget.Dispose();
156 // tlog.Debug(tag, $"FontClientGetDpi END (OK)");
161 [Description("FontClient GetDefaultFontSize.")]
162 [Property("SPEC", "Tizen.NUI.FontClient.GetDefaultFontSize M")]
163 [Property("SPEC_URL", "-")]
164 [Property("CRITERIA", "MR")]
165 [Property("AUTHOR", "guowei.wang@samsung.com")]
166 public void FontClientGetDefaultFontSize()
168 tlog.Debug(tag, $"FontClientGetDefaultFontSize START");
170 var testingTarget = new FontClient(FontClient.Instance);
171 Assert.IsNotNull(testingTarget, "Return a null object of FontClient");
172 Assert.IsInstanceOf<FontClient>(testingTarget, "Should be an instance of FontClient type.");
174 Assert.IsNotNull(testingTarget.GetDefaultFontSize());
176 testingTarget.Dispose();
177 tlog.Debug(tag, $"FontClientGetDefaultFontSize END (OK)");
182 [Description("FontClient GetDefaultPlatformFontDescription.")]
183 [Property("SPEC", "Tizen.NUI.FontClient.GetDefaultPlatformFontDescription M")]
184 [Property("SPEC_URL", "-")]
185 [Property("CRITERIA", "MR")]
186 [Property("AUTHOR", "guowei.wang@samsung.com")]
187 public void FontClientGetDefaultPlatformFontDescription()
189 tlog.Debug(tag, $"FontClientGetDefaultPlatformFontDescription START");
191 using (FontDescription description = new FontDescription())
193 description.Path = ttf_path;
195 var testingTarget = new FontClient(FontClient.Instance);
196 Assert.IsNotNull(testingTarget, "Return a null object of FontClient");
197 Assert.IsInstanceOf<FontClient>(testingTarget, "Should be an instance of FontClient type.");
201 testingTarget.GetDefaultPlatformFontDescription(description);
205 tlog.Debug(tag, e.Message.ToString());
206 Assert.Fail("Caught Exception: Failed");
209 testingTarget.Dispose();
212 tlog.Debug(tag, $"FontClientGetDefaultPlatformFontDescription END (OK)");
217 [Description("FontClient IsScalable.")]
218 [Property("SPEC", "Tizen.NUI.FontClient.IsScalable M")]
219 [Property("SPEC_URL", "-")]
220 [Property("CRITERIA", "MR")]
221 [Property("AUTHOR", "guowei.wang@samsung.com")]
222 public void FontClientIsScalable()
224 tlog.Debug(tag, $"FontClientIsScalable START");
226 using (FontDescription description = new FontDescription())
228 description.Path = ttf_path;
230 var testingTarget = new FontClient(FontClient.Instance);
231 Assert.IsNotNull(testingTarget, "Return a null object of FontClient");
232 Assert.IsInstanceOf<FontClient>(testingTarget, "Should be an instance of FontClient type.");
234 var result = testingTarget.IsScalable(description);
235 Assert.IsNotNull(result);
237 testingTarget.Dispose();
240 tlog.Debug(tag, $"FontClientIsScalable END (OK)");
245 [Description("FontClient CreateVectorBlob.")]
246 [Property("SPEC", "Tizen.NUI.FontClient.CreateVectorBlob M")]
247 [Property("SPEC_URL", "-")]
248 [Property("CRITERIA", "MR")]
249 [Property("AUTHOR", "guowei.wang@samsung.com")]
250 public void FontClientCreateVectorBlob()
252 tlog.Debug(tag, $"FontClientCreateVectorBlob START");
254 var testingTarget = new FontClient(FontClient.Instance);
256 using (Color color = new Color(0.4f, 1.0f, 0.3f, 0.0f))
258 var blob = new SWIGTYPE_p_p_Dali__TextAbstraction__VectorBlob(color.SwigCPtr.Handle);
259 var blobLegnth = new SWIGTYPE_p_unsigned_int(color.SwigCPtr.Handle);
261 var nominalWidth = new SWIGTYPE_p_unsigned_int(FontClient.Instance.SwigCPtr.Handle);
262 var nominalHeight = new SWIGTYPE_p_unsigned_int(testingTarget.SwigCPtr.Handle);
266 testingTarget.CreateVectorBlob(0, 0, blob, blobLegnth, nominalWidth, nominalHeight);
270 tlog.Debug(tag, e.Message.ToString());
271 Assert.Fail("Caught Exception: Failed!");
274 testingTarget.Dispose();
277 tlog.Debug(tag, $"FontClientCreateVectorBlob END (OK)");
282 [Description("FontClient GetEllipsisGlyph.")]
283 [Property("SPEC", "Tizen.NUI.FontClient.GetEllipsisGlyph M")]
284 [Property("SPEC_URL", "-")]
285 [Property("CRITERIA", "MR")]
286 [Property("AUTHOR", "guowei.wang@samsung.com")]
287 public void FontClientGetEllipsisGlyph()
289 tlog.Debug(tag, $"FontClientGetEllipsisGlyph START");
291 var testingTarget = new FontClient(FontClient.Instance);
292 Assert.IsNotNull(testingTarget, "Return a null object of FontClient");
293 Assert.IsInstanceOf<FontClient>(testingTarget, "Should be an instance of FontClient type.");
295 var result = testingTarget.GetEllipsisGlyph(10);
296 Assert.IsInstanceOf<GlyphInfo>(result, "Should be an instance of GlyphInfo type.");
298 testingTarget.Dispose();
299 tlog.Debug(tag, $"FontClientGetEllipsisGlyph END (OK)");
304 [Description("FontClient IsColorGlyph.")]
305 [Property("SPEC", "Tizen.NUI.FontClient.IsColorGlyph M")]
306 [Property("SPEC_URL", "-")]
307 [Property("CRITERIA", "MR")]
308 [Property("AUTHOR", "guowei.wang@samsung.com")]
309 public void FontClientIsColorGlyph()
311 tlog.Debug(tag, $"FontClientIsColorGlyph START");
313 var testingTarget = new FontClient(FontClient.Instance);
314 Assert.IsNotNull(testingTarget, "Return a null object of FontClient");
315 Assert.IsInstanceOf<FontClient>(testingTarget, "Should be an instance of FontClient type.");
319 testingTarget.IsColorGlyph(testingTarget.GetFontId(ttf_path), testingTarget.GetGlyphIndex(0, 0x0041));
323 tlog.Debug(tag, e.Message.ToString());
324 Assert.Fail("Caugth Exception: Failed!");
327 testingTarget.Dispose();
328 tlog.Debug(tag, $"FontClientIsColorGlyph END (OK)");
333 [Description("GlyphBufferData constructor.")]
334 [Property("SPEC", "Tizen.NUI.FontClient.GlyphBufferData.GlyphBufferData C")]
335 [Property("SPEC_URL", "-")]
336 [Property("CRITERIA", "MR")]
337 [Property("AUTHOR", "guowei.wang@samsung.com")]
338 public void FontClientGlyphBufferDataConstructor()
340 tlog.Debug(tag, $"FontClientGlyphBufferDataConstructor START");
342 using (FontClient.GlyphBufferData data = new FontClient.GlyphBufferData())
344 var testingTarget = new FontClient.GlyphBufferData(FontClient.GlyphBufferData.getCPtr(data).Handle, true);
345 Assert.IsNotNull(testingTarget, "Return a null object of GlyphBufferData");
346 Assert.IsInstanceOf<FontClient.GlyphBufferData>(testingTarget, "Should be an instance of GlyphBufferData type.");
348 testingTarget.Dispose();
351 tlog.Debug(tag, $"FontClientGlyphBufferDataConstructor END (OK)");
356 [Description("GlyphBufferData Width.")]
357 [Property("SPEC", "Tizen.NUI.FontClient.GlyphBufferData.Width A")]
358 [Property("SPEC_URL", "-")]
359 [Property("CRITERIA", "PRW")]
360 [Property("AUTHOR", "guowei.wang@samsung.com")]
361 public void FontClientGlyphBufferDataWidth()
363 tlog.Debug(tag, $"FontClientGlyphBufferDataWidth START");
365 var testingTarget = new FontClient.GlyphBufferData();
366 Assert.IsNotNull(testingTarget, "Return a null object of GlyphBufferData");
367 Assert.IsInstanceOf<FontClient.GlyphBufferData>(testingTarget, "Should be an instance of GlyphBufferData type.");
369 testingTarget.Width = 10;
370 Assert.AreEqual(10, testingTarget.Width, "Should be equal!");
372 testingTarget.Dispose();
373 tlog.Debug(tag, $"FontClientGlyphBufferDataWidth END (OK)");
378 [Description("GlyphBufferData Height.")]
379 [Property("SPEC", "Tizen.NUI.FontClient.GlyphBufferData.Height A")]
380 [Property("SPEC_URL", "-")]
381 [Property("CRITERIA", "PRW")]
382 [Property("AUTHOR", "guowei.wang@samsung.com")]
383 public void FontClientGlyphBufferDataHeight()
385 tlog.Debug(tag, $"FontClientGlyphBufferDataHeight START");
387 var testingTarget = new FontClient.GlyphBufferData(); ;
388 Assert.IsNotNull(testingTarget, "Return a null object of GlyphBufferData");
389 Assert.IsInstanceOf<FontClient.GlyphBufferData>(testingTarget, "Should be an instance of GlyphBufferData type.");
391 testingTarget.Height = 50;
392 Assert.AreEqual(50, testingTarget.Height, "Should be equal!");
394 testingTarget.Dispose();
395 tlog.Debug(tag, $"FontClientGlyphBufferDataHeight END (OK)");
400 [Description("GlyphBufferData Format.")]
401 [Property("SPEC", "Tizen.NUI.FontClient.GlyphBufferData.Format A")]
402 [Property("SPEC_URL", "-")]
403 [Property("CRITERIA", "PRW")]
404 [Property("AUTHOR", "guowei.wang@samsung.com")]
405 public void FontClientGlyphBufferDataFormat()
407 tlog.Debug(tag, $"FontClientGlyphBufferDataFormat START");
409 var testingTarget = new FontClient.GlyphBufferData();
410 Assert.IsNotNull(testingTarget, "Return a null object of GlyphBufferData");
411 Assert.IsInstanceOf<FontClient.GlyphBufferData>(testingTarget, "Should be an instance of GlyphBufferData type.");
413 testingTarget.Format = PixelFormat.BGR8888;
414 Assert.AreEqual(PixelFormat.BGR8888, testingTarget.Format, "Should be equal!");
416 testingTarget.Dispose();
417 tlog.Debug(tag, $"FontClientGlyphBufferDataFormat END (OK)");