public void ClearsStateCorrectly() { var mainButton = new Button(); AutomationProperties.SetLandmarkType(mainButton, AutomationLandmarkType.Main); var mainPeer = FrameworkElementAutomationPeer.CreatePeerForElement(mainButton); var rule = new LandmarkTypeMainOnceRule(); Assert.IsTrue(rule.IsValid(mainButton, mainPeer)); Assert.IsFalse(rule.IsValid(mainButton, mainPeer)); rule.ResetState(); Assert.IsTrue(rule.IsValid(mainButton, mainPeer)); }
public void VerifyTreeComplyBehavior() { var noMainPeer = FrameworkElementAutomationPeer.CreatePeerForElement(new Button()); var mainButton = new Button(); AutomationProperties.SetLandmarkType(mainButton, AutomationLandmarkType.Main); var mainPeer = FrameworkElementAutomationPeer.CreatePeerForElement(mainButton); var rule = new LandmarkTypeMainOnceRule(); Assert.IsTrue(rule.IsValid(null, noMainPeer)); Assert.IsTrue(rule.IsValid(null, mainPeer)); for (int i = 0; i < 10; i++) { Assert.IsTrue(rule.IsValid(null, noMainPeer)); } }
public void ClearsStateCorrectly() { var mainButton = new Button(); AutomationProperties.SetLandmarkType(mainButton, AutomationLandmarkType.Main); var analyzer = new AccessibilityAnalyzer(); analyzer.AccessibilityRules.Clear(); analyzer.AccessibilityRules.Add(new LandmarkTypeMainOnceRule()); analyzer.Analyze(mainButton); analyzer.Analyze(mainButton); Assert.IsTrue(IsMarkedProblematic(mainButton)); mainButton = new Button(); AutomationProperties.SetLandmarkType(mainButton, AutomationLandmarkType.Main); Assert.IsFalse(IsMarkedProblematic(mainButton)); analyzer.ResetState(); analyzer.Analyze(mainButton); Assert.IsFalse(IsMarkedProblematic(mainButton)); }
public void VerifyFailingTreeFails() { var noMainPeer = FrameworkElementAutomationPeer.CreatePeerForElement(new Button()); var mainButton = new Button(); AutomationProperties.SetLandmarkType(mainButton, AutomationLandmarkType.Main); var mainPeer = FrameworkElementAutomationPeer.CreatePeerForElement(mainButton); var rule = new LandmarkTypeMainOnceRule(); Assert.IsTrue(rule.IsValid(null, noMainPeer)); Assert.IsTrue(rule.IsValid(null, mainPeer)); Assert.IsTrue(rule.IsValid(null, noMainPeer)); Assert.IsFalse(rule.IsValid(null, mainPeer)); Assert.IsTrue(rule.IsValid(null, noMainPeer)); var stackPanel = new StackPanel(); AutomationProperties.SetLandmarkType(stackPanel, AutomationLandmarkType.Main); }