committed by
GitHub
16 changed files with 205 additions and 83 deletions
@ -0,0 +1,27 @@ |
|||||
|
namespace Avalonia.Layout; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Provides access to layout information of a control.
|
||||
|
/// </summary>
|
||||
|
public static class LayoutInformation |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Gets the available size constraint passed in the previous layout pass.
|
||||
|
/// </summary>
|
||||
|
/// <param name="control">The control.</param>
|
||||
|
/// <returns>Previous control measure constraint, if any.</returns>
|
||||
|
public static Size? GetPreviousMeasureConstraint(Layoutable control) |
||||
|
{ |
||||
|
return control.PreviousMeasure; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the control bounds used in the previous layout arrange pass.
|
||||
|
/// </summary>
|
||||
|
/// <param name="control">The control.</param>
|
||||
|
/// <returns>Previous control arrange bounds, if any.</returns>
|
||||
|
public static Rect? GetPreviousArrangeBounds(Layoutable control) |
||||
|
{ |
||||
|
return control.PreviousArrange; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
using Avalonia.Automation.Peers; |
||||
|
|
||||
|
namespace Avalonia.Controls.Automation.Peers |
||||
|
{ |
||||
|
public class SliderAutomationPeer : RangeBaseAutomationPeer |
||||
|
{ |
||||
|
public SliderAutomationPeer(Slider owner) : base(owner) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
override protected string GetClassNameCore() |
||||
|
{ |
||||
|
return "Slider"; |
||||
|
} |
||||
|
|
||||
|
override protected AutomationControlType GetAutomationControlTypeCore() |
||||
|
{ |
||||
|
return AutomationControlType.Slider; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
using System; |
||||
|
using OpenQA.Selenium.Appium; |
||||
|
using OpenQA.Selenium.Interactions; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace Avalonia.IntegrationTests.Appium |
||||
|
{ |
||||
|
[Collection("Default")] |
||||
|
public class SliderTests |
||||
|
{ |
||||
|
private readonly AppiumDriver<AppiumWebElement> _session; |
||||
|
|
||||
|
public SliderTests(TestAppFixture fixture) |
||||
|
{ |
||||
|
_session = fixture.Session; |
||||
|
|
||||
|
var tabs = _session.FindElementByAccessibilityId("MainTabs"); |
||||
|
var tab = tabs.FindElementByName("SliderTab"); |
||||
|
tab.Click(); |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public void Changes_Value_When_Clicking_Increase_Button() |
||||
|
{ |
||||
|
var slider = _session.FindElementByAccessibilityId("Slider"); |
||||
|
|
||||
|
// slider.Text gets the Slider value
|
||||
|
Assert.True(double.Parse(slider.Text) == 30); |
||||
|
|
||||
|
new Actions(_session).Click(slider).Perform(); |
||||
|
|
||||
|
Assert.Equal(50, Math.Round(double.Parse(slider.Text))); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
After Width: | Height: | Size: 694 B |
|
Before Width: | Height: | Size: 673 B After Width: | Height: | Size: 673 B |
|
After Width: | Height: | Size: 694 B |
|
Before Width: | Height: | Size: 673 B After Width: | Height: | Size: 673 B |
Loading…
Reference in new issue