e921072427168e933c92b53faf03a74ac8f86cbf
[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     internal class PublicPruneIgnoredNodesVisitorTest
14     {
15         private const string tag = "NUITEST";
16         private static PruneIgnoredNodesVisitor p1;
17
18         [SetUp]
19         public void Init()
20         {
21             tlog.Info(tag, "Init() is called!");
22             p1 = new PruneIgnoredNodesVisitor();
23         }
24
25         [TearDown]
26         public void Destroy()
27         {
28             p1 = null;
29             tlog.Info(tag, "Destroy() is called!");
30         }
31
32         [Test]
33         [Category("P1")]
34         [Description("PruneIgnoredNodesVisitor VisitingMode")]
35         [Property("SPEC", "Tizen.NUI.PruneIgnoredNodesVisitor.VisitingMode A")]
36         [Property("SPEC_URL", "-")]
37         [Property("CRITERIA", "PRW")]
38         public void PruneIgnoredNodesVisitorVisitingMode()
39         {
40             tlog.Debug(tag, $"NamescopingVisitorVisitingMode START");
41
42             try
43             {
44                 TreeVisitingMode t1 = p1.VisitingMode;
45             }
46             catch (Exception e)
47             {
48                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
49                 Assert.Fail("Caught Exception" + e.ToString());
50             }
51
52             tlog.Debug(tag, $"PruneIgnoredNodesVisitorVisitingMode END (OK)");
53             Assert.Pass("PruneIgnoredNodesVisitorVisitingMode");
54         }
55
56         [Test]
57         [Category("P1")]
58         [Description("NamescopingVisitor StopOnDataTemplate")]
59         [Property("SPEC", "Tizen.NUI.NamescopingVisitor.StopOnDataTemplate A")]
60         [Property("SPEC_URL", "-")]
61         [Property("CRITERIA", "PRW")]
62         public void NamescopingVisitorStopOnDataTemplate()
63         {
64             tlog.Debug(tag, $"NamescopingVisitorStopOnDataTemplate START");
65
66             try
67             {
68                 bool b1 = p1.StopOnDataTemplate;
69             }
70             catch (Exception e)
71             {
72                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
73                 Assert.Fail("Caught Exception" + e.ToString());
74             }
75
76             tlog.Debug(tag, $"NamescopingVisitorStopOnDataTemplate END (OK)");
77             Assert.Pass("NamescopingVisitorStopOnDataTemplate");
78         }
79
80         [Test]
81         [Category("P1")]
82         [Description("NamescopingVisitor StopOnResourceDictionary")]
83         [Property("SPEC", "Tizen.NUI.NamescopingVisitor.StopOnResourceDictionary A")]
84         [Property("SPEC_URL", "-")]
85         [Property("CRITERIA", "PRW")]
86         public void NamescopingVisitorStopOnResourceDictionary()
87         {
88             tlog.Debug(tag, $"NamescopingVisitorStopOnResourceDictionary START");
89
90             try
91             {
92                 bool b1 = p1.StopOnResourceDictionary;
93             }
94             catch (Exception e)
95             {
96                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
97                 Assert.Fail("Caught Exception" + e.ToString());
98             }
99
100             tlog.Debug(tag, $"NamescopingVisitorStopOnResourceDictionary END (OK)");
101             Assert.Pass("NamescopingVisitorStopOnResourceDictionary");
102         }
103
104         [Test]
105         [Category("P1")]
106         [Description("NamescopingVisitor VisitNodeOnDataTemplate")]
107         [Property("SPEC", "Tizen.NUI.NamescopingVisitor.VisitNodeOnDataTemplate A")]
108         [Property("SPEC_URL", "-")]
109         [Property("CRITERIA", "PRW")]
110         public void NamescopingVisitorVisitNodeOnDataTemplate()
111         {
112             tlog.Debug(tag, $"NamescopingVisitorVisitNodeOnDataTemplate START");
113
114             try
115             {
116                 bool b1 = p1.VisitNodeOnDataTemplate;
117             }
118             catch (Exception e)
119             {
120                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
121                 Assert.Fail("Caught Exception" + e.ToString());
122             }
123
124             tlog.Debug(tag, $"NamescopingVisitorVisitNodeOnDataTemplate END (OK)");
125             Assert.Pass("NamescopingVisitorVisitNodeOnDataTemplate");
126         }
127
128         public class INodeImplement : INode
129         {
130             public global::System.Collections.Generic.List<string> IgnorablePrefixes { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
131
132             public global::System.Xml.IXmlNamespaceResolver NamespaceResolver => throw new NotImplementedException();
133
134             public INode Parent { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
135
136             public void Accept(IXamlNodeVisitor visitor, INode parentNode)
137             {
138                 throw new NotImplementedException();
139             }
140
141             public INode Clone()
142             {
143                 throw new NotImplementedException();
144             }
145         }
146
147         [Test]
148         [Category("P1")]
149         [Description("NamescopingVisitor SkipChildren")]
150         [Property("SPEC", "Tizen.NUI.NamescopingVisitor.SkipChildren M")]
151         [Property("SPEC_URL", "-")]
152         [Property("CRITERIA", "MR")]
153         public void NamescopingVisitorSkipChildren()
154         {
155             tlog.Debug(tag, $"NamescopingVisitorSkipChildren START");
156
157             try
158             {
159                 INodeImplement node = new INodeImplement();
160                 INodeImplement nodeParent = new INodeImplement();
161                 bool b1 = p1.SkipChildren(node, nodeParent);
162             }
163             catch (Exception e)
164             {
165                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
166                 Assert.Fail("Caught Exception" + e.ToString());
167             }
168
169             tlog.Debug(tag, $"NamescopingVisitorSkipChildren END (OK)");
170             Assert.Pass("NamescopingVisitorSkipChildren");
171         }
172
173         public class IXmlNamespaceResolverImplement : IXmlNamespaceResolver
174         {
175             public IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope)
176             {
177                 throw new NotImplementedException();
178             }
179
180             public string LookupNamespace(string prefix)
181             {
182                 throw new NotImplementedException();
183             }
184
185             public string LookupPrefix(string namespaceName)
186             {
187                 throw new NotImplementedException();
188             }
189         }
190
191         [Test]
192         [Category("P1")]
193         [Description("NamescopingVisitor IsResourceDictionary")]
194         [Property("SPEC", "Tizen.NUI.NamescopingVisitor.IsResourceDictionary M")]
195         [Property("SPEC_URL", "-")]
196         [Property("CRITERIA", "MR")]
197         public void NamescopingVisitorIsResourceDictionary()
198         {
199             tlog.Debug(tag, $"NamescopingVisitorIsResourceDictionary START");
200
201             try
202             {
203                 IList<XmlType> list = null;
204                 XmlType xmlType = new XmlType("myNameSpace", "myName", list);
205
206                 IXmlNamespaceResolverImplement i1 = new IXmlNamespaceResolverImplement();
207                 ElementNode n1 = new ElementNode(xmlType, "myNameSpace", i1);
208
209                 bool b1 = p1.IsResourceDictionary(n1);
210             }
211             catch (Exception e)
212             {
213                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
214                 Assert.Fail("Caught Exception" + e.ToString());
215             }
216
217             tlog.Debug(tag, $"NamescopingVisitorIsResourceDictionary END (OK)");
218             Assert.Pass("NamescopingVisitorIsResourceDictionary");
219         }
220
221         public class RootNodeImplement : RootNode
222         {
223             public RootNodeImplement(XmlType xmlType, IXmlNamespaceResolver nsResolver) : base(xmlType, nsResolver)
224             {
225             }
226         }
227
228         [Test]
229         [Category("P1")]
230         [Description("NamescopingVisitor Visit")]
231         [Property("SPEC", "Tizen.NUI.NamescopingVisitor.Visit M")]
232         [Property("SPEC_URL", "-")]
233         [Property("CRITERIA", "MR")]
234         public void NamescopingVisitorVisit1()
235         {
236             tlog.Debug(tag, $"NamescopingVisitorVisit START");
237
238             try
239             {
240                 IList<XmlType> list = null;
241                 XmlType xmlType = new XmlType("myNameSpace", "myName", list);
242
243                 IXmlNamespaceResolverImplement i1 = new IXmlNamespaceResolverImplement();
244                 ElementNode n1 = new ElementNode(xmlType, "myNameSpace", i1);
245
246                 INodeImplement parentNode = new INodeImplement();
247                 p1.Visit(n1, parentNode);
248             }
249             catch (Exception e)
250             {
251                 tlog.Debug(tag, e.Message.ToString());
252                 tlog.Debug(tag, $"NamescopingVisitorVisit END (OK)");
253                 Assert.Pass("Caught Exception : passed!");
254             }
255         }
256
257         [Test]
258         [Category("P1")]
259         [Description("NamescopingVisitor Visit")]
260         [Property("SPEC", "Tizen.NUI.NamescopingVisitor.Visit M")]
261         [Property("SPEC_URL", "-")]
262         [Property("CRITERIA", "MR")]
263         public void NamescopingVisitorVisit2()
264         {
265             tlog.Debug(tag, $"NamescopingVisitorVisit START");
266
267             try
268             {
269                 IList<XmlType> list = null;
270                 XmlType xmlType = new XmlType("myNameSpace", "myName", list);
271
272                 IXmlNamespaceResolverImplement i1 = new IXmlNamespaceResolverImplement();
273
274                 INodeImplement parentNode = new INodeImplement();
275
276                 RootNodeImplement rootNode = new RootNodeImplement(xmlType, i1);
277                 p1.Visit(rootNode, parentNode);
278             }
279             catch (Exception e)
280             {
281                 tlog.Debug(tag, e.Message.ToString());
282                 tlog.Debug(tag, $"NamescopingVisitorVisit END (OK)");
283                 Assert.Pass("Caught Exception : passed!");
284             }
285         }
286
287         [Test]
288         [Category("P1")]
289         [Description("NamescopingVisitor Visit")]
290         [Property("SPEC", "Tizen.NUI.NamescopingVisitor.Visit M")]
291         [Property("SPEC_URL", "-")]
292         [Property("CRITERIA", "MR")]
293         public void NamescopingVisitorVisit3()
294         {
295             tlog.Debug(tag, $"NamescopingVisitorVisit START");
296
297             try
298             {
299                 IXmlNamespaceResolverImplement i1 = new IXmlNamespaceResolverImplement();
300
301                 INodeImplement parentNode = new INodeImplement();
302                 IList<INode> nodes = null;
303                 ListNode li = new ListNode(nodes, i1);
304                 p1.Visit(li, parentNode);
305             }
306             catch (Exception e)
307             {
308                 tlog.Debug(tag, e.Message.ToString());
309                 tlog.Debug(tag, $"NamescopingVisitorVisit END (OK)");
310                 Assert.Pass("Caught Exception : passed!");
311             }
312         }
313     }
314 }