4 changed files with 68 additions and 0 deletions
@ -0,0 +1,29 @@ |
|||||
|
using Avalonia.Controls.Primitives; |
||||
|
|
||||
|
namespace Avalonia.Automation.Peers |
||||
|
{ |
||||
|
public class ScrollBarAutomationPeer : RangeBaseAutomationPeer |
||||
|
{ |
||||
|
public ScrollBarAutomationPeer(ScrollBar owner) : base(owner) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
override protected string GetClassNameCore() |
||||
|
{ |
||||
|
return "ScrollBar"; |
||||
|
} |
||||
|
|
||||
|
override protected AutomationControlType GetAutomationControlTypeCore() |
||||
|
{ |
||||
|
return AutomationControlType.ScrollBar; |
||||
|
} |
||||
|
|
||||
|
// AutomationControlType.ScrollBar must return IsContentElement false.
|
||||
|
// See http://msdn.microsoft.com/en-us/library/ms743712.aspx
|
||||
|
override protected bool IsContentElementCore() |
||||
|
{ |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,33 @@ |
|||||
|
using OpenQA.Selenium.Appium; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace Avalonia.IntegrationTests.Appium |
||||
|
{ |
||||
|
[Collection("Default")] |
||||
|
public class ScrollBarTests |
||||
|
{ |
||||
|
private readonly AppiumDriver<AppiumWebElement> _session; |
||||
|
|
||||
|
public ScrollBarTests(DefaultAppFixture fixture) |
||||
|
{ |
||||
|
_session = fixture.Session; |
||||
|
|
||||
|
var tabs = _session.FindElementByAccessibilityId("MainTabs"); |
||||
|
var tab = tabs.FindElementByName("ScrollBarTab"); |
||||
|
tab.Click(); |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public void ScrollBar_Increases_Value_By_LargeChange_When_IncreaseButton_Is_Clicked() |
||||
|
{ |
||||
|
var button = _session.FindElementByAccessibilityId("MyScrollBar"); |
||||
|
Assert.True(double.Parse(button.Text) == 20); |
||||
|
|
||||
|
button.Click(); |
||||
|
|
||||
|
// Default LargeChange value is 10 so when clicking the IncreaseButton
|
||||
|
// ScrollBar value should be increased by 10.
|
||||
|
Assert.Equal(30, double.Parse(button.Text)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue