1 using NUnit.Framework;
3 using System.Collections.Generic;
7 namespace Tizen.NUI.Devel.Tests
9 using tlog = Tizen.Log;
12 [Description("internal/Xaml/ApplyPropertiesVisitor")]
13 internal class PublicApplyPropertiesVisitorTest
15 private const string tag = "NUITEST";
16 private static ApplyPropertiesVisitor a1;
20 tlog.Info(tag, "Init() is called!");
21 HydrationContext context = new HydrationContext();
22 a1 = new ApplyPropertiesVisitor(context, false);
29 tlog.Info(tag, "Destroy() is called!");
34 [Description("ApplyPropertiesVisitor ApplyPropertiesVisitor")]
35 [Property("SPEC", "Tizen.NUI.ApplyPropertiesVisitor.ApplyPropertiesVisitor C")]
36 [Property("SPEC_URL", "-")]
37 [Property("CRITERIA", "CONSTR")]
38 public void ApplyPropertiesVisitorConstructor()
40 tlog.Debug(tag, $"ApplyPropertiesVisitorConstructor START");
42 HydrationContext context = new HydrationContext();
44 ApplyPropertiesVisitor applyPropertiesVisitor = new ApplyPropertiesVisitor(context, false);
46 tlog.Debug(tag, $"ApplyPropertiesVisitorConstructor END (OK)");
47 Assert.Pass("ApplyPropertiesVisitorConstructor");
52 [Description("ApplyPropertiesVisitor VisitingMode")]
53 [Property("SPEC", "Tizen.NUI.ApplyPropertiesVisitor.VisitingMode A")]
54 [Property("SPEC_URL", "-")]
55 [Property("CRITERIA", "PRW")]
56 public void ApplyPropertiesVisitorVisitingMode()
58 tlog.Debug(tag, $"ApplyPropertiesVisitorVisitingMode START");
62 TreeVisitingMode t1 = a1.VisitingMode;
66 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
67 Assert.Fail("Caught Exception" + e.ToString());
70 tlog.Debug(tag, $"ApplyPropertiesVisitorVisitingMode END (OK)");
71 Assert.Pass("ApplyPropertiesVisitorVisitingMode");
76 [Description("ApplyPropertiesVisitor StopOnDataTemplate")]
77 [Property("SPEC", "Tizen.NUI.ApplyPropertiesVisitor.StopOnDataTemplate A")]
78 [Property("SPEC_URL", "-")]
79 [Property("CRITERIA", "PRW")]
80 public void ApplyPropertiesVisitorStopOnDataTemplate()
82 tlog.Debug(tag, $"ApplyPropertiesVisitorStopOnDataTemplate START");
86 bool b1 = a1.StopOnDataTemplate;
90 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
91 Assert.Fail("Caught Exception" + e.ToString());
94 tlog.Debug(tag, $"ApplyPropertiesVisitorStopOnDataTemplate END (OK)");
95 Assert.Pass("ApplyPropertiesVisitorStopOnDataTemplate");
100 [Description("ApplyPropertiesVisitor StopOnResourceDictionary ")]
101 [Property("SPEC", "Tizen.NUI.ApplyPropertiesVisitor.StopOnResourceDictionary A")]
102 [Property("SPEC_URL", "-")]
103 [Property("CRITERIA", "PRW")]
104 public void ApplyPropertiesVisitorStopOnResourceDictionary()
106 tlog.Debug(tag, $"ApplyPropertiesVisitorStopOnResourceDictionary START");
110 bool b1 = a1.StopOnResourceDictionary;
114 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
115 Assert.Fail("Caught Exception" + e.ToString());
118 tlog.Debug(tag, $"ApplyPropertiesVisitorStopOnResourceDictionary END (OK)");
119 Assert.Pass("ApplyPropertiesVisitorStopOnResourceDictionary");
124 [Description("ApplyPropertiesVisitor VisitNodeOnDataTemplate ")]
125 [Property("SPEC", "Tizen.NUI.ApplyPropertiesVisitor.VisitNodeOnDataTemplate A")]
126 [Property("SPEC_URL", "-")]
127 [Property("CRITERIA", "PRW")]
128 public void ApplyPropertiesVisitorVisitNodeOnDataTemplate()
130 tlog.Debug(tag, $"ApplyPropertiesVisitorVisitNodeOnDataTemplate START");
134 bool b1 = a1.VisitNodeOnDataTemplate;
138 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
139 Assert.Fail("Caught Exception" + e.ToString());
142 tlog.Debug(tag, $"ApplyPropertiesVisitorVisitNodeOnDataTemplate END (OK)");
143 Assert.Pass("ApplyPropertiesVisitorVisitNodeOnDataTemplate");
146 public class INodeImplement : INode
148 public global::System.Collections.Generic.List<string> IgnorablePrefixes { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
150 public global::System.Xml.IXmlNamespaceResolver NamespaceResolver => throw new NotImplementedException();
152 public INode Parent { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
154 public void Accept(IXamlNodeVisitor visitor, INode parentNode)
156 throw new NotImplementedException();
161 throw new NotImplementedException();
167 [Description("ApplyPropertiesVisitor SkipChildren")]
168 [Property("SPEC", "Tizen.NUI.ApplyPropertiesVisitor.SkipChildren M")]
169 [Property("SPEC_URL", "-")]
170 [Property("CRITERIA", "MR")]
171 public void ApplyPropertiesVisitorSkipChildren()
173 tlog.Debug(tag, $"ApplyPropertiesVisitorSkipChildren START");
177 INodeImplement n1 = new INodeImplement();
178 INodeImplement n2 = new INodeImplement();
179 bool b1 = a1.SkipChildren(n1, n2);
183 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
184 Assert.Fail("Caught Exception" + e.ToString());
187 tlog.Debug(tag, $"ApplyPropertiesVisitorSkipChildren END (OK)");
188 Assert.Pass("ApplyPropertiesVisitorSkipChildren");
191 public class IXmlNamespaceResolverImplement : IXmlNamespaceResolver
193 public IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope)
195 throw new NotImplementedException();
198 public string LookupNamespace(string prefix)
200 throw new NotImplementedException();
203 public string LookupPrefix(string namespaceName)
205 throw new NotImplementedException();
211 [Description("ApplyPropertiesVisitor IsResourceDictionary")]
212 [Property("SPEC", "Tizen.NUI.ApplyPropertiesVisitor.IsResourceDictionary M")]
213 [Property("SPEC_URL", "-")]
214 [Property("CRITERIA", "MR")]
215 public void ApplyPropertiesVisitorIsResourceDictionary()
217 tlog.Debug(tag, $"ApplyPropertiesVisitorIsResourceDictionary START");
221 IList<XmlType> list = null;
222 XmlType xmlType = new XmlType("myNameSpace", "myName", list);
224 IXmlNamespaceResolverImplement i1 = new IXmlNamespaceResolverImplement();
225 ElementNode n1 = new ElementNode(xmlType, "myNameSpace", i1);
226 bool b1 = a1.IsResourceDictionary(n1);
230 tlog.Debug(tag, e.Message.ToString());
231 tlog.Debug(tag, $"ApplyPropertiesVisitorIsResourceDictionary END (OK)");
232 Assert.Pass("Caught Exception : passed!");
239 [Description("ApplyPropertiesVisitor Visit")]
240 [Property("SPEC", "Tizen.NUI.ApplyPropertiesVisitor.Visit M")]
241 [Property("SPEC_URL", "-")]
242 [Property("CRITERIA", "MR")]
243 public void ApplyPropertiesVisitorVisit1()
245 tlog.Debug(tag, $"ApplyPropertiesVisitorVisit START");
249 object o1 = new object();
250 IXmlNamespaceResolverImplement i1 = new IXmlNamespaceResolverImplement();
251 ValueNode valueNode = new ValueNode(o1, i1);
253 INodeImplement nodeImplement = new INodeImplement();
254 a1.Visit(valueNode, nodeImplement);
258 tlog.Debug(tag, e.Message.ToString());
259 tlog.Debug(tag, $"ApplyPropertiesVisitorVisit END (OK)");
260 Assert.Pass("Caught Exception : passed!");
266 [Description("ApplyPropertiesVisitor Visit")]
267 [Property("SPEC", "Tizen.NUI.ApplyPropertiesVisitor.Visit M")]
268 [Property("SPEC_URL", "-")]
269 [Property("CRITERIA", "MR")]
270 public void ApplyPropertiesVisitorVisit2()
272 tlog.Debug(tag, $"ApplyPropertiesVisitorVisit START");
276 INodeImplement nodeImplement = new INodeImplement();
278 IList<XmlType> list = null;
279 XmlType xmlType = new XmlType("myNameSpace", "myName", list);
281 IXmlNamespaceResolverImplement ix1 = new IXmlNamespaceResolverImplement();
282 ElementNode n1 = new ElementNode(xmlType, "myNameSpace", ix1);
284 a1.Visit(n1, nodeImplement);
288 tlog.Debug(tag, e.Message.ToString());
289 tlog.Debug(tag, $"ApplyPropertiesVisitorVisit END (OK)");
290 Assert.Pass("Caught Exception : passed!");
297 [Description("ApplyPropertiesVisitor TryGetPropertyName")]
298 [Property("SPEC", "Tizen.NUI.ApplyPropertiesVisitor.TryGetPropertyName M")]
299 [Property("SPEC_URL", "-")]
300 [Property("CRITERIA", "MR")]
301 public void ApplyPropertiesVisitorTryGetPropertyName()
303 tlog.Debug(tag, $"ApplyPropertiesVisitorTryGetPropertyName START");
307 INodeImplement n1 = new INodeImplement();
308 INodeImplement n2 = new INodeImplement();
309 XmlName xmlName = new XmlName();
310 ApplyPropertiesVisitor.TryGetPropertyName(n1, n2, out xmlName);
314 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
315 Assert.Fail("Caught Exception" + e.ToString());
318 tlog.Debug(tag, $"ApplyPropertiesVisitorTryGetPropertyName END (OK)");
319 Assert.Pass("ApplyPropertiesVisitorTryGetPropertyName");
324 [Description("ApplyPropertiesVisitor IsCollectionItem")]
325 [Property("SPEC", "Tizen.NUI.ApplyPropertiesVisitor.IsCollectionItem M")]
326 [Property("SPEC_URL", "-")]
327 [Property("CRITERIA", "MR")]
328 public void ApplyPropertiesVisitorIsCollectionItem()
330 tlog.Debug(tag, $"ApplyPropertiesVisitorIsCollectionItem START");
334 INodeImplement n1 = new INodeImplement();
335 INodeImplement n2 = new INodeImplement();
337 ApplyPropertiesVisitor.IsCollectionItem(n1, n2);
341 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
342 Assert.Fail("Caught Exception" + e.ToString());
345 tlog.Debug(tag, $"ApplyPropertiesVisitorIsCollectionItem END (OK)");
346 Assert.Pass("ApplyPropertiesVisitorIsCollectionItem");
351 //[Description("ApplyPropertiesVisitor GetContentPropertyName")]
352 //[Property("SPEC", "Tizen.NUI.ApplyPropertiesVisitor.GetContentPropertyName M")]
353 //[Property("SPEC_URL", "-")]
354 //[Property("CRITERIA", "MR")]
355 //public void ApplyPropertiesVisitorGetContentPropertyName()
357 // tlog.Debug(tag, $"ApplyPropertiesVisitorGetContentPropertyName START");
361 // System.Reflection.TypeInfo typeInfo = new System.Reflection.TypeInfo();
362 // ApplyPropertiesVisitor.GetContentPropertyName(typeInfo);
364 // catch (Exception e)
366 // Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
367 // Assert.Fail("Caught Exception" + e.ToString());
370 // tlog.Debug(tag, $"ApplyPropertiesVisitorGetContentPropertyName END (OK)");
371 // Assert.Pass("ApplyPropertiesVisitorGetContentPropertyName");
374 public class IXmlLineInfoImplement : IXmlLineInfo
376 public int LineNumber => throw new NotImplementedException();
378 public int LinePosition => throw new NotImplementedException();
380 public bool HasLineInfo()
382 throw new NotImplementedException();
388 [Description("ApplyPropertiesVisitor SetPropertyValue")]
389 [Property("SPEC", "Tizen.NUI.ApplyPropertiesVisitor.SetPropertyValue M")]
390 [Property("SPEC_URL", "-")]
391 [Property("CRITERIA", "MR")]
392 public void ApplyPropertiesVisitorProvideValue()
394 tlog.Debug(tag, $"ApplyPropertiesVisitorSetPropertyValue START");
398 object o1 = new object();
399 XmlName xmlName = new XmlName();
400 object value = new object();
401 object rootElement = new object();
402 INodeImplement nodeImplement = new INodeImplement();
403 HydrationContext context = new HydrationContext();
404 IXmlLineInfoImplement xmlLineInfoImplement = new IXmlLineInfoImplement();
406 ApplyPropertiesVisitor.SetPropertyValue(o1, xmlName, value, rootElement, nodeImplement, context, xmlLineInfoImplement);
410 tlog.Debug(tag, e.Message.ToString());
411 tlog.Debug(tag, $"ApplyPropertiesVisitorSetPropertyValue END (OK)");
412 Assert.Pass("Caught Exception : passed!");
418 [Description("ApplyPropertiesVisitor GetPropertyValue")]
419 [Property("SPEC", "Tizen.NUI.ApplyPropertiesVisitor.GetPropertyValue M")]
420 [Property("SPEC_URL", "-")]
421 [Property("CRITERIA", "MR")]
422 public void ApplyPropertiesVisitorGetPropertyValue()
424 tlog.Debug(tag, $"ApplyPropertiesVisitorGetPropertyValue START");
428 object o1 = new object();
429 XmlName xmlName = new XmlName();
430 object value = new object();
431 INodeImplement nodeImplement = new INodeImplement();
432 HydrationContext context = new HydrationContext();
433 IXmlLineInfoImplement xmlLineInfoImplement = new IXmlLineInfoImplement();
435 ApplyPropertiesVisitor.GetPropertyValue(o1, xmlName, context, xmlLineInfoImplement, out value);
439 tlog.Debug(tag, e.Message.ToString());
440 tlog.Debug(tag, $"ApplyPropertiesVisitorGetPropertyValue END (OK)");
441 Assert.Pass("Caught Exception : passed!");