3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 using System.Collections.Generic;
8 namespace Tizen.NUI.Devel.Tests
10 using tlog = Tizen.Log;
13 [Description("public/Utility/GraphicsTypeConverter")]
14 public class PublicGraphicsTypeConverterTest
16 private const string tag = "NUITEST";
21 tlog.Info(tag, "Init() is called!");
27 tlog.Info(tag, "Destroy() is called!");
30 internal class MyGraphicsTypeConverter : GraphicsTypeConverter
32 public MyGraphicsTypeConverter() : base()
35 public override float ConvertScriptToPixel(string scriptValue)
37 return base.ConvertScriptToPixel(scriptValue);
40 public override float ConvertFromPixel(float scriptValue)
42 return base.ConvertFromPixel(scriptValue);
48 [Description("GraphicsTypeConverter ConvertScriptToPixel.")]
49 [Property("SPEC", "Tizen.NUI.GraphicsTypeConverter.ConvertScriptToPixel M")]
50 [Property("SPEC_URL", "-")]
51 [Property("CRITERIA", "MR")]
52 [Property("AUTHOR", "guowei.wang@samsung.com")]
53 public void GraphicsTypeConverterConvertScriptToPixel()
55 tlog.Debug(tag, $"GraphicsTypeConverterConvertScriptToPixel START");
57 var testingTarget = new MyGraphicsTypeConverter();
58 Assert.IsNotNull(testingTarget, "Can't create success object GraphicsTypeConverter");
59 Assert.IsInstanceOf<GraphicsTypeConverter>(testingTarget, "Should be an instance of GraphicsTypeConverter type.");
61 var result = testingTarget.ConvertScriptToPixel("160dp");
62 tlog.Debug(tag, "ConvertScriptToPixel : " + result);
64 result = testingTarget.ConvertScriptToPixel("160px");
65 tlog.Debug(tag, "ConvertScriptToPixel : " + result);
67 result = testingTarget.ConvertScriptToPixel("160.0f");
68 tlog.Debug(tag, "ConvertScriptToPixel : " + result);
70 tlog.Debug(tag, $"GraphicsTypeConverterConvertScriptToPixel END (OK)");
75 [Description("GraphicsTypeConverter ConvertFromPixel.")]
76 [Property("SPEC", "Tizen.NUI.GraphicsTypeConverter.ConvertFromPixel M")]
77 [Property("SPEC_URL", "-")]
78 [Property("CRITERIA", "MR")]
79 [Property("AUTHOR", "guowei.wang@samsung.com")]
80 public void GraphicsTypeConverterConvertFromPixel()
82 tlog.Debug(tag, $"GraphicsTypeConverterConvertFromPixel START");
84 var testingTarget = new MyGraphicsTypeConverter();
85 Assert.IsNotNull(testingTarget, "Can't create success object GraphicsTypeConverter");
86 Assert.IsInstanceOf<GraphicsTypeConverter>(testingTarget, "Should be an instance of GraphicsTypeConverter type.");
88 var result = testingTarget.ConvertFromPixel(160.0f);
89 Assert.IsNotNull(result);
91 tlog.Debug(tag, $"GraphicsTypeConverterConvertFromPixel END (OK)");