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