Hello GitHub
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using Etw.Managed;
|
||||
using MS.Internal.Mita.Foundation;
|
||||
|
||||
namespace Calculator.UIAutomationLibrary.Components
|
||||
{
|
||||
public class HistoryLfm : ICanFocusWithClicks
|
||||
{
|
||||
public HistoryLfm(HistoryPom historyPom)
|
||||
{
|
||||
this.ObjectModel = historyPom;
|
||||
}
|
||||
|
||||
public HistoryPom ObjectModel { get; }
|
||||
|
||||
public void FocusWithClicks()
|
||||
{
|
||||
// On the Programming calc, the default click location can land on the first memory item, dismissing the flyout.
|
||||
// Instead, click just below, in the gutter to the left of the trash can.
|
||||
var body = this.ObjectModel.Body;
|
||||
int height = body.BoundingRectangle.Height;
|
||||
body.DoubleClick(PointerButtons.Primary, Constants.ClickMargin, height + Constants.ClickMargin);
|
||||
}
|
||||
|
||||
public void OpenBody()
|
||||
{
|
||||
using (EtwWaiter waiter = new EtwWaiter(Constants.CalculatorETWProviderGUID, Constants.HistoryBodyOpenedETWEventName))
|
||||
{
|
||||
// Only one exists at a given time.
|
||||
if (this.ObjectModel.IsHistoryButtonVisible)
|
||||
{
|
||||
if (!this.ObjectModel.IsBodyOpen)
|
||||
{
|
||||
this.ObjectModel.HistoryButton.Invoke();
|
||||
waiter.Wait();
|
||||
}
|
||||
}
|
||||
else if (!this.ObjectModel.HistoryPivot.IsSelected)
|
||||
{
|
||||
this.ObjectModel.HistoryPivot.Click();
|
||||
waiter.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using MS.Internal.Mita.Foundation;
|
||||
using MS.Internal.Mita.Foundation.Controls;
|
||||
|
||||
namespace Calculator.UIAutomationLibrary.Components
|
||||
{
|
||||
public class HistoryPom : UIObject
|
||||
{
|
||||
private const string HistoryButtonId = "HistoryButton";
|
||||
private const string HistoryPivotId = "HistoryLabel";
|
||||
private const string BodyId = "HistoryListView";
|
||||
|
||||
public HistoryPom(UIObject uiObject) : base(uiObject)
|
||||
{
|
||||
}
|
||||
|
||||
public Button HistoryButton => new Button(this.Descendants.Find(HistoryButtonId));
|
||||
|
||||
public bool IsHistoryButtonVisible => this.DoesDescendantExist(HistoryButtonId);
|
||||
|
||||
public TabItem HistoryPivot => new TabItem(this.Descendants.Find(HistoryPivotId));
|
||||
|
||||
public UIObject Body => this.Descendants.Find(BodyId);
|
||||
|
||||
public bool IsBodyOpen => this.DoesDescendantExist(BodyId);
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace Calculator.UIAutomationLibrary.Components
|
||||
{
|
||||
public interface ICanFocusWithClicks
|
||||
{
|
||||
/// <summary>
|
||||
/// Sets focus on an object by clicking on it, without causing further action.
|
||||
/// Supports AccSpot scans by raising click events.
|
||||
/// </summary>
|
||||
void FocusWithClicks();
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,51 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using Etw.Managed;
|
||||
using MS.Internal.Mita.Foundation;
|
||||
using MS.Internal.Mita.Foundation.Waiters;
|
||||
using WEX.Logging.Interop;
|
||||
|
||||
namespace Calculator.UIAutomationLibrary.Components
|
||||
{
|
||||
public class MemoryLfm : ICanFocusWithClicks
|
||||
{
|
||||
public MemoryLfm(MemoryPom memoryPom)
|
||||
{
|
||||
this.ObjectModel = memoryPom;
|
||||
}
|
||||
|
||||
public MemoryPom ObjectModel { get; }
|
||||
|
||||
public void FocusWithClicks()
|
||||
{
|
||||
// On the Programming calc, the default click location can land on the first memory item, dismissing the flyout.
|
||||
// Instead, click just below, in the gutter to the left of the trash can.
|
||||
var body = this.ObjectModel.Body;
|
||||
int height = body.BoundingRectangle.Height;
|
||||
body.DoubleClick(PointerButtons.Primary, Constants.ClickMargin, height + Constants.ClickMargin);
|
||||
}
|
||||
|
||||
public void OpenBody()
|
||||
{
|
||||
using (EtwWaiter waiter = new EtwWaiter(Constants.CalculatorETWProviderGUID, Constants.MemoryBodyOpenedETWEventName))
|
||||
{
|
||||
// Only one exists at a given time
|
||||
if (this.ObjectModel.IsMemoryButtonVisible)
|
||||
{
|
||||
if (!this.ObjectModel.IsBodyOpen)
|
||||
{
|
||||
this.ObjectModel.MemoryButton.Invoke();
|
||||
waiter.Wait();
|
||||
}
|
||||
}
|
||||
else if (!this.ObjectModel.MemoryPivot.IsSelected)
|
||||
{
|
||||
this.ObjectModel.MemoryPivot.Click();
|
||||
waiter.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using MS.Internal.Mita.Foundation;
|
||||
using MS.Internal.Mita.Foundation.Controls;
|
||||
|
||||
namespace Calculator.UIAutomationLibrary.Components
|
||||
{
|
||||
public class MemoryPom : UIObject
|
||||
{
|
||||
private const string ClearMemoryButtonId = "ClearMemoryButton";
|
||||
private const string RecallButtonId = "MemRecall";
|
||||
private const string PlusButtonId = "MemPlus";
|
||||
private const string MinusButtonId = "MemMinus";
|
||||
private const string SetButtonId = "memButton";
|
||||
private const string MemoryButtonId = "MemoryButton";
|
||||
private const string MemoryPivotId = "MemoryLabel";
|
||||
private const string BodyId = "MemoryListView";
|
||||
|
||||
public MemoryPom(UIObject uiObject) : base(uiObject)
|
||||
{
|
||||
}
|
||||
|
||||
public Button ClearButton => new Button(this.Descendants.Find(ClearMemoryButtonId));
|
||||
|
||||
public Button RecallButton => new Button(this.Descendants.Find(RecallButtonId));
|
||||
|
||||
public Button PlusButton => new Button(this.Descendants.Find(PlusButtonId));
|
||||
|
||||
public Button MinusButton => new Button(this.Descendants.Find(MinusButtonId));
|
||||
|
||||
public Button SetButton => new Button(this.Descendants.Find(SetButtonId));
|
||||
|
||||
public Button MemoryButton => new Button(this.Descendants.Find(MemoryButtonId));
|
||||
|
||||
public bool IsMemoryButtonVisible => this.DoesDescendantExist(MemoryButtonId);
|
||||
|
||||
public TabItem MemoryPivot => new TabItem(this.Descendants.Find(MemoryPivotId));
|
||||
|
||||
public UIObject Body => this.Descendants.Find(BodyId);
|
||||
|
||||
public bool IsBodyOpen => this.DoesDescendantExist(BodyId);
|
||||
}
|
||||
}
|
@@ -0,0 +1,49 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using MS.Internal.Mita.Foundation;
|
||||
using MS.Internal.Mita.Foundation.Controls;
|
||||
|
||||
namespace Calculator.UIAutomationLibrary.Components
|
||||
{
|
||||
public class NumberPadPom : UIObject
|
||||
{
|
||||
private const string OneButtonId = "num1Button";
|
||||
private const string TwoButtonId = "num2Button";
|
||||
private const string ThreeButtonId = "num3Button";
|
||||
private const string FourButtonId = "num4Button";
|
||||
private const string FiveButtonId = "num5Button";
|
||||
private const string SixButtonId = "num6Button";
|
||||
private const string SevenButtonId = "num7Button";
|
||||
private const string EightButtonId = "num8Button";
|
||||
private const string NineButtonId = "num9Button";
|
||||
private const string ZeroButtonId = "num0Button";
|
||||
private const string DecimalButtonId = "decimalSeparatorButton";
|
||||
|
||||
public NumberPadPom(UIObject uiObject) : base(uiObject)
|
||||
{
|
||||
}
|
||||
|
||||
public Button ZeroButton => new Button(this.Children.Find(ZeroButtonId));
|
||||
|
||||
public Button OneButton => new Button(this.Children.Find(OneButtonId));
|
||||
|
||||
public Button TwoButton => new Button(this.Children.Find(TwoButtonId));
|
||||
|
||||
public Button ThreeButton => new Button(this.Children.Find(ThreeButtonId));
|
||||
|
||||
public Button FourButton => new Button(this.Children.Find(FourButtonId));
|
||||
|
||||
public Button FiveButton => new Button(this.Children.Find(FiveButtonId));
|
||||
|
||||
public Button SixButton => new Button(this.Children.Find(SixButtonId));
|
||||
|
||||
public Button SevenButton => new Button(this.Children.Find(SevenButtonId));
|
||||
|
||||
public Button EightButton => new Button(this.Children.Find(EightButtonId));
|
||||
|
||||
public Button NineButton => new Button(this.Children.Find(NineButtonId));
|
||||
|
||||
public Button DecimalButton => new Button(this.Children.Find(DecimalButtonId));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user