[NUI] Update NUI.Devel to fix block and crash issues.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / Xaml / TSNamescopingVisitor.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/NamescopingVisitor")]
13     public class InternalXamlNamescopingVisitorTest
14     {
15         private const string tag = "NUITEST";
16         private NamescopingVisitor n1;
17
18         [SetUp]
19         public void Init()
20         {
21             tlog.Info(tag, "Init() is called!");
22             HydrationContext context = new HydrationContext();
23             NamescopingVisitor n1 = new NamescopingVisitor(context);
24         }
25
26         [TearDown]
27         public void Destroy()
28         {
29             n1 = null;
30             tlog.Info(tag, "Destroy() is called!");
31         }
32
33         [Test]
34         [Category("P1")]
35         [Description("NamescopingVisitor NamescopingVisitor")]
36         [Property("SPEC", "Tizen.NUI.NamescopingVisitor.NamescopingVisitor C")]
37         [Property("SPEC_URL", "-")]
38         [Property("CRITERIA", "CONSTR")]
39         public void NamescopingVisitorConstructor()
40         {
41             tlog.Debug(tag, $"NamescopingVisitorConstructor START");
42
43             HydrationContext context = new HydrationContext();
44
45             NamescopingVisitor namescoping = new NamescopingVisitor(context);
46
47             tlog.Debug(tag, $"NamescopingVisitorConstructor END (OK)");
48             Assert.Pass("NamescopingVisitorConstructor");
49         }
50
51         [Test]
52         [Category("P1")]
53         [Description("NamescopingVisitor VisitingMode")]
54         [Property("SPEC", "Tizen.NUI.NamescopingVisitor.VisitingMode A")]
55         [Property("SPEC_URL", "-")]
56         [Property("CRITERIA", "PRW")]
57         public void NamescopingVisitorVisitingMode()
58         {
59             tlog.Debug(tag, $"NamescopingVisitorVisitingMode START");
60
61             try
62             {
63                 TreeVisitingMode t1 = n1.VisitingMode;
64             }
65             catch (Exception e)
66             {
67                 tlog.Debug(tag, e.Message.ToString());
68                 tlog.Debug(tag, $"NamescopingVisitorVisitingMode END (OK)");
69                 Assert.Pass("Caught Exception : passed!");
70             }
71
72         }
73
74         [Test]
75         [Category("P1")]
76         [Description("NamescopingVisitor StopOnDataTemplate")]
77         [Property("SPEC", "Tizen.NUI.NamescopingVisitor.StopOnDataTemplate A")]
78         [Property("SPEC_URL", "-")]
79         [Property("CRITERIA", "PRW")]
80         public void NamescopingVisitorStopOnDataTemplate()
81         {
82             tlog.Debug(tag, $"NamescopingVisitorStopOnDataTemplate START");
83
84             try
85             {
86                 bool b1 = n1.StopOnDataTemplate;
87             }
88             catch (Exception e)
89             {
90                 tlog.Debug(tag, e.Message.ToString());
91                 tlog.Debug(tag, $"NamescopingVisitorStopOnDataTemplate END (OK)");
92                 Assert.Pass("Caught Exception : passed!");
93             }
94
95         }
96
97         [Test]
98         [Category("P1")]
99         [Description("NamescopingVisitor StopOnResourceDictionary")]
100         [Property("SPEC", "Tizen.NUI.NamescopingVisitor.StopOnResourceDictionary A")]
101         [Property("SPEC_URL", "-")]
102         [Property("CRITERIA", "PRW")]
103         public void NamescopingVisitorStopOnResourceDictionary()
104         {
105             tlog.Debug(tag, $"NamescopingVisitorStopOnResourceDictionary START");
106
107             try
108             {
109                 bool b1 = n1.StopOnResourceDictionary;
110             }
111             catch (Exception e)
112             {
113                 tlog.Debug(tag, e.Message.ToString());
114                 tlog.Debug(tag, $"NamescopingVisitorStopOnResourceDictionary END (OK)");
115                 Assert.Pass("Caught Exception : passed!");
116             }
117
118         }
119
120         [Test]
121         [Category("P1")]
122         [Description("NamescopingVisitor VisitNodeOnDataTemplate")]
123         [Property("SPEC", "Tizen.NUI.NamescopingVisitor.VisitNodeOnDataTemplate A")]
124         [Property("SPEC_URL", "-")]
125         [Property("CRITERIA", "PRW")]
126         public void NamescopingVisitorVisitNodeOnDataTemplate()
127         {
128             tlog.Debug(tag, $"NamescopingVisitorVisitNodeOnDataTemplate START");
129
130             try
131             {
132                 bool b1 = n1.VisitNodeOnDataTemplate;
133             }
134             catch (Exception e)
135             {
136                 tlog.Debug(tag, e.Message.ToString());
137                 tlog.Debug(tag, $"NamescopingVisitorVisitNodeOnDataTemplate END (OK)");
138                 Assert.Pass("Caught Exception : passed!");
139             }
140
141         }
142
143         internal class INodeImplement : INode
144         {
145             public List<string> IgnorablePrefixes { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
146
147             public IXmlNamespaceResolver NamespaceResolver => throw new NotImplementedException();
148
149             public INode Parent { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
150
151             public void Accept(IXamlNodeVisitor visitor, INode parentNode)
152             {
153                 throw new NotImplementedException();
154             }
155
156             public INode Clone()
157             {
158                 throw new NotImplementedException();
159             }
160         }
161
162         [Test]
163         [Category("P1")]
164         [Description("NamescopingVisitor SkipChildren")]
165         [Property("SPEC", "Tizen.NUI.NamescopingVisitor.SkipChildren M")]
166         [Property("SPEC_URL", "-")]
167         [Property("CRITERIA", "MR")]
168         public void NamescopingVisitorSkipChildren()
169         {
170             tlog.Debug(tag, $"NamescopingVisitorSkipChildren START");
171
172             try
173             {
174                 INodeImplement nodeImplement = new INodeImplement();
175                 INodeImplement parentNode = new INodeImplement();
176
177                 n1.SkipChildren(nodeImplement, parentNode);
178
179             }
180             catch (Exception e)
181             {
182                 tlog.Debug(tag, e.Message.ToString());
183                 tlog.Debug(tag, $"NamescopingVisitorSkipChildren END (OK)");
184                 Assert.Pass("Caught Exception : passed!");
185             }
186
187         }
188
189         public class IXmlNamespaceResolverImplement : IXmlNamespaceResolver
190         {
191             public IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope)
192             {
193                 return null;
194             }
195
196             public string LookupNamespace(string prefix)
197             {
198                 return "mynamespaceName";
199             }
200
201             public string LookupPrefix(string namespaceName)
202             {
203                 return "myPrefix";
204             }
205         }
206
207         //[Test]
208         //[Category("P1")]
209         //[Description("NamescopingVisitor IsResourceDictionary")]
210         //[Property("SPEC", "Tizen.NUI.NamescopingVisitor.IsResourceDictionary M")]
211         //[Property("SPEC_URL", "-")]
212         //[Property("CRITERIA", "MR")]
213         //public void NamescopingVisitorIsResourceDictionary()
214         //{
215         //    tlog.Debug(tag, $"NamescopingVisitorIsResourceDictionary START");
216
217         //    try
218         //    {
219         //        IList<XmlType> list = null;
220         //        XmlType xmlType = new XmlType("myNameSpace", "myName", list);
221
222         //        IXmlNamespaceResolverImplement i1 = new IXmlNamespaceResolverImplement();
223         //        ElementNode e1 = new ElementNode(xmlType, "myNameSpace", i1);
224
225         //        bool b1 = n1.IsResourceDictionary(e1);
226         //    }
227         //    catch (Exception e)
228         //    {
229         //        tlog.Debug(tag, e.Message.ToString());
230         //        tlog.Debug(tag, $"NamescopingVisitorIsResourceDictionary END (OK)");
231         //        Assert.Pass("Caught Exception : passed!");
232         //    }
233         //}
234
235         //public class RootNodeImplement : RootNode
236         //{
237         //    public RootNodeImplement(XmlType xmlType, IXmlNamespaceResolver nsResolver) : base(xmlType, nsResolver)
238         //    {
239         //    }
240         //}
241
242         //[Test]
243         //[Category("P1")]
244         //[Description("NamescopingVisitor Visit")]
245         //[Property("SPEC", "Tizen.NUI.NamescopingVisitor.Visit M")]
246         //[Property("SPEC_URL", "-")]
247         //[Property("CRITERIA", "MR")]
248         //public void NamescopingVisitorVisit1()
249         //{
250         //    tlog.Debug(tag, $"NamescopingVisitorVisit START");
251
252         //    try
253         //    {
254         //        object o1 = new object();
255         //        IXmlNamespaceResolverImplement i1 = new IXmlNamespaceResolverImplement();
256         //        ValueNode node = new ValueNode(o1, i1);
257
258         //        INodeImplement parentNode = new INodeImplement();
259         //        n1.Visit(node, parentNode);
260         //    }
261         //    catch (Exception e)
262         //    {
263         //        tlog.Debug(tag, e.Message.ToString());
264         //        tlog.Debug(tag, $"NamescopingVisitorVisit END (OK)");
265         //        Assert.Pass("Caught Exception : passed!");
266         //    }
267         //}
268
269         //[Test]
270         //[Category("P1")]
271         //[Description("NamescopingVisitor Visit")]
272         //[Property("SPEC", "Tizen.NUI.NamescopingVisitor.Visit M")]
273         //[Property("SPEC_URL", "-")]
274         //[Property("CRITERIA", "MR")]
275         //public void NamescopingVisitorVisit2()
276         //{
277         //    tlog.Debug(tag, $"NamescopingVisitorVisit START");
278
279         //    try
280         //    {
281         //        INodeImplement parentNode = new INodeImplement();
282         //        IXmlNamespaceResolverImplement i1 = new IXmlNamespaceResolverImplement();
283         //        MarkupNode markupnode = new MarkupNode("markup", i1);
284         //        n1.Visit(markupnode, parentNode);
285
286
287         //    }
288         //    catch (Exception e)
289         //    {
290         //        tlog.Debug(tag, e.Message.ToString());
291         //        tlog.Debug(tag, $"NamescopingVisitorVisit END (OK)");
292         //        Assert.Pass("Caught Exception : passed!");
293         //    }
294         //}
295
296         //[Test]
297         //[Category("P1")]
298         //[Description("NamescopingVisitor Visit")]
299         //[Property("SPEC", "Tizen.NUI.NamescopingVisitor.Visit M")]
300         //[Property("SPEC_URL", "-")]
301         //[Property("CRITERIA", "MR")]
302         //public void NamescopingVisitorVisit3()
303         //{
304         //    tlog.Debug(tag, $"NamescopingVisitorVisit START");
305
306         //    try
307         //    {
308         //        IXmlNamespaceResolverImplement i1 = new IXmlNamespaceResolverImplement();
309         //        INodeImplement parentNode = new INodeImplement();
310
311         //        IList<XmlType> list = null;
312         //        XmlType xmlType = new XmlType("myNameSpace", "myName", list);
313
314         //        ElementNode e1 = new ElementNode(xmlType, "myNameSpace", i1);
315
316         //        n1.Visit(e1, parentNode);
317         //    }
318         //    catch (Exception e)
319         //    {
320         //        tlog.Debug(tag, e.Message.ToString());
321         //        tlog.Debug(tag, $"NamescopingVisitorVisit END (OK)");
322         //        Assert.Pass("Caught Exception : passed!");
323         //    }
324         //}
325
326         //[Test]
327         //[Category("P1")]
328         //[Description("NamescopingVisitor Visit")]
329         //[Property("SPEC", "Tizen.NUI.NamescopingVisitor.Visit M")]
330         //[Property("SPEC_URL", "-")]
331         //[Property("CRITERIA", "MR")]
332         //public void NamescopingVisitorVisit4()
333         //{
334         //    tlog.Debug(tag, $"NamescopingVisitorVisit START");
335
336         //    try
337         //    {
338         //        IXmlNamespaceResolverImplement i1 = new IXmlNamespaceResolverImplement();
339
340         //        INodeImplement parentNode = new INodeImplement();
341
342         //        IList<XmlType> list = null;
343         //        XmlType xmlType = new XmlType("myNameSpace", "myName", list);
344         //        RootNodeImplement rootNode = new RootNodeImplement(xmlType, i1);
345         //        n1.Visit(rootNode, parentNode);
346         //    }
347         //    catch (Exception e)
348         //    {
349         //        tlog.Debug(tag, e.Message.ToString());
350         //        tlog.Debug(tag, $"NamescopingVisitorVisit END (OK)");
351         //        Assert.Pass("Caught Exception : passed!");
352         //    }
353         //}
354
355         //[Test]
356         //[Category("P1")]
357         //[Description("NamescopingVisitor Visit")]
358         //[Property("SPEC", "Tizen.NUI.NamescopingVisitor.Visit M")]
359         //[Property("SPEC_URL", "-")]
360         //[Property("CRITERIA", "MR")]
361         //public void NamescopingVisitorVisit5()
362         //{
363         //    tlog.Debug(tag, $"NamescopingVisitorVisit START");
364
365         //    try
366         //    {
367         //        IXmlNamespaceResolverImplement i1 = new IXmlNamespaceResolverImplement();
368         //        INodeImplement parentNode = new INodeImplement();
369
370         //        IList<INode> nodes = null;
371         //        ListNode li = new ListNode(nodes, i1);
372         //        n1.Visit(li, parentNode);
373         //    }
374         //    catch (Exception e)
375         //    {
376         //        tlog.Debug(tag, e.Message.ToString());
377         //        tlog.Debug(tag, $"NamescopingVisitorVisit END (OK)");
378         //        Assert.Pass("Caught Exception : passed!");
379         //    }
380         //}
381     }
382 }