24dec41e1cc4952b5844c583ab6a318e3f9ec868
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Utility / TSGraphicsTypeManager.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 using System.Collections.Generic;
7
8 namespace Tizen.NUI.Devel.Tests
9 {
10     using tlog = Tizen.Log;
11
12     [TestFixture]
13     [Description("public/Utility/GraphicsTypeManager")]
14     public class PublicGraphicsTypeManagerTest
15     {
16         private const string tag = "NUITEST";
17
18         internal class MyTypeConverter : Tizen.NUI.Binding.TypeConverter
19         {
20             public MyTypeConverter() : base()
21             { }
22         }
23
24         [SetUp]
25         public void Init()
26         {
27             tlog.Info(tag, "Init() is called!");
28         }
29
30         [TearDown]
31         public void Destroy()
32         {
33             tlog.Info(tag, "Destroy() is called!");
34         }
35
36         [Test]
37         [Category("P1")]
38         [Description("GraphicsTypeManager ConvertScriptToPixel.")]
39         [Property("SPEC", "Tizen.NUI.GraphicsTypeManager.ConvertScriptToPixel M")]
40         [Property("SPEC_URL", "-")]
41         [Property("CRITERIA", "MR")]
42         [Property("AUTHOR", "guowei.wang@samsung.com")]
43         public void GraphicsTypeManagerConvertScriptToPixel()
44         {
45             tlog.Debug(tag, $"GraphicsTypeManagerConvertScriptToPixel START");
46
47             try
48             {
49                 GraphicsTypeManager.Instance.ConvertScriptToPixel("160px");
50             }
51             catch (Exception e)
52             {
53                 tlog.Debug(tag, e.Message.ToString());
54                 Assert.Fail("Caught Exception: Failed!");
55             }
56
57             tlog.Debug(tag, $"GraphicsTypeManagerConvertScriptToPixel END (OK)");
58         }
59
60         [Test]
61         [Category("P1")]
62         [Description("GraphicsTypeManager RegisterCustomConverterForDynamicResourceBinding.")]
63         [Property("SPEC", "Tizen.NUI.GraphicsTypeManager.RegisterCustomConverterForDynamicResourceBinding M")]
64         [Property("SPEC_URL", "-")]
65         [Property("CRITERIA", "MR")]
66         [Property("AUTHOR", "guowei.wang@samsung.com")]
67         public void GraphicsTypeManagerRegisterCustomConverterForDynamicResourceBinding()
68         {
69             tlog.Debug(tag, $"GraphicsTypeManagerRegisterCustomConverterForDynamicResourceBinding START");
70
71             string str = "GraphicsTypeManager";
72             Tizen.NUI.Binding.TypeConverter converter = new MyTypeConverter();
73
74             try
75             {
76                 GraphicsTypeManager.Instance.RegisterCustomConverterForDynamicResourceBinding(str.GetType(), converter);
77             }
78             catch (Exception e)
79             {
80                 tlog.Debug(tag, e.Message.ToString());
81                 Assert.Fail("Caught Exception: Failed!");
82             }
83
84             tlog.Debug(tag, $"GraphicsTypeManagerRegisterCustomConverterForDynamicResourceBinding END (OK)");
85         }
86     }
87 }