3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 using System.Collections.Generic;
9 namespace Tizen.NUI.Devel.Tests
11 using tlog = Tizen.Log;
14 [Description("public/BaseComponents/ViewAccessibility")]
15 public class PublicViewAccessibilityTest
17 private const string tag = "NUITEST";
18 private string url = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/picture.png";
19 private string lottiePath = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/lottie.json";
21 internal class MyAddressCollection : AddressCollection
23 public MyAddressCollection(IntPtr collection) : base(collection)
26 public void OnReleaseHandle()
35 tlog.Info(tag, "Init() is called!");
41 tlog.Info(tag, "Destroy() is called!");
46 [Description("ViewAccessibility.Address constructor.")]
47 [Property("SPEC", "Tizen.NUI.ViewAccessibility.Address.Address C")]
48 [Property("SPEC_URL", "-")]
49 [Property("CRITERIA", "CONSTR")]
50 [Property("AUTHOR", "guowei.wang@samsung.com")]
51 public void ViewAccessibilityAddressConstructor()
53 tlog.Debug(tag, $"ViewAccessibilityAddressConstructor START");
55 var testingTarget = new Address("ViewAccessibility", lottiePath);
56 Assert.IsNotNull(testingTarget, "Can't create success object Address");
57 Assert.IsInstanceOf<Address>(testingTarget, "Should be an instance of Address type.");
59 tlog.Debug(tag, $"ViewAccessibilityAddressConstructor END (OK)");
64 [Description("ViewAccessibility.AddressCollection constructor.")]
65 [Property("SPEC", "Tizen.NUI.ViewAccessibility.AddressCollection.Address C")]
66 [Property("SPEC_URL", "-")]
67 [Property("CRITERIA", "CONSTR")]
68 [Property("AUTHOR", "guowei.wang@samsung.com")]
69 public void ViewAccessibilityAddressCollectionConstructor()
71 tlog.Debug(tag, $"ViewAccessibilityAddressCollectionConstructor START");
73 using (View view = new ImageView())
75 var testingTarget = new AddressCollection(Interop.ControlDevel.DaliToolkitDevelControlNewGetAccessibilityRelations(view.SwigCPtr));
76 Assert.IsNotNull(testingTarget, "Can't create success object AddressCollection");
77 Assert.IsInstanceOf<AddressCollection>(testingTarget, "Should be an instance of AddressCollection type.");
80 tlog.Debug(tag, $"ViewAccessibilityAddressCollectionConstructor END (OK)");
85 [Description("ViewAccessibility.AddressCollection IsInvalid.")]
86 [Property("SPEC", "Tizen.NUI.ViewAccessibility.AddressCollection.IsInvalid A")]
87 [Property("SPEC_URL", "-")]
88 [Property("CRITERIA", "PRO")]
89 [Property("AUTHOR", "guowei.wang@samsung.com")]
90 public void ViewAccessibilityAddressCollectionIsInvalid()
92 tlog.Debug(tag, $"ViewAccessibilityAddressCollectionIsInvalid START");
94 using (View view = new ImageView())
96 var testingTarget = new AddressCollection(Interop.ControlDevel.DaliToolkitDevelControlNewGetAccessibilityRelations(view.SwigCPtr));
97 Assert.IsNotNull(testingTarget, "Can't create success object AddressCollection");
98 Assert.IsInstanceOf<AddressCollection>(testingTarget, "Should be an instance of AddressCollection type.");
100 Assert.IsFalse(testingTarget.IsInvalid);
103 tlog.Debug(tag, $"ViewAccessibilityAddressCollectionIsInvalid END (OK)");
108 [Description("ViewAccessibility.AddressCollection GetRelationSize.")]
109 [Property("SPEC", "Tizen.NUI.ViewAccessibility.AddressCollection.GetRelationSize M")]
110 [Property("SPEC_URL", "-")]
111 [Property("CRITERIA", "MR")]
112 [Property("AUTHOR", "guowei.wang@samsung.com")]
113 public void ViewAccessibilityAddressCollectionGetRelationSize()
115 tlog.Debug(tag, $"ViewAccessibilityAddressCollectionGetRelationSize START");
117 using (View view = new ImageView())
119 var testingTarget = new AddressCollection(Interop.ControlDevel.DaliToolkitDevelControlNewGetAccessibilityRelations(view.SwigCPtr));
120 Assert.IsNotNull(testingTarget, "Can't create success object AddressCollection");
121 Assert.IsInstanceOf<AddressCollection>(testingTarget, "Should be an instance of AddressCollection type.");
125 testingTarget.GetRelationSize(AccessibilityRelationType.DetailsFor);
129 tlog.Debug(tag, e.Message.ToString());
130 Assert.Fail("Caught Exception: Failed!");
134 tlog.Debug(tag, $"ViewAccessibilityAddressCollectionGetRelationSize END (OK)");
139 //[Description("ViewAccessibility.AddressCollection GetAddressAt.")]
140 //[Property("SPEC", "Tizen.NUI.ViewAccessibility.AddressCollection.GetAddressAt M")]
141 //[Property("SPEC_URL", "-")]
142 //[Property("CRITERIA", "MR")]
143 //[Property("AUTHOR", "guowei.wang@samsung.com")]
144 //public void ViewAccessibilityAddressCollectionGetAddressAt()
146 // tlog.Debug(tag, $"ViewAccessibilityAddressCollectionGetAddressAt START");
148 // using (View view = new ImageView())
150 // var testingTarget = new AddressCollection(Interop.ControlDevel.DaliToolkitDevelControlNewGetAccessibilityRelations(view.SwigCPtr));
151 // Assert.IsNotNull(testingTarget, "Can't create success object AddressCollection");
152 // Assert.IsInstanceOf<AddressCollection>(testingTarget, "Should be an instance of AddressCollection type.");
156 // var result = testingTarget.GetAddressAt(AccessibilityRelationType.NullOf, 0);
157 // Assert.IsNotNull(result, "Can't create success object Address");
158 // Assert.IsInstanceOf<Address>(result, "Should be an instance of Address type.");
160 // catch (Exception e)
162 // tlog.Debug(tag, e.Message.ToString());
163 // Assert.Fail("Caught Exception: Failed!");
167 // tlog.Debug(tag, $"ViewAccessibilityAddressCollectionGetAddressAt END (OK)");
172 [Description("ViewAccessibility.AddressCollection ReleaseHandle.")]
173 [Property("SPEC", "Tizen.NUI.ViewAccessibility.AddressCollection.ReleaseHandle M")]
174 [Property("SPEC_URL", "-")]
175 [Property("CRITERIA", "MR")]
176 [Property("AUTHOR", "guowei.wang@samsung.com")]
177 public void ViewAccessibilityAddressCollectionReleaseHandle()
179 tlog.Debug(tag, $"ViewAccessibilityAddressCollectionReleaseHandle START");
181 using (View view = new ImageView())
183 var testingTarget = new MyAddressCollection(Interop.ControlDevel.DaliToolkitDevelControlNewGetAccessibilityRelations(view.SwigCPtr));
184 Assert.IsNotNull(testingTarget, "Can't create success object AddressCollection");
185 Assert.IsInstanceOf<AddressCollection>(testingTarget, "Should be an instance of AddressCollection type.");
189 testingTarget.OnReleaseHandle();
193 tlog.Debug(tag, e.Message.ToString());
194 Assert.Fail("Caught Exception: Failed!");
198 tlog.Debug(tag, $"ViewAccessibilityAddressCollectionReleaseHandle END (OK)");
203 [Description("ViewAccessibility.AccessibilityRange StartOffset.")]
204 [Property("SPEC", "Tizen.NUI.ViewAccessibility.AccessibilityRange.StartOffset A")]
205 [Property("SPEC_URL", "-")]
206 [Property("CRITERIA", "PRO")]
207 [Property("AUTHOR", "guowei.wang@samsung.com")]
208 public void ViewAccessibilityAccessibilityRangeStartOffset()
210 tlog.Debug(tag, $"ViewAccessibilityAccessibilityRangeStartOffset START");
212 var testingTarget = new AccessibilityRange();
213 Assert.IsNotNull(testingTarget, "Can't create success object AccessibilityRange");
214 Assert.IsInstanceOf<AccessibilityRange>(testingTarget, "Should be an instance of AccessibilityRange type.");
216 testingTarget.StartOffset = 10;
217 Assert.AreEqual(10, testingTarget.StartOffset, "Should be equal!");
219 tlog.Debug(tag, $"ViewAccessibilityAccessibilityRangeStartOffset END (OK)");
224 [Description("ViewAccessibility.AccessibilityRange EndOffset.")]
225 [Property("SPEC", "Tizen.NUI.ViewAccessibility.AccessibilityRange.EndOffset A")]
226 [Property("SPEC_URL", "-")]
227 [Property("CRITERIA", "PRO")]
228 [Property("AUTHOR", "guowei.wang@samsung.com")]
229 public void ViewAccessibilityAccessibilityRangeEndOffset()
231 tlog.Debug(tag, $"ViewAccessibilityAccessibilityRangeEndOffset START");
233 var testingTarget = new AccessibilityRange();
234 Assert.IsNotNull(testingTarget, "Can't create success object AccessibilityRange");
235 Assert.IsInstanceOf<AccessibilityRange>(testingTarget, "Should be an instance of AccessibilityRange type.");
237 testingTarget.EndOffset = 30;
238 Assert.AreEqual(30, testingTarget.EndOffset, "Should be equal!");
240 tlog.Debug(tag, $"ViewAccessibilityAccessibilityRangeEndOffset END (OK)");
245 [Description("ViewAccessibility.AccessibilityRange Content.")]
246 [Property("SPEC", "Tizen.NUI.ViewAccessibility.AccessibilityRange.Content A")]
247 [Property("SPEC_URL", "-")]
248 [Property("CRITERIA", "PRO")]
249 [Property("AUTHOR", "guowei.wang@samsung.com")]
250 public void ViewAccessibilityAccessibilityRangeContent()
252 tlog.Debug(tag, $"ViewAccessibilityAccessibilityRangeContent START");
254 var testingTarget = new AccessibilityRange();
255 Assert.IsNotNull(testingTarget, "Can't create success object AccessibilityRange");
256 Assert.IsInstanceOf<AccessibilityRange>(testingTarget, "Should be an instance of AccessibilityRange type.");
258 testingTarget.Content = "TextLabel";
259 Assert.AreEqual("TextLabel", testingTarget.Content, "Should be equal!");
261 tlog.Debug(tag, $"ViewAccessibilityAccessibilityRangeContent END (OK)");
266 [Description("ViewAccessibility.View.RemoveAccessibilityAttribute.")]
267 [Property("SPEC", "Tizen.NUI.ViewAccessibility.View.RemoveAccessibilityAttribute A")]
268 [Property("SPEC_URL", "-")]
269 [Property("CRITERIA", "PRO")]
270 [Property("AUTHOR", "guowei.wang@samsung.com")]
271 public void ViewAccessibilityViewRemoveAccessibilityAttribute()
273 tlog.Debug(tag, $"ViewAccessibilityViewRemoveAccessibilityAttribute START");
275 var testingTarget = new View();
276 Assert.IsNotNull(testingTarget, "Can't create success object View");
277 Assert.IsInstanceOf<View>(testingTarget, "Should be an instance of View type.");
279 testingTarget.AppendAccessibilityAttribute("MyView", "test");
283 testingTarget.RemoveAccessibilityAttribute("MyView");
287 tlog.Debug(tag, e.Message.ToString());
288 Assert.Fail("Caught Exception: Failed!");
291 tlog.Debug(tag, $"ViewAccessibilityViewRemoveAccessibilityAttribute END (OK)");
296 [Description("ViewAccessibility.View.ClearAccessibilityAttributes.")]
297 [Property("SPEC", "Tizen.NUI.ViewAccessibility.View.ClearAccessibilityAttributes A")]
298 [Property("SPEC_URL", "-")]
299 [Property("CRITERIA", "PRO")]
300 [Property("AUTHOR", "guowei.wang@samsung.com")]
301 public void ViewAccessibilityViewClearAccessibilityAttributes()
303 tlog.Debug(tag, $"ViewAccessibilityViewClearAccessibilityAttributes START");
305 var testingTarget = new View();
306 Assert.IsNotNull(testingTarget, "Can't create success object View");
307 Assert.IsInstanceOf<View>(testingTarget, "Should be an instance of View type.");
309 testingTarget.AppendAccessibilityAttribute("MyView", "test");
313 testingTarget.ClearAccessibilityAttributes();
317 tlog.Debug(tag, e.Message.ToString());
318 Assert.Fail("Caught Exception: Failed!");
321 tlog.Debug(tag, $"ViewAccessibilityViewClearAccessibilityAttributes END (OK)");