Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 24 additions & 33 deletions sources/EncodingChecker.GuiSmoke/EcGuiDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -696,9 +696,30 @@ private static string Safely(Func<string> describe, string whenItFails)
}
}

private AutomationElement? FindReviewWindow() =>
FindProcessElementById("ConversionConfirmationForm") ??
FindProcessElementByTitle("Review conversion");
/// <summary>The conversion review, if EC currently has one open.</summary>
/// <remarks>
/// The review is an immediate child of the main window, so it is looked for there.
/// Searching the desktop instead means repeatedly walking unrelated applications, on
/// every poll of several waits.
///
/// Automation errors are deliberately not caught: returning null for one would say
/// the review is absent when the truth is that nothing could be read, and the waits
/// that call this already retry and keep the error.
/// </remarks>
private AutomationElement? FindReviewWindow()
{
var condition = new AndCondition(
new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Window),
new OrCondition(
new PropertyCondition(
AutomationElement.AutomationIdProperty,
"ConversionConfirmationForm"),
new PropertyCondition(
AutomationElement.NameProperty,
"Review conversion")));

return MainWindow.FindFirst(TreeScope.Children, condition);
}

private int ResultCount() =>
FindById(MainWindow, "lstResults") is AutomationElement list
Expand Down Expand Up @@ -893,36 +914,6 @@ private AutomationElement RequireById(
return AutomationElement.RootElement.FindFirst(TreeScope.Children, condition);
}

private AutomationElement? FindProcessElementById(string automationId)
{
var condition = new AndCondition(
new PropertyCondition(
AutomationElement.ProcessIdProperty,
_process.Id),
new PropertyCondition(
AutomationElement.AutomationIdProperty,
automationId));

return AutomationElement.RootElement.FindFirst(
TreeScope.Descendants,
condition);
}

private AutomationElement? FindProcessElementByTitle(string title)
{
var condition = new AndCondition(
new PropertyCondition(
AutomationElement.ProcessIdProperty,
_process.Id),
new PropertyCondition(
AutomationElement.NameProperty,
title));

return AutomationElement.RootElement.FindFirst(
TreeScope.Descendants,
condition);
}

private AutomationElement? FindProcessWindowByTitle(string title)
{
var condition = new AndCondition(
Expand Down
Loading