2019-12-26 15:32:37 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
Copying //UE4/Portal-Staging to //UE4/Dev-Main (Source: //Portal/Main @ 3216504)
#lockdown Nick.Penwarden
#rb no one
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3216141 on 2016/11/30 by Justin.Sargent
Completed first ready to use pass of the new AutomationDriver module and new Spec test type.
Change 3213288 on 2016/11/29 by Leigh.Swift
#jira OPP-6353: CEF FName Javascript PROBLEM
Removing deprecation of IWebBrowserSingleton::SetJSBindingToLoweringEnabled for now.
Change 3212796 on 2016/11/29 by Leigh.Swift
#jira OPP-6353: CEF FName Javascript PROBLEM
Added SetJSBindingToLoweringEnabled to IWebBrowserSingleton so that the to-lowering of binding names can be disabled.
Deprecated SetJSBindingToLoweringEnabled since 4.15. In future the to-lowering will always occurr.
Adding GetBindingName helper to FWebJSScripting, which returns a to-lowered name for a UField, unless disabled.
Updated all current binding code to use GetBindingName when building from UObjects/UStructs. This affects Windows, Mac, Linux, and Android.
Portal currently disables to-lowering unless a commandline -LowercaseJS is provided.
Change 3200370 on 2016/11/16 by Richard.Fawcett
Ensure we always get the latest version of the user content catalog when promoting marketplace items.
Change 3192974 on 2016/11/10 by Leigh.Swift
#jira OPP-6365: Crash during shutdown if a manifest is still being downloaded
This is because of the OnPreExit core delegate being used to null out the Data uobject member on a manifest, also being the only sensible way to ensure threads complete in a safe and clean manner.
Refactoring BuildPatchServices manifest class to not permanently hold any UObject and simply just use one while serialising.
This removes the reliance on the OnPreExit delegate from manifest class, making it generally safer behaviour for shutdown.
Change 3187028 on 2016/11/04 by Leigh.Swift
PortalPublishingTool: Adding UE_Main app to UnrealEngine project
Change 3186788 on 2016/11/04 by Richard.Fawcett
Change C# wrapper for BuildPatchTool patch generation to prevent clobbering manifest files by default, unless we specifically pass in an optional flag to allow this.
#jira OPP-6355
Change 3186779 on 2016/11/04 by Richard.Fawcett
Add support to automation tool testing framework for the following assertions:
Assert.AreNotEqual(a, b, optionalFailureMessage)
Assert.ThrowsError(actionToCarryOut, expectedExceptionType, optionalExceptionMessageContainsString)
Moved attribute-based expected exception declarations to their own attribute, TestThrowsExceptionAttribute, which can now accept an optional parameter for a string which should be contained within the exception message.
Fixed a bug where a test method with an attribute-based expected exception would not count towards the success total if the exception was encountered as expected.
Fixed a bug where NOT throwing an exception when we were expecting one would count as a success.
Added an internal property bDoNotLogTestFailsAsError which we can set to true to suppress logging of UAT errors when a test fails (but still count them in our failure results), to allow us to deliberately cause test failures to test the test framework!
Added a suite of unit tests for the test framework itself, in TestRunner.Automation.Tests.cs.
Change 3185411 on 2016/11/03 by Richard.Fawcett
Allow Rocket_PromoteBuild changelist to be overridden by a changelist read from a file.
Change 3184843 on 2016/11/03 by Richard.Fawcett
Ensure catalog file synced during user content generation is always the latest one.
Change 3184752 on 2016/11/03 by Richard.Fawcett
Ensure we log reading changelist from specified file.
Change 3184744 on 2016/11/03 by Richard.Fawcett
Ensure directory is created for Changelist file if it doesn't already exist.
Change 3184738 on 2016/11/03 by Richard.Fawcett
Ensure we use latest CL from all of Perforce when generating build versions for user content
Because of the nature of the build farm, where separate parts of the job are executed on different build agents at different times, this changelist is serialized to the filesystem during execution of a node dedicated to this task, and then made available to all future nodes, so that they're working with a consistent build version. In the case of an execution where we're updating Perforce with new content, this calculation of the changelist occurs AFTER we've updated Perforce with the new content.
Have also optimized the build graph scripts to enable Mac and Windows user generated content to execute simultaneously.
#jira OPP-6274
Change 3181456 on 2016/11/01 by Andrew.Brown
SExpandable area has been modified as the Portal settings mocks weren't able to be achieved with default functionality.
Added BodyBorderImage arguement and BodyBorderBackgroundColor attribute so we can specify a different brush/color to use for the expanded area compared with the title area. Additional care was made to ensure that rounded corners still appear correctly if the developer doesn't want to specify a different look to the body.
Added AreaTitlePadding attribute, to be able to specify padding between the expand/collapse icon and the header content.
Added MinWidth arguement, to ensure that the areas meet a minimum width requirement.
Change 3181285 on 2016/11/01 by Richard.Fawcett
Ensure user content generated using latest changelist submitted to Perforce, rather than using portal's latest changelist
#jira OPP-6274
Change 3177758 on 2016/10/28 by Leigh.Swift
#jira OPP-6247: Portal needs Social Plugin integration v1.2
Copying //Portal/Dev-Social to Dev-Main (//Portal/Dev-Main)
Change 3175889 on 2016/10/26 by Wes.Fudala
Web browser tooltips will no longer continue to appear when the mouse leaves the browser window.
#jira: OPP-5895 The Mouseover info in Recent Additions (Marketplace) anchors itself to the mouse pointer over other Browser windows
rb: Justin.Sargent
Change 3171388 on 2016/10/22 by Leigh.Swift
#jira OPP-6343: Launcher crashes patching from 2.12.13 Main to 2.12.13 Release-Live
BPS: FBuildPatchAppManifest needs to listen for FCoreDelegates::OnPreExit in order to clean up references to it's UObject which is about to be destroyed.
Change 3170373 on 2016/10/21 by Leigh.Swift
#jira: OPP-6340: Portal builds fail on audit nodes.
Reducing platform regex to only match pre-defined possibilities.
[CL 3219291 by Justin Sargent in Main branch]
2016-12-02 13:27:02 -05:00
|
|
|
|
|
|
|
|
#include "WaitUntil.h"
|
|
|
|
|
#include "IApplicationElement.h"
|
|
|
|
|
#include "IElementLocator.h"
|
|
|
|
|
#include "Misc/Timespan.h"
|
|
|
|
|
|
|
|
|
|
FDriverWaitResponse FDriverWaitResponse::Passed()
|
|
|
|
|
{
|
|
|
|
|
return FDriverWaitResponse(FDriverWaitResponse::EState::PASSED, FTimespan::Zero());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDriverWaitResponse FDriverWaitResponse::Wait()
|
|
|
|
|
{
|
|
|
|
|
return FDriverWaitResponse(FDriverWaitResponse::EState::WAIT, FTimespan::FromSeconds(0.5));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDriverWaitResponse FDriverWaitResponse::Wait(FTimespan Timespan)
|
|
|
|
|
{
|
|
|
|
|
return FDriverWaitResponse(FDriverWaitResponse::EState::WAIT, MoveTemp(Timespan));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDriverWaitResponse FDriverWaitResponse::Failed()
|
|
|
|
|
{
|
|
|
|
|
return FDriverWaitResponse(FDriverWaitResponse::EState::FAILED, FTimespan::Zero());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDriverWaitResponse::FDriverWaitResponse(EState InState, FTimespan InNextWait)
|
|
|
|
|
: NextWait(MoveTemp(InNextWait))
|
|
|
|
|
, State(InState)
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
FWaitTimeout::FWaitTimeout(FTimespan InTimespan)
|
|
|
|
|
: Timespan(MoveTemp(InTimespan))
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
FWaitTimeout FWaitTimeout::InMilliseconds(double Value)
|
|
|
|
|
{
|
|
|
|
|
return FWaitTimeout(FTimespan::FromMilliseconds(Value));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FWaitTimeout FWaitTimeout::InSeconds(double Value)
|
|
|
|
|
{
|
|
|
|
|
return FWaitTimeout(FTimespan::FromSeconds(Value));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FWaitTimeout FWaitTimeout::InMinutes(double Value)
|
|
|
|
|
{
|
|
|
|
|
return FWaitTimeout(FTimespan::FromMinutes(Value));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FWaitTimeout FWaitTimeout::InHours(double Value)
|
|
|
|
|
{
|
|
|
|
|
return FWaitTimeout(FTimespan::FromHours(Value));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FWaitInterval::FWaitInterval(FTimespan InTimespan)
|
|
|
|
|
: Timespan(MoveTemp(InTimespan))
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
FWaitInterval FWaitInterval::InMilliseconds(double Value)
|
|
|
|
|
{
|
|
|
|
|
return FWaitInterval(FTimespan::FromMilliseconds(Value));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FWaitInterval FWaitInterval::InSeconds(double Value)
|
|
|
|
|
{
|
|
|
|
|
return FWaitInterval(FTimespan::FromSeconds(Value));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FWaitInterval FWaitInterval::InMinutes(double Value)
|
|
|
|
|
{
|
|
|
|
|
return FWaitInterval(FTimespan::FromMinutes(Value));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FWaitInterval FWaitInterval::InHours(double Value)
|
|
|
|
|
{
|
|
|
|
|
return FWaitInterval(FTimespan::FromHours(Value));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDriverWaitDelegate Until::ElementExists(const TSharedRef<IElementLocator, ESPMode::ThreadSafe>& ElementLocator, FWaitTimeout Timeout)
|
|
|
|
|
{
|
|
|
|
|
return Until::ElementExists(ElementLocator, FWaitInterval::InSeconds(1.0), Timeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDriverWaitDelegate Until::ElementExists(const TSharedRef<IElementLocator, ESPMode::ThreadSafe>& ElementLocator, FWaitInterval Interval, FWaitTimeout Timeout)
|
|
|
|
|
{
|
|
|
|
|
return Until::Lambda([ElementLocator, Interval, Timeout](const FTimespan& TotalWaitTime){
|
|
|
|
|
check(IsInGameThread());
|
|
|
|
|
|
|
|
|
|
TArray<TSharedRef<IApplicationElement>> Elements;
|
|
|
|
|
ElementLocator->Locate(Elements);
|
|
|
|
|
|
|
|
|
|
if (Elements.Num() == 0)
|
|
|
|
|
{
|
|
|
|
|
if (TotalWaitTime > Timeout.Timespan)
|
|
|
|
|
{
|
|
|
|
|
return FDriverWaitResponse::Failed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FDriverWaitResponse::Wait(Interval.Timespan);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FDriverWaitResponse::Passed();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDriverWaitDelegate Until::ElementIsVisible(const TSharedRef<IElementLocator, ESPMode::ThreadSafe>& ElementLocator, FWaitTimeout Timeout)
|
|
|
|
|
{
|
|
|
|
|
return Until::ElementIsVisible(ElementLocator, FWaitInterval::InSeconds(1.0), Timeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDriverWaitDelegate Until::ElementIsVisible(const TSharedRef<IElementLocator, ESPMode::ThreadSafe>& ElementLocator, FWaitInterval Interval, FWaitTimeout Timeout)
|
|
|
|
|
{
|
|
|
|
|
return Until::Lambda([ElementLocator, Interval, Timeout](const FTimespan& TotalWaitTime) {
|
|
|
|
|
check(IsInGameThread());
|
|
|
|
|
|
|
|
|
|
TArray<TSharedRef<IApplicationElement>> Elements;
|
|
|
|
|
ElementLocator->Locate(Elements);
|
|
|
|
|
|
|
|
|
|
if (Elements.Num() == 0)
|
|
|
|
|
{
|
|
|
|
|
if (TotalWaitTime > Timeout.Timespan)
|
|
|
|
|
{
|
|
|
|
|
return FDriverWaitResponse::Failed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FDriverWaitResponse::Wait(Interval.Timespan);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (TSharedRef<IApplicationElement> Element : Elements)
|
|
|
|
|
{
|
|
|
|
|
if (!Element->IsVisible())
|
|
|
|
|
{
|
|
|
|
|
if (TotalWaitTime > Timeout.Timespan)
|
|
|
|
|
{
|
|
|
|
|
return FDriverWaitResponse::Failed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FDriverWaitResponse::Wait(Interval.Timespan);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FDriverWaitResponse::Passed();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-12 09:53:42 -04:00
|
|
|
FDriverWaitDelegate Until::ElementIsHidden(const TSharedRef<IElementLocator, ESPMode::ThreadSafe>& ElementLocator, FWaitTimeout Timeout)
|
|
|
|
|
{
|
|
|
|
|
return Until::ElementIsHidden(ElementLocator, FWaitInterval::InSeconds(1.0), Timeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDriverWaitDelegate Until::ElementIsHidden(const TSharedRef<IElementLocator, ESPMode::ThreadSafe>& ElementLocator, FWaitInterval Interval, FWaitTimeout Timeout)
|
|
|
|
|
{
|
|
|
|
|
return Until::Lambda([ElementLocator, Interval, Timeout](const FTimespan& TotalWaitTime) {
|
|
|
|
|
check(IsInGameThread());
|
|
|
|
|
|
|
|
|
|
TArray<TSharedRef<IApplicationElement>> Elements;
|
|
|
|
|
ElementLocator->Locate(Elements);
|
|
|
|
|
|
|
|
|
|
if (Elements.Num() == 0)
|
|
|
|
|
{
|
|
|
|
|
if (TotalWaitTime > Timeout.Timespan)
|
|
|
|
|
{
|
|
|
|
|
return FDriverWaitResponse::Failed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FDriverWaitResponse::Wait(Interval.Timespan);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (TSharedRef<IApplicationElement> Element : Elements)
|
|
|
|
|
{
|
|
|
|
|
if (Element->IsVisible())
|
|
|
|
|
{
|
|
|
|
|
if (TotalWaitTime > Timeout.Timespan)
|
|
|
|
|
{
|
|
|
|
|
return FDriverWaitResponse::Failed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FDriverWaitResponse::Wait(Interval.Timespan);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FDriverWaitResponse::Passed();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
Copying //UE4/Portal-Staging to //UE4/Dev-Main (Source: //Portal/Main @ 3216504)
#lockdown Nick.Penwarden
#rb no one
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3216141 on 2016/11/30 by Justin.Sargent
Completed first ready to use pass of the new AutomationDriver module and new Spec test type.
Change 3213288 on 2016/11/29 by Leigh.Swift
#jira OPP-6353: CEF FName Javascript PROBLEM
Removing deprecation of IWebBrowserSingleton::SetJSBindingToLoweringEnabled for now.
Change 3212796 on 2016/11/29 by Leigh.Swift
#jira OPP-6353: CEF FName Javascript PROBLEM
Added SetJSBindingToLoweringEnabled to IWebBrowserSingleton so that the to-lowering of binding names can be disabled.
Deprecated SetJSBindingToLoweringEnabled since 4.15. In future the to-lowering will always occurr.
Adding GetBindingName helper to FWebJSScripting, which returns a to-lowered name for a UField, unless disabled.
Updated all current binding code to use GetBindingName when building from UObjects/UStructs. This affects Windows, Mac, Linux, and Android.
Portal currently disables to-lowering unless a commandline -LowercaseJS is provided.
Change 3200370 on 2016/11/16 by Richard.Fawcett
Ensure we always get the latest version of the user content catalog when promoting marketplace items.
Change 3192974 on 2016/11/10 by Leigh.Swift
#jira OPP-6365: Crash during shutdown if a manifest is still being downloaded
This is because of the OnPreExit core delegate being used to null out the Data uobject member on a manifest, also being the only sensible way to ensure threads complete in a safe and clean manner.
Refactoring BuildPatchServices manifest class to not permanently hold any UObject and simply just use one while serialising.
This removes the reliance on the OnPreExit delegate from manifest class, making it generally safer behaviour for shutdown.
Change 3187028 on 2016/11/04 by Leigh.Swift
PortalPublishingTool: Adding UE_Main app to UnrealEngine project
Change 3186788 on 2016/11/04 by Richard.Fawcett
Change C# wrapper for BuildPatchTool patch generation to prevent clobbering manifest files by default, unless we specifically pass in an optional flag to allow this.
#jira OPP-6355
Change 3186779 on 2016/11/04 by Richard.Fawcett
Add support to automation tool testing framework for the following assertions:
Assert.AreNotEqual(a, b, optionalFailureMessage)
Assert.ThrowsError(actionToCarryOut, expectedExceptionType, optionalExceptionMessageContainsString)
Moved attribute-based expected exception declarations to their own attribute, TestThrowsExceptionAttribute, which can now accept an optional parameter for a string which should be contained within the exception message.
Fixed a bug where a test method with an attribute-based expected exception would not count towards the success total if the exception was encountered as expected.
Fixed a bug where NOT throwing an exception when we were expecting one would count as a success.
Added an internal property bDoNotLogTestFailsAsError which we can set to true to suppress logging of UAT errors when a test fails (but still count them in our failure results), to allow us to deliberately cause test failures to test the test framework!
Added a suite of unit tests for the test framework itself, in TestRunner.Automation.Tests.cs.
Change 3185411 on 2016/11/03 by Richard.Fawcett
Allow Rocket_PromoteBuild changelist to be overridden by a changelist read from a file.
Change 3184843 on 2016/11/03 by Richard.Fawcett
Ensure catalog file synced during user content generation is always the latest one.
Change 3184752 on 2016/11/03 by Richard.Fawcett
Ensure we log reading changelist from specified file.
Change 3184744 on 2016/11/03 by Richard.Fawcett
Ensure directory is created for Changelist file if it doesn't already exist.
Change 3184738 on 2016/11/03 by Richard.Fawcett
Ensure we use latest CL from all of Perforce when generating build versions for user content
Because of the nature of the build farm, where separate parts of the job are executed on different build agents at different times, this changelist is serialized to the filesystem during execution of a node dedicated to this task, and then made available to all future nodes, so that they're working with a consistent build version. In the case of an execution where we're updating Perforce with new content, this calculation of the changelist occurs AFTER we've updated Perforce with the new content.
Have also optimized the build graph scripts to enable Mac and Windows user generated content to execute simultaneously.
#jira OPP-6274
Change 3181456 on 2016/11/01 by Andrew.Brown
SExpandable area has been modified as the Portal settings mocks weren't able to be achieved with default functionality.
Added BodyBorderImage arguement and BodyBorderBackgroundColor attribute so we can specify a different brush/color to use for the expanded area compared with the title area. Additional care was made to ensure that rounded corners still appear correctly if the developer doesn't want to specify a different look to the body.
Added AreaTitlePadding attribute, to be able to specify padding between the expand/collapse icon and the header content.
Added MinWidth arguement, to ensure that the areas meet a minimum width requirement.
Change 3181285 on 2016/11/01 by Richard.Fawcett
Ensure user content generated using latest changelist submitted to Perforce, rather than using portal's latest changelist
#jira OPP-6274
Change 3177758 on 2016/10/28 by Leigh.Swift
#jira OPP-6247: Portal needs Social Plugin integration v1.2
Copying //Portal/Dev-Social to Dev-Main (//Portal/Dev-Main)
Change 3175889 on 2016/10/26 by Wes.Fudala
Web browser tooltips will no longer continue to appear when the mouse leaves the browser window.
#jira: OPP-5895 The Mouseover info in Recent Additions (Marketplace) anchors itself to the mouse pointer over other Browser windows
rb: Justin.Sargent
Change 3171388 on 2016/10/22 by Leigh.Swift
#jira OPP-6343: Launcher crashes patching from 2.12.13 Main to 2.12.13 Release-Live
BPS: FBuildPatchAppManifest needs to listen for FCoreDelegates::OnPreExit in order to clean up references to it's UObject which is about to be destroyed.
Change 3170373 on 2016/10/21 by Leigh.Swift
#jira: OPP-6340: Portal builds fail on audit nodes.
Reducing platform regex to only match pre-defined possibilities.
[CL 3219291 by Justin Sargent in Main branch]
2016-12-02 13:27:02 -05:00
|
|
|
FDriverWaitDelegate Until::ElementIsInteractable(const TSharedRef<IElementLocator, ESPMode::ThreadSafe>& ElementLocator, FWaitTimeout Timeout)
|
|
|
|
|
{
|
|
|
|
|
return Until::ElementIsInteractable(ElementLocator, FWaitInterval::InSeconds(1.0), Timeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDriverWaitDelegate Until::ElementIsInteractable(const TSharedRef<IElementLocator, ESPMode::ThreadSafe>& ElementLocator, FWaitInterval Interval, FWaitTimeout Timeout)
|
|
|
|
|
{
|
|
|
|
|
return Until::Lambda([ElementLocator, Interval, Timeout](const FTimespan& TotalWaitTime) {
|
|
|
|
|
check(IsInGameThread());
|
|
|
|
|
|
|
|
|
|
TArray<TSharedRef<IApplicationElement>> Elements;
|
|
|
|
|
ElementLocator->Locate(Elements);
|
|
|
|
|
|
|
|
|
|
if (Elements.Num() == 0)
|
|
|
|
|
{
|
|
|
|
|
if (TotalWaitTime > Timeout.Timespan)
|
|
|
|
|
{
|
|
|
|
|
return FDriverWaitResponse::Failed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FDriverWaitResponse::Wait(Interval.Timespan);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (TSharedRef<IApplicationElement> Element : Elements)
|
|
|
|
|
{
|
|
|
|
|
if (!Element->IsVisible() || !Element->IsInteractable())
|
|
|
|
|
{
|
|
|
|
|
if (TotalWaitTime > Timeout.Timespan)
|
|
|
|
|
{
|
|
|
|
|
return FDriverWaitResponse::Failed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FDriverWaitResponse::Wait(Interval.Timespan);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FDriverWaitResponse::Passed();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDriverWaitDelegate Until::ElementIsScrolledToBeginning(const TSharedRef<IElementLocator, ESPMode::ThreadSafe>& ElementLocator, FWaitTimeout Timeout)
|
|
|
|
|
{
|
|
|
|
|
return Until::ElementIsScrolledToBeginning(ElementLocator, FWaitInterval::InSeconds(1.0), Timeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDriverWaitDelegate Until::ElementIsScrolledToBeginning(const TSharedRef<IElementLocator, ESPMode::ThreadSafe>& ElementLocator, FWaitInterval Interval, FWaitTimeout Timeout)
|
|
|
|
|
{
|
|
|
|
|
return Until::Lambda([ElementLocator, Interval, Timeout](const FTimespan& TotalWaitTime) {
|
|
|
|
|
check(IsInGameThread());
|
|
|
|
|
|
|
|
|
|
TArray<TSharedRef<IApplicationElement>> Elements;
|
|
|
|
|
ElementLocator->Locate(Elements);
|
|
|
|
|
|
|
|
|
|
if (Elements.Num() == 0)
|
|
|
|
|
{
|
|
|
|
|
if (TotalWaitTime > Timeout.Timespan)
|
|
|
|
|
{
|
|
|
|
|
return FDriverWaitResponse::Failed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FDriverWaitResponse::Wait(Interval.Timespan);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (TSharedRef<IApplicationElement> Element : Elements)
|
|
|
|
|
{
|
|
|
|
|
if (!Element->IsScrolledToBeginning())
|
|
|
|
|
{
|
|
|
|
|
if (TotalWaitTime > Timeout.Timespan)
|
|
|
|
|
{
|
|
|
|
|
return FDriverWaitResponse::Failed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FDriverWaitResponse::Wait(Interval.Timespan);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FDriverWaitResponse::Passed();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDriverWaitDelegate Until::ElementIsScrolledToEnd(const TSharedRef<IElementLocator, ESPMode::ThreadSafe>& ElementLocator, FWaitTimeout Timeout)
|
|
|
|
|
{
|
|
|
|
|
return Until::ElementIsScrolledToEnd(ElementLocator, FWaitInterval::InSeconds(1.0), Timeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDriverWaitDelegate Until::ElementIsScrolledToEnd(const TSharedRef<IElementLocator, ESPMode::ThreadSafe>& ElementLocator, FWaitInterval Interval, FWaitTimeout Timeout)
|
|
|
|
|
{
|
|
|
|
|
return Until::Lambda([ElementLocator, Interval, Timeout](const FTimespan& TotalWaitTime) {
|
|
|
|
|
check(IsInGameThread());
|
|
|
|
|
|
|
|
|
|
TArray<TSharedRef<IApplicationElement>> Elements;
|
|
|
|
|
ElementLocator->Locate(Elements);
|
|
|
|
|
|
|
|
|
|
if (Elements.Num() == 0)
|
|
|
|
|
{
|
|
|
|
|
if (TotalWaitTime > Timeout.Timespan)
|
|
|
|
|
{
|
|
|
|
|
return FDriverWaitResponse::Failed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FDriverWaitResponse::Wait(Interval.Timespan);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (TSharedRef<IApplicationElement> Element : Elements)
|
|
|
|
|
{
|
|
|
|
|
if (!Element->IsScrolledToEnd())
|
|
|
|
|
{
|
|
|
|
|
if (TotalWaitTime > Timeout.Timespan)
|
|
|
|
|
{
|
|
|
|
|
return FDriverWaitResponse::Failed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FDriverWaitResponse::Wait(Interval.Timespan);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FDriverWaitResponse::Passed();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDriverWaitDelegate Until::Condition(const TFunction<bool()>& Function, FWaitTimeout Timeout)
|
|
|
|
|
{
|
|
|
|
|
return Until::Condition(FDriverWaitConditionDelegate::CreateLambda(Function), Timeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDriverWaitDelegate Until::Condition(const TFunction<bool()>& Function, FWaitInterval Interval, FWaitTimeout Timeout)
|
|
|
|
|
{
|
|
|
|
|
return Until::Condition(FDriverWaitConditionDelegate::CreateLambda(Function), Interval, Timeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDriverWaitDelegate Until::Condition(const FDriverWaitConditionDelegate& Delegate, FWaitTimeout Timeout)
|
|
|
|
|
{
|
|
|
|
|
return Until::Condition(Delegate, FWaitInterval::InSeconds(1.0), Timeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDriverWaitDelegate Until::Condition(const FDriverWaitConditionDelegate& Delegate, FWaitInterval Interval, FWaitTimeout Timeout)
|
|
|
|
|
{
|
|
|
|
|
return FDriverWaitDelegate::CreateLambda([Delegate, Interval, Timeout](const FTimespan& TotalWaitTime) {
|
|
|
|
|
check(IsInGameThread());
|
|
|
|
|
|
|
|
|
|
if (!Delegate.IsBound())
|
|
|
|
|
{
|
|
|
|
|
return FDriverWaitResponse::Failed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Delegate.Execute())
|
|
|
|
|
{
|
|
|
|
|
if (TotalWaitTime > Timeout.Timespan)
|
|
|
|
|
{
|
|
|
|
|
return FDriverWaitResponse::Failed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FDriverWaitResponse::Wait(Interval.Timespan);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FDriverWaitResponse::Passed();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDriverWaitDelegate Until::Lambda(const TFunction<FDriverWaitResponse(const FTimespan&)>& Value)
|
|
|
|
|
{
|
|
|
|
|
return FDriverWaitDelegate::CreateLambda(Value);
|
|
|
|
|
}
|