public void BoundingRectangleNotAllZeros_NotAllZeros() { var e = new MockA11yElement(); e.BoundingRectangle = new Rectangle(0, 0, 0, 1); Assert.AreEqual(Rule.Evaluate(e), EvaluationCode.Pass); }
public void TestNameEmpty() { var e = new MockA11yElement(); e.Name = ""; Assert.AreNotEqual(Rule.Evaluate(e), EvaluationCode.Pass); }
public void HasTablePattern_Pass() { var e = new MockA11yElement(); e.Patterns.Add(new A11yPattern(e, PatternType.UIA_TablePatternId)); Assert.AreEqual(EvaluationCode.Pass, Rule.Evaluate(e)); }
public void TestNameIsReasonableLengthTrue() { using (var e = new MockA11yElement()) { e.Name = "Hello"; Assert.AreEqual(Rule.Evaluate(e), EvaluationCode.Pass); } // using }
public void TestBoundingRectangleNotNullPass() { using (var e = new MockA11yElement()) { e.BoundingRectangle = Rectangle.Empty; Assert.AreEqual(Rule.Evaluate(e), EvaluationCode.Pass); } // using }
public void TestNameExcludesSpecialCharactersTrue() { using (var e = new MockA11yElement()) { e.Name = "Button"; Assert.AreEqual(Rule.Evaluate(e), EvaluationCode.Pass); } // using }
public void TestIsKeyboardFocusableShouldBeTruePass() { using (var e = new MockA11yElement()) { e.IsKeyboardFocusable = true; Assert.AreEqual(EvaluationCode.Pass, Rule.Evaluate(e)); } // using }
public void TestNameIsEmptyButElementIsNotKeyboardFocusablePass() { using (var e = new MockA11yElement()) { e.Name = "Bob"; Assert.AreEqual(EvaluationCode.Pass, Rule.Evaluate(e)); } // using }
public void HasScrollPattern_EvaluateReturnsError() { var e = new MockA11yElement(); e.Patterns.Add(new Core.Bases.A11yPattern(e, PatternType.UIA_ScrollPatternId)); Assert.AreEqual(EvaluationCode.Error, Rule.Evaluate(e)); }
public void LocalizedLandmarkTypeNotCustom_Pass() { using (var e = new MockA11yElement()) { e.LandmarkType = LandmarkType.UIA_CustomLandmarkTypeId; e.LocalizedLandmarkType = "not custom"; Assert.AreEqual(EvaluationCode.Pass, Rule.Evaluate(e)); } // using }
public void NameExcludesControlType_Pass() { var e = new MockA11yElement(); e.Name = "This is a button"; e.ControlTypeId = CheckBox; Assert.AreEqual(EvaluationCode.Pass, Rule.Evaluate(e)); }
public void TestBoundingRectangleOnUWPMenuBarPass() { using (var e = new MockA11yElement()) { e.BoundingRectangle = new Rectangle(0, 0, 2, 2); Assert.AreEqual(EvaluationCode.Pass, Rule.Evaluate(e)); } // using }
public void TestBoundingRectangleDataFormatCorrectPass() { using (var e = new MockA11yElement()) { var p = new A11yProperty(PropertyType.UIA_BoundingRectanglePropertyId, new double[] { 1, 2, 3, 4 }); e.Properties.Add(PropertyType.UIA_BoundingRectanglePropertyId, p); Assert.AreEqual(Rule.Evaluate(e), EvaluationCode.Pass); } // using }
public void IsKeyboardFocusableTrue_LocalizedControlTypeNull_ScanError() { var e = new MockA11yElement(); e.LocalizedControlType = null; e.IsKeyboardFocusable = true; Assert.AreEqual(EvaluationCode.Error, Rule.Evaluate(e)); }
public void IsKeyboardFocusableTrue_LocalizedControlTypeEmpty_ScanError() { var e = new MockA11yElement(); e.LocalizedControlType = ""; e.IsKeyboardFocusable = true; Assert.IsTrue(Rule.Condition.Matches(e)); Assert.AreEqual(EvaluationCode.Error, Rule.Evaluate(e)); }
public void TestBoundingRectangleSizeReasonablePass() { Rectangle rect = new Rectangle(0, 0, 13, 2); using (var e = new MockA11yElement()) { e.BoundingRectangle = rect; Assert.AreEqual(Rule.Evaluate(e), EvaluationCode.Pass); } // using }
public void LocalizedControlTypeIsReasonable_True_MultipleOptions() { var e = new MockA11yElement(); e.ControlTypeId = Hyperlink; e.LocalizedControlType = "hyperlink"; Assert.AreEqual(EvaluationCode.Pass, Rule.Evaluate(e)); e.LocalizedControlType = "link"; Assert.AreEqual(EvaluationCode.Pass, Rule.Evaluate(e)); }
public void TestHeadingLevelDescendsWhenNestedPass() { using (var e = new MockA11yElement()) using (var parent = new MockA11yElement()) { e.HeadingLevel = HeadingLevelType.HeadingLevel2; parent.HeadingLevel = HeadingLevelType.HeadingLevel1; e.Parent = parent; Assert.AreEqual(EvaluationCode.Pass, Rule.Evaluate(e)); }// using }
public void ParentChildHaveSameNameLocalizedControlType_RuleError() { var e = new MockA11yElement(); e.Name = "name"; e.LocalizedControlType = "controltype"; var p = new MockA11yElement(); p.Name = "name"; p.LocalizedControlType = "controltype"; e.Parent = p; Assert.AreEqual(EvaluationCode.Error, Rule.Evaluate(e)); }
public void NameMatchesDotNetType() { using (var e = new MockA11yElement()) { string[] stringsToTry = { "Microsoft.xxx.xxx", "Microsoft.x", "Windows.xxx.xxx", "Windows.abc" }; foreach (var s in stringsToTry) { e.Name = s; Assert.AreNotEqual(Rule.Evaluate(e), EvaluationCode.Pass); } } // using }
public void Scan_TreeControlWithoutTreeItem_ReturnOpen() { var e = new MockA11yElement(); e.ControlTypeId = Core.Types.ControlType.UIA_TreeControlTypeId; e.IsEnabled = true; e.IsOffScreen = false; e.IsKeyboardFocusable = false; e.BoundingRectangle = new System.Drawing.Rectangle(0, 0, 100, 100); Assert.AreEqual(EvaluationCode.Open, Rule.Evaluate(e)); }
public void ElementsMatch_Warning() { var parent = new MockA11yElement(); var child1 = new MockA11yElement(); var child2 = new MockA11yElement(); child1.BoundingRectangle = new Rectangle(0, 0, 25, 25); child2.BoundingRectangle = new Rectangle(0, 0, 25, 25); child1.ControlTypeId = ControlType.ListItem; child2.ControlTypeId = ControlType.ListItem; child1.LocalizedControlType = "ListItem"; child2.LocalizedControlType = "ListItem"; child1.Name = "Alice"; child2.Name = "Alice"; child1.IsKeyboardFocusable = true; child2.IsKeyboardFocusable = true; child1.Parent = parent; child2.Parent = parent; parent.Children.Add(child1); parent.Children.Add(child2); Assert.AreEqual(EvaluationCode.Warning, Rule.Evaluate(child2)); }
public void TestTypeMismatchPass() { var parent = new MockA11yElement(); var child1 = new MockA11yElement(); var child2 = new MockA11yElement(); child1.BoundingRectangle = new Rectangle(0, 0, 25, 25); child2.BoundingRectangle = new Rectangle(0, 0, 25, 25); child1.IsContentElement = true; child2.IsContentElement = true; child1.LocalizedControlType = "MyType1"; child2.LocalizedControlType = "MyType2"; child1.Name = "Alice"; child2.Name = "Alice"; child1.IsKeyboardFocusable = true; child2.IsKeyboardFocusable = true; child1.Parent = parent; child2.Parent = parent; parent.Children.Add(child1); parent.Children.Add(child2); Assert.AreEqual(EvaluationCode.Pass, Rule.Evaluate(child2)); }
public void BoundingRectangleCompletelyObscuresContainer_LeftPass() { var e = new MockA11yElement(); var parent = new MockA11yElement(); e.BoundingRectangle = new Rectangle(ErrorRect.Left + 2, ErrorRect.Top, ErrorRect.Size.Width, ErrorRect.Size.Height); parent.BoundingRectangle = TestRect; e.Parent = parent; Assert.IsTrue(Rule.Condition.Matches(e)); Assert.AreEqual(EvaluationCode.Pass, Rule.Evaluate(e)); }
public void NameExcludesLocalizedControlType_Pass() { var e = new MockA11yElement(); e.Name = "This is a button"; e.LocalizedControlType = "Checkbox"; Assert.AreEqual(EvaluationCode.Pass, Rule.Evaluate(e)); }
public void TestBoundingRectangleContainedInParentPass() { using (var e = new MockA11yElement()) using (var parent = new MockA11yElement()) { e.BoundingRectangle = new Rectangle(300, 300, 500, 500); parent.BoundingRectangle = new Rectangle( e.BoundingRectangle.Left + Margin, e.BoundingRectangle.Top + Margin, e.BoundingRectangle.Width - (Margin * 2), e.BoundingRectangle.Height - (Margin * 2)); e.Parent = parent; Assert.AreEqual(Rule.Evaluate(e), EvaluationCode.Pass); }// using }
public void TestBoundingRectangleNotValidButOffScreenInformation() { Assert.AreEqual(Rule.Evaluate(null), EvaluationCode.Note); }