[NUI] Update TCs of NUI.Devel.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / Xaml / TSApplyPropertiesVisitor.cs
1 using NUnit.Framework;
2 using System;
3 using System.Collections.Generic;
4 using System.Xml;
5 using Tizen.NUI.Binding;
6 using Tizen.NUI.Xaml;
7
8 namespace Tizen.NUI.Devel.Tests
9 {
10     using tlog = Tizen.Log;
11
12     [TestFixture]
13     [Description("internal/Xaml/ApplyPropertiesVisitor")]
14     public class InternalApplyPropertiesVisitorTest
15     {
16         private const string tag = "NUITEST";
17         private ApplyPropertiesVisitor visitor;
18
19         internal class INodeImpl : INode
20         {
21             public global::System.Collections.Generic.List<string> IgnorablePrefixes { get; set; }
22             public global::System.Xml.IXmlNamespaceResolver NamespaceResolver => new INodeImpl().NamespaceResolver;
23             public INode Parent { get; set; }
24             public void Accept(IXamlNodeVisitor visitor, INode parentNode) { }
25             public INode Clone() { return new INodeImpl(); }
26         }
27
28         [SetUp]
29         public void Init()
30         {
31             tlog.Info(tag, "Init() is called!");
32             visitor = new ApplyPropertiesVisitor(new HydrationContext(), false);
33         }
34
35         [TearDown]
36         public void Destroy()
37         {
38             visitor = null;
39             tlog.Info(tag, "Destroy() is called!");
40         }
41
42         [Test]
43         [Category("P1")]
44         [Description("ApplyPropertiesVisitor VisitingMode")]
45         [Property("SPEC", "Tizen.NUI.ApplyPropertiesVisitor.VisitingMode A")]
46         [Property("SPEC_URL", "-")]
47         [Property("CRITERIA", "PRW")]
48         public void ApplyPropertiesVisitorVisitingMode()
49         {
50             tlog.Debug(tag, $"ApplyPropertiesVisitorVisitingMode START");
51
52             try
53             {
54                 var result = visitor.VisitingMode;
55                 tlog.Debug(tag, "VisitingMode : " + result);
56             }
57             catch (Exception e)
58             {
59                 tlog.Debug(tag, e.Message.ToString());
60                 Assert.Fail("Caught Exception : Failed!");
61             }
62
63             tlog.Debug(tag, $"ApplyPropertiesVisitorVisitingMode END");
64         }
65
66         [Test]
67         [Category("P1")]
68         [Description("ApplyPropertiesVisitor StopOnDataTemplate")]
69         [Property("SPEC", "Tizen.NUI.ApplyPropertiesVisitor.StopOnDataTemplate A")]
70         [Property("SPEC_URL", "-")]
71         [Property("CRITERIA", "PRW")]
72         public void ApplyPropertiesVisitorStopOnDataTemplate()
73         {
74             tlog.Debug(tag, $"ApplyPropertiesVisitorStopOnDataTemplate START");
75
76             try
77             {
78                 var result = visitor.StopOnDataTemplate;
79                 tlog.Debug(tag, "StopOnDataTemplate : " + result);
80             }
81             catch (Exception e)
82             {
83                 tlog.Debug(tag, e.Message.ToString());
84                 Assert.Fail("Caught Exception : Failed!");
85             }
86
87             tlog.Debug(tag, $"ApplyPropertiesVisitorStopOnDataTemplate END");
88         }
89
90         [Test]
91         [Category("P1")]
92         [Description("ApplyPropertiesVisitor StopOnResourceDictionary ")]
93         [Property("SPEC", "Tizen.NUI.ApplyPropertiesVisitor.StopOnResourceDictionary A")]
94         [Property("SPEC_URL", "-")]
95         [Property("CRITERIA", "PRW")]
96         public void ApplyPropertiesVisitorStopOnResourceDictionary()
97         {
98             tlog.Debug(tag, $"ApplyPropertiesVisitorStopOnResourceDictionary START");
99
100             try
101             {
102                 var result = visitor.StopOnResourceDictionary;
103                 tlog.Debug(tag, "StopOnResourceDictionary : " + result);
104             }
105             catch (Exception e)
106             {
107                 tlog.Debug(tag, e.Message.ToString());
108                 Assert.Fail("Caught Exception : Failed!");
109             }
110
111             tlog.Debug(tag, $"ApplyPropertiesVisitorStopOnResourceDictionary END");
112         }
113
114         [Test]
115         [Category("P1")]
116         [Description("ApplyPropertiesVisitor VisitNodeOnDataTemplate ")]
117         [Property("SPEC", "Tizen.NUI.ApplyPropertiesVisitor.VisitNodeOnDataTemplate A")]
118         [Property("SPEC_URL", "-")]
119         [Property("CRITERIA", "PRW")]
120         public void ApplyPropertiesVisitorVisitNodeOnDataTemplate()
121         {
122             tlog.Debug(tag, $"ApplyPropertiesVisitorVisitNodeOnDataTemplate START");
123
124             try
125             {
126                 var result = visitor.VisitNodeOnDataTemplate;
127                 tlog.Debug(tag, "VisitNodeOnDataTemplate : " + result);
128             }
129             catch (Exception e)
130             {
131                 tlog.Debug(tag, e.Message.ToString());
132                 Assert.Fail("Caught Exception : Failed!");
133             }
134
135             tlog.Debug(tag, $"ApplyPropertiesVisitorVisitNodeOnDataTemplate END");
136         }
137
138         [Test]
139         [Category("P1")]
140         [Description("ApplyPropertiesVisitor SkipChildren")]
141         [Property("SPEC", "Tizen.NUI.ApplyPropertiesVisitor.SkipChildren M")]
142         [Property("SPEC_URL", "-")]
143         [Property("CRITERIA", "MR")]
144         public void ApplyPropertiesVisitorSkipChildren()
145         {
146             tlog.Debug(tag, $"ApplyPropertiesVisitorSkipChildren START");
147
148             try
149             {
150                 var child = new INodeImpl();
151                 Assert.IsNotNull(child, "null INodeImpl object.");
152
153                 var parent = new INodeImpl();
154                 Assert.IsNotNull(parent, "null INodeImpl object.");
155
156                 var result = visitor.SkipChildren(child, parent);
157                 tlog.Debug(tag, "SkipChildren : " + result);
158             }
159             catch (Exception e)
160             {
161                 tlog.Debug(tag, e.Message.ToString());
162                 Assert.Fail("Caught Exception : Failed!");
163             }
164
165             tlog.Debug(tag, $"ApplyPropertiesVisitorSkipChildren END");
166         }
167     }
168 }