[NUI] Update TCs to improve function coverage of NUI.Components.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Components.Devel.Tests / testcase / Style / TSDefaultLinearItemStyle.cs
1 using global::System;
2 using NUnit.Framework;
3 using NUnit.Framework.TUnit;
4 using Tizen.NUI;
5 using Tizen.NUI.Components;
6 using Tizen.NUI.BaseComponents;
7
8 namespace Tizen.NUI.Components.Devel.Tests
9 {
10     using tlog = Tizen.Log;
11
12     [TestFixture]
13     [Description("Style/DefaultLinearItemStyle")]
14     public class DefaultLinearItemStyleTest
15     {
16         private const string tag = "NUITEST";
17
18         [SetUp]
19         public void Init()
20         {
21             tlog.Info(tag, "Init() is called!");
22         }
23
24         [TearDown]
25         public void Destroy()
26         {
27             tlog.Info(tag, "Destroy() is called!");
28         }
29
30         [Test]
31         [Category("P1")]
32         [Description("DefaultLinearItemStyle Constructor.")]
33         [Property("SPEC", "Tizen.NUI.Components.DefaultLinearItemStyle.DefaultLinearItemStyle C")]
34         [Property("SPEC_URL", "-")]
35         [Property("CRITERIA", "CONSTR")]
36         [Property("COVPARAM", "")]
37         [Property("AUTHOR", "guowei.wang@samsung.com")]
38         public void DefaultLinearItemStyleConstructor()
39         {
40             tlog.Debug(tag, $"DefaultLinearItemStyleConstructor START");
41
42             DefaultLinearItemStyle style = new DefaultLinearItemStyle()
43             {
44                 Label = new TextLabelStyle()
45                 {
46                     EnableAutoScroll = true,
47                     Ellipsis = true,
48                 },
49                 Icon = new ViewStyle()
50                 {
51                     Color = new ColorSelector
52                     {
53                         Normal = Color.Cyan,
54                     },
55                 }
56             };
57
58             var testingTarget = new DefaultLinearItemStyle(style);
59             Assert.IsNotNull(testingTarget, "null handle");
60             Assert.IsInstanceOf<DefaultLinearItemStyle>(testingTarget, "Should return DefaultLinearItemStyle instance.");
61
62             testingTarget.Dispose();
63             tlog.Debug(tag, $"DefaultLinearItemStyleConstructor END (OK)");
64         }
65
66         [Test]
67         [Category("P1")]
68         [Description("DefaultLinearItemStyle CopyFrom.")]
69         [Property("SPEC", "Tizen.NUI.Components.DefaultLinearItemStyle.CopyFrom M")]
70         [Property("SPEC_URL", "-")]
71         [Property("CRITERIA", "MR")]
72         [Property("COVPARAM", "")]
73         [Property("AUTHOR", "guowei.wang@samsung.com")]
74         public void DefaultLinearItemStyleCopyFrom()
75         {
76             tlog.Debug(tag, $"DefaultLinearItemStyleCopyFrom START");
77
78             DefaultLinearItemStyle style = new DefaultLinearItemStyle()
79             {
80                 Label = new TextLabelStyle()
81                 {
82                     EnableAutoScroll = true,
83                     Ellipsis = true,
84                 },
85                 Icon = new ViewStyle()
86                 {
87                     Color = new ColorSelector
88                     {
89                         Normal = Color.Cyan,
90                     },
91                 }
92             };
93
94             var testingTarget = new DefaultLinearItemStyle();
95             Assert.IsNotNull(testingTarget, "null handle");
96             Assert.IsInstanceOf<DefaultLinearItemStyle>(testingTarget, "Should return DefaultLinearItemStyle instance.");
97
98             try
99             {
100                 testingTarget.CopyFrom(style);
101             }
102             catch (Exception e)
103             {
104                 tlog.Debug(tag, e.Message.ToString());
105                 Assert.Fail("Caught Exception : Failed!");
106             }
107
108             testingTarget.Dispose();
109             tlog.Debug(tag, $"DefaultLinearItemStyleCopyFrom END (OK)");
110         }
111     }
112 }