mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +02:00
Light Switch: Updating UI tests (#42225)
Updating UI tests to match new UI
This commit is contained in:
@@ -8,6 +8,7 @@ using System.Globalization;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Automation;
|
||||
using Microsoft.UI.Xaml.Automation.Peers;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Shapes;
|
||||
using Windows.Foundation;
|
||||
@@ -79,6 +80,11 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
this.IsEnabledChanged += Timeline_IsEnabledChanged;
|
||||
}
|
||||
|
||||
protected override AutomationPeer OnCreateAutomationPeer()
|
||||
{
|
||||
return new TimelineAutomationPeer(this);
|
||||
}
|
||||
|
||||
private void Timeline_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CheckEnabledState();
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Automation;
|
||||
using Microsoft.UI.Xaml.Automation.Peers;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
{
|
||||
public partial class TimelineAutomationPeer : FrameworkElementAutomationPeer
|
||||
{
|
||||
public TimelineAutomationPeer(Timeline owner)
|
||||
: base(owner)
|
||||
{
|
||||
}
|
||||
|
||||
protected override string GetClassNameCore() => "Timeline";
|
||||
|
||||
protected override AutomationControlType GetAutomationControlTypeCore()
|
||||
=> AutomationControlType.Custom;
|
||||
|
||||
protected override string GetAutomationIdCore()
|
||||
{
|
||||
var owner = (Timeline)Owner;
|
||||
var id = AutomationProperties.GetAutomationId(owner);
|
||||
return string.IsNullOrEmpty(id) ? base.GetAutomationIdCore() : id;
|
||||
}
|
||||
|
||||
protected override string GetNameCore()
|
||||
{
|
||||
var owner = (Timeline)Owner;
|
||||
var name = AutomationProperties.GetName(owner);
|
||||
return !string.IsNullOrEmpty(name)
|
||||
? name
|
||||
: $"Timeline from {owner.StartTime} to {owner.EndTime}";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user