You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#jira UE-90136 #rb justin.sargent #ROBOMERGE-SOURCE: CL 11937646 in //UE4/Release-4.25/... via CL 11937648 #ROBOMERGE-BOT: RELEASE (Release-4.25Plus -> Main) (v656-11643781) [CL 11937669 by josh engebretson in Main branch]
96 lines
2.5 KiB
C++
96 lines
2.5 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "IAutomationDriverModule.h"
|
|
#include "PassThroughMessageHandler.h"
|
|
#include "AutomatedApplication.h"
|
|
#include "AutomationDriver.h"
|
|
#include "Framework/Application/SlateApplication.h"
|
|
|
|
class FAutomationDriverModule
|
|
: public IAutomationDriverModule
|
|
{
|
|
public:
|
|
|
|
virtual void StartupModule() override
|
|
{
|
|
|
|
}
|
|
|
|
virtual void ShutdownModule() override
|
|
{
|
|
|
|
}
|
|
|
|
virtual TSharedRef<IAutomationDriver, ESPMode::ThreadSafe> CreateDriver() const override
|
|
{
|
|
return FAutomationDriverFactory::Create(AutomatedApplication.Get());
|
|
}
|
|
|
|
virtual TSharedRef<IAutomationDriver, ESPMode::ThreadSafe> CreateDriver(const TSharedRef<FDriverConfiguration, ESPMode::ThreadSafe>& Configuration) const override
|
|
{
|
|
return FAutomationDriverFactory::Create(AutomatedApplication.Get(), Configuration);
|
|
}
|
|
|
|
virtual TSharedRef<IAsyncAutomationDriver, ESPMode::ThreadSafe> CreateAsyncDriver() const override
|
|
{
|
|
return FAsyncAutomationDriverFactory::Create(AutomatedApplication.Get());
|
|
}
|
|
|
|
virtual TSharedRef<IAsyncAutomationDriver, ESPMode::ThreadSafe> CreateAsyncDriver(const TSharedRef<FDriverConfiguration, ESPMode::ThreadSafe>& Configuration) const override
|
|
{
|
|
return FAsyncAutomationDriverFactory::Create(AutomatedApplication.Get(), Configuration);
|
|
}
|
|
|
|
virtual bool IsEnabled() const override
|
|
{
|
|
return AutomatedApplication.IsValid();
|
|
}
|
|
|
|
virtual void Enable() override
|
|
{
|
|
if (AutomatedApplication.IsValid())
|
|
{
|
|
return;
|
|
}
|
|
|
|
RealApplication = FSlateApplication::Get().GetPlatformApplication();
|
|
RealMessageHandler = RealApplication->GetMessageHandler();
|
|
|
|
AutomatedApplication = FAutomatedApplicationFactory::Create(
|
|
RealApplication.ToSharedRef(),
|
|
FPassThroughMessageHandlerFactoryFactory::Create());
|
|
|
|
if (AutomatedApplication.IsValid())
|
|
{
|
|
AutomatedApplication->AllowPlatformMessageHandling();
|
|
}
|
|
|
|
FSlateApplication::Get().SetPlatformApplication(AutomatedApplication.ToSharedRef());
|
|
}
|
|
|
|
virtual void Disable() override
|
|
{
|
|
if (!AutomatedApplication.IsValid())
|
|
{
|
|
return;
|
|
}
|
|
|
|
AutomatedApplication->DisablePlatformMessageHandling();
|
|
|
|
FSlateApplication::Get().SetPlatformApplication(RealApplication.ToSharedRef());
|
|
RealApplication->SetMessageHandler(RealMessageHandler.ToSharedRef());
|
|
|
|
AutomatedApplication.Reset();
|
|
RealApplication.Reset();
|
|
RealMessageHandler.Reset();
|
|
}
|
|
|
|
private:
|
|
|
|
TSharedPtr<FAutomatedApplication> AutomatedApplication;
|
|
TSharedPtr<GenericApplication> RealApplication;
|
|
TSharedPtr<FGenericApplicationMessageHandler> RealMessageHandler;
|
|
};
|
|
|
|
IMPLEMENT_MODULE(FAutomationDriverModule, AutomationDriver);
|