2016-01-07 08:17:16 -05:00
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
2014-03-14 14:13:41 -04:00
# pragma once
2014-06-25 05:47:19 -04:00
# include "GameFramework/Actor.h"
2014-11-11 10:35:51 -05:00
# include "Math/RandomStream.h"
2014-03-14 14:13:41 -04:00
# include "FunctionalTest.generated.h"
2014-06-25 05:47:19 -04:00
class UBillboardComponent ;
2015-10-30 17:41:13 -04:00
//Experimental effort at automated cpu captures from the functional testing.
class FFunctionalTestExternalProfiler : public FScopedExternalProfilerBase
{
public :
void StartProfiler ( const bool bWantPause ) { StartScopedTimer ( bWantPause ) ; }
void StopProfiler ( ) { StopScopedTimer ( ) ; }
} ;
2015-10-28 08:58:16 -04:00
// Used to measure a distribution
struct FStatisticalFloat
{
public :
FStatisticalFloat ( )
: MinValue ( 0.0 )
, MaxValue ( 0.0 )
, Accumulator ( 0.0 )
, NumSamples ( 0 )
{
}
void AddSample ( double Value )
{
if ( NumSamples = = 0 )
{
MinValue = MaxValue = Value ;
}
else
{
MinValue = FMath : : Min ( MinValue , Value ) ;
MaxValue = FMath : : Max ( MaxValue , Value ) ;
}
Accumulator + = Value ;
+ + NumSamples ;
}
double GetMinValue ( ) const
{
return MinValue ;
}
double GetMaxValue ( ) const
{
return MaxValue ;
}
double GetAvgValue ( ) const
{
return Accumulator / ( double ) NumSamples ;
}
int32 GetCount ( ) const
{
return NumSamples ;
}
private :
double MinValue ;
double MaxValue ;
double Accumulator ;
int32 NumSamples ;
} ;
2015-10-30 17:41:13 -04:00
struct FStatsData
2015-10-28 08:58:16 -04:00
{
2015-10-30 17:41:13 -04:00
FStatsData ( ) : NumFrames ( 0 ) , SumTimeSeconds ( 0.0f ) { }
2015-10-28 08:58:16 -04:00
uint32 NumFrames ;
uint32 SumTimeSeconds ;
FStatisticalFloat FrameTimeTracker ;
FStatisticalFloat GameThreadTimeTracker ;
FStatisticalFloat RenderThreadTimeTracker ;
FStatisticalFloat GPUTimeTracker ;
} ;
2015-10-30 17:41:13 -04:00
/** A set of simple perf stats recorded over a period of frames. */
struct FUNCTIONALTESTING_API FPerfStatsRecord
{
FPerfStatsRecord ( FString InName ) ;
FString Name ;
/** Stats data for the period we're interested in timing. */
FStatsData Record ;
/** Stats data for the baseline. */
FStatsData Baseline ;
2015-11-12 12:38:50 -05:00
float GPUBudget ;
float RenderThreadBudget ;
float GameThreadBudget ;
2015-10-30 17:41:13 -04:00
2015-11-12 12:38:50 -05:00
void SetBudgets ( float InGPUBudget , float InRenderThreadBudget , float InGameThreadBudget ) ;
2015-10-30 17:41:13 -04:00
void Sample ( UWorld * Owner , float DeltaSeconds , bool bBaseline ) ;
FString GetReportString ( ) const ;
FString GetBaselineString ( ) const ;
FString GetRecordString ( ) const ;
2015-11-12 12:38:50 -05:00
FString GetOverBudgetString ( ) const ;
2015-10-30 17:41:13 -04:00
void GetGPUTimes ( double & OutMin , double & OutMax , double & OutAvg ) const ;
void GetGameThreadTimes ( double & OutMin , double & OutMax , double & OutAvg ) const ;
void GetRenderThreadTimes ( double & OutMin , double & OutMax , double & OutAvg ) const ;
2015-11-12 12:38:50 -05:00
bool IsWithinGPUBudget ( ) const ;
bool IsWithinGameThreadBudget ( ) const ;
bool IsWithinRenderThreadBudget ( ) const ;
2015-10-30 17:41:13 -04:00
} ;
/**
* Class for use with functional tests which provides various performance measuring features .
* Recording of basic , unintrusive performance stats .
* Automatic captures using external CPU and GPU profilers .
* Triggering and ending of writing full stats to a file .
*/
2015-10-28 08:58:16 -04:00
UCLASS ( Blueprintable )
2015-10-30 17:41:13 -04:00
class FUNCTIONALTESTING_API UAutomationPerformaceHelper : public UObject
2015-10-28 08:58:16 -04:00
{
GENERATED_BODY ( )
TArray < FPerfStatsRecord > Records ;
2015-10-30 17:41:13 -04:00
bool bRecordingBasicStats ;
bool bRecordingBaselineBasicStats ;
bool bRecordingCPUCapture ;
bool bRecordingStatsFile ;
Copying //UE4/Orion-Staging to //UE4/Main (Origin: //Orion/Dev-General @2826496)
#lockdown Nick.Penwarden
==========================
MAJOR FEATURES + CHANGES
==========================
Change 2826201 on 2016/01/13 by Zabir.Hoque
Add more verbose logging to try to understand #OR-11297
#lockdown Andrew.Grant
#CodeReview Marcus.Wassmer
#RB none
#TESTS compiled Win64 debug editor, ran agora_p
Change 2826170 on 2016/01/13 by Marcus.Wassmer
Flush unloaded resource properly in LoadMap
#codereview Gil.Gribb
#rb none
#test cycling game. memory is freed properly now.
#lockdown Andrew.Grant
Change 2826135 on 2016/01/12 by Michael.Noland
Orion: Improve login screen on PC to reduce the potential impact of framerate on data center ping calculation
- Disabled async streaming for the duration of the QOS ping measurement to avoid hitches
- Added a circular throbber in the top left corner of the login screen indicating that something is async streaming (as a diagnostic tool for users affected by the datacenter ping, can be removed in the future)
- Added logging of the current average frame time when the datacenter ping is finalized
- Added a 'Pick Ideal Settings' button to the login screen (note: on the actual screen, not the login widget, so it will not appear on PS4)
#jira OR-12453
#rb paul.moore
#tests Ran a QOS server and client and verified that the new logging is occurring, tried out the new benchmark button, etc...
Merging CL# 2826128 using //Orion/Main_to_//Orion/Dev-General
Change 2826131 on 2016/01/12 by Michael.Noland
#UE4 - added print out of MS/FPS during Qos ping evaluation
#rb michael.noland
#tests loaded up through login screen to see output
Merging CL# 2825678 using //Orion/Main_to_//Orion/Dev-General
Change 2826128 on 2016/01/12 by Michael.Noland
Orion: Improve login screen on PC to reduce the potential impact of framerate on data center ping calculation
- Disabled async streaming for the duration of the QOS ping measurement to avoid hitches
- Added a circular throbber in the top left corner of the login screen indicating that something is async streaming (as a diagnostic tool for users affected by the datacenter ping, can be removed in the future)
- Added logging of the current average frame time when the datacenter ping is finalized
- Added a 'Pick Ideal Settings' button to the login screen (note: on the actual screen, not the login widget, so it will not appear on PS4)
#jira OR-12453
#rb paul.moore
#tests Ran a QOS server and client and verified that the new logging is occurring, tried out the new benchmark button, etc...
Merging CL# 2826116 using //Orion/Release-Next->//Orion/Main
Change 2826116 on 2016/01/12 by Michael.Noland
Orion: Improve login screen on PC to reduce the potential impact of framerate on data center ping calculation
- Disabled async streaming for the duration of the QOS ping measurement to avoid hitches
- Added a circular throbber in the top left corner of the login screen indicating that something is async streaming (as a diagnostic tool for users affected by the datacenter ping, can be removed in the future)
- Added logging of the current average frame time when the datacenter ping is finalized
- Added a 'Pick Ideal Settings' button to the login screen (note: on the actual screen, not the login widget, so it will not appear on PS4)
#jira OR-12453
#rb paul.moore
#tests Ran a QOS server and client and verified that the new logging is occurring, tried out the new benchmark button, etc...
#lockdown andrew.grant
#codereview josh.markiewicz
Change 2825772 on 2016/01/12 by Dmitry.Rekman
Linux signal handling improvements.
- Switch crash handlers to use "crash malloc" (preallocated memory) on crash.
- Remove unnecessary memory allocations from graceful termination handler.
#rb none
#tests Run the Linux server and crashed it a few times.
#codereview David.Vossel, Michael.Trepka
Change 2825768 on 2016/01/12 by Josh.Markiewicz
#UE4 - added print out of MS/FPS during Qos ping evaluation
#rb michael.noland
#tests loaded up through login screen to see output
Change 2825703 on 2016/01/12 by Brian.Karis
Switched on new motion blur. Set temporal AA sharpness to 1.
#rb none
#TESTS editor
Change 2825689 on 2016/01/12 by Lina.Halper
Fix for get animation notify crash
https://jira.ol.epicgames.net/browse/OR-12248
https://jira.ol.epicgames.net/browse/OR-12348
- Also fixed the crash in preview of persona due to blend sample cache contains previous animation data
- Also fixed blend space player to reinitialize cache data
- The main issue is marker doesn't clamp the length, causing notifies ensure to trigger.
#rb : Laurent.Delayen
#tests: 10 Sparrows bot match for long time
#code review: Martin.Wilson
#lockdown: Andrew.Grant
Change 2825680 on 2016/01/12 by Martin.Mittring
fixed all cases with r.Tonemapper.ScreenPercentage, ScreenPercentage, Fringe, Vignette, ViewRect, flickering with transluceny (View members have been modified while other thread was reading)
#rb:Olaf.Piesche, David.Hill
#test: PC, many cases
Change 2825579 on 2016/01/12 by Chris.Bunner
Force shadow shape bone indices on the required update list.
#rb Lina.Halper, Rolando.Caloca
#tests Editor
#codereview Daniel.Wright
#jira OR-12339
Change 2825443 on 2016/01/12 by Martin.Mittring
2016-01-14 08:11:47 -05:00
/** If true we check the GPU times vs GPU budget each tick and trigger a GPU trace if we fall below budget.*/
bool bGPUTraceIfBelowBudget ;
2015-10-28 08:58:16 -04:00
public :
2015-10-30 17:41:13 -04:00
UAutomationPerformaceHelper ( ) ;
//Begin basic stat recording
UFUNCTION ( BlueprintCallable , Category = Perf )
void Tick ( float DeltaSeconds ) ;
2015-10-28 08:58:16 -04:00
/** Adds a sample to the stats counters for the current performance stats record. */
UFUNCTION ( BlueprintCallable , Category = Perf )
2015-10-30 17:41:13 -04:00
void Sample ( float DeltaSeconds ) ;
/** Begins recording a new named performance stats record. We start by recording the baseline */
UFUNCTION ( BlueprintCallable , Category = Perf )
void BeginRecordingBaseline ( FString RecordName ) ;
/** Stops recording the baseline and moves to the main record. */
UFUNCTION ( BlueprintCallable , Category = Perf )
void EndRecordingBaseline ( ) ;
/** Begins recording a new named performance stats record. We start by recording the baseline. */
2015-10-28 08:58:16 -04:00
UFUNCTION ( BlueprintCallable , Category = Perf )
2015-11-12 12:38:50 -05:00
void BeginRecording ( FString RecordName , float InGPUBudget , float InRenderThreadBudget , float InGameThreadBudget ) ;
2015-10-28 08:58:16 -04:00
/** Stops recording performance stats. */
UFUNCTION ( BlueprintCallable , Category = Perf )
void EndRecording ( ) ;
/** Writes the current set of performance stats records to a csv file in the profiling directory. An additional directory and an extension override can also be used. */
UFUNCTION ( BlueprintCallable , Category = Perf )
void WriteLogFile ( const FString & CaptureDir , const FString & CaptureExtension ) ;
/** Returns true if this stats tracker is currently recording performance stats. */
UFUNCTION ( BlueprintCallable , Category = Perf )
2015-10-30 17:41:13 -04:00
bool IsRecording ( ) const ;
/** Does any init work across all tests.. */
UFUNCTION ( BlueprintCallable , Category = Perf )
void OnBeginTests ( ) ;
/** Does any final work needed as all tests are complete. */
UFUNCTION ( BlueprintCallable , Category = Perf )
void OnAllTestsComplete ( ) ;
2015-10-28 08:58:16 -04:00
const FPerfStatsRecord * GetCurrentRecord ( ) const ;
2015-11-12 12:38:50 -05:00
FPerfStatsRecord * GetCurrentRecord ( ) ;
2015-10-30 17:41:13 -04:00
UFUNCTION ( BlueprintCallable , Category = Perf )
2015-11-12 12:38:50 -05:00
bool IsCurrentRecordWithinGPUBudget ( ) const ;
2015-10-30 17:41:13 -04:00
UFUNCTION ( BlueprintCallable , Category = Perf )
2015-11-12 12:38:50 -05:00
bool IsCurrentRecordWithinGameThreadBudget ( ) const ;
2015-10-30 17:41:13 -04:00
UFUNCTION ( BlueprintCallable , Category = Perf )
2015-11-12 12:38:50 -05:00
bool IsCurrentRecordWithinRenderThreadBudget ( ) const ;
2015-10-30 17:41:13 -04:00
//End basic stats recording.
// Automatic traces capturing
/** Communicates with external profiler to being a CPU capture. */
UFUNCTION ( BlueprintCallable , Category = Perf )
void StartCPUProfiling ( ) ;
/** Communicates with external profiler to end a CPU capture. */
UFUNCTION ( BlueprintCallable , Category = Perf )
void StopCPUProfiling ( ) ;
Copying //UE4/Orion-Staging to //UE4/Main (Origin: //Orion/Dev-General @2826496)
#lockdown Nick.Penwarden
==========================
MAJOR FEATURES + CHANGES
==========================
Change 2826201 on 2016/01/13 by Zabir.Hoque
Add more verbose logging to try to understand #OR-11297
#lockdown Andrew.Grant
#CodeReview Marcus.Wassmer
#RB none
#TESTS compiled Win64 debug editor, ran agora_p
Change 2826170 on 2016/01/13 by Marcus.Wassmer
Flush unloaded resource properly in LoadMap
#codereview Gil.Gribb
#rb none
#test cycling game. memory is freed properly now.
#lockdown Andrew.Grant
Change 2826135 on 2016/01/12 by Michael.Noland
Orion: Improve login screen on PC to reduce the potential impact of framerate on data center ping calculation
- Disabled async streaming for the duration of the QOS ping measurement to avoid hitches
- Added a circular throbber in the top left corner of the login screen indicating that something is async streaming (as a diagnostic tool for users affected by the datacenter ping, can be removed in the future)
- Added logging of the current average frame time when the datacenter ping is finalized
- Added a 'Pick Ideal Settings' button to the login screen (note: on the actual screen, not the login widget, so it will not appear on PS4)
#jira OR-12453
#rb paul.moore
#tests Ran a QOS server and client and verified that the new logging is occurring, tried out the new benchmark button, etc...
Merging CL# 2826128 using //Orion/Main_to_//Orion/Dev-General
Change 2826131 on 2016/01/12 by Michael.Noland
#UE4 - added print out of MS/FPS during Qos ping evaluation
#rb michael.noland
#tests loaded up through login screen to see output
Merging CL# 2825678 using //Orion/Main_to_//Orion/Dev-General
Change 2826128 on 2016/01/12 by Michael.Noland
Orion: Improve login screen on PC to reduce the potential impact of framerate on data center ping calculation
- Disabled async streaming for the duration of the QOS ping measurement to avoid hitches
- Added a circular throbber in the top left corner of the login screen indicating that something is async streaming (as a diagnostic tool for users affected by the datacenter ping, can be removed in the future)
- Added logging of the current average frame time when the datacenter ping is finalized
- Added a 'Pick Ideal Settings' button to the login screen (note: on the actual screen, not the login widget, so it will not appear on PS4)
#jira OR-12453
#rb paul.moore
#tests Ran a QOS server and client and verified that the new logging is occurring, tried out the new benchmark button, etc...
Merging CL# 2826116 using //Orion/Release-Next->//Orion/Main
Change 2826116 on 2016/01/12 by Michael.Noland
Orion: Improve login screen on PC to reduce the potential impact of framerate on data center ping calculation
- Disabled async streaming for the duration of the QOS ping measurement to avoid hitches
- Added a circular throbber in the top left corner of the login screen indicating that something is async streaming (as a diagnostic tool for users affected by the datacenter ping, can be removed in the future)
- Added logging of the current average frame time when the datacenter ping is finalized
- Added a 'Pick Ideal Settings' button to the login screen (note: on the actual screen, not the login widget, so it will not appear on PS4)
#jira OR-12453
#rb paul.moore
#tests Ran a QOS server and client and verified that the new logging is occurring, tried out the new benchmark button, etc...
#lockdown andrew.grant
#codereview josh.markiewicz
Change 2825772 on 2016/01/12 by Dmitry.Rekman
Linux signal handling improvements.
- Switch crash handlers to use "crash malloc" (preallocated memory) on crash.
- Remove unnecessary memory allocations from graceful termination handler.
#rb none
#tests Run the Linux server and crashed it a few times.
#codereview David.Vossel, Michael.Trepka
Change 2825768 on 2016/01/12 by Josh.Markiewicz
#UE4 - added print out of MS/FPS during Qos ping evaluation
#rb michael.noland
#tests loaded up through login screen to see output
Change 2825703 on 2016/01/12 by Brian.Karis
Switched on new motion blur. Set temporal AA sharpness to 1.
#rb none
#TESTS editor
Change 2825689 on 2016/01/12 by Lina.Halper
Fix for get animation notify crash
https://jira.ol.epicgames.net/browse/OR-12248
https://jira.ol.epicgames.net/browse/OR-12348
- Also fixed the crash in preview of persona due to blend sample cache contains previous animation data
- Also fixed blend space player to reinitialize cache data
- The main issue is marker doesn't clamp the length, causing notifies ensure to trigger.
#rb : Laurent.Delayen
#tests: 10 Sparrows bot match for long time
#code review: Martin.Wilson
#lockdown: Andrew.Grant
Change 2825680 on 2016/01/12 by Martin.Mittring
fixed all cases with r.Tonemapper.ScreenPercentage, ScreenPercentage, Fringe, Vignette, ViewRect, flickering with transluceny (View members have been modified while other thread was reading)
#rb:Olaf.Piesche, David.Hill
#test: PC, many cases
Change 2825579 on 2016/01/12 by Chris.Bunner
Force shadow shape bone indices on the required update list.
#rb Lina.Halper, Rolando.Caloca
#tests Editor
#codereview Daniel.Wright
#jira OR-12339
Change 2825443 on 2016/01/12 by Martin.Mittring
2016-01-14 08:11:47 -05:00
/** Will trigger a GPU trace next time the current test falls below GPU budget. */
2015-10-30 17:41:13 -04:00
UFUNCTION ( BlueprintCallable , Category = Perf )
Copying //UE4/Orion-Staging to //UE4/Main (Origin: //Orion/Dev-General @2826496)
#lockdown Nick.Penwarden
==========================
MAJOR FEATURES + CHANGES
==========================
Change 2826201 on 2016/01/13 by Zabir.Hoque
Add more verbose logging to try to understand #OR-11297
#lockdown Andrew.Grant
#CodeReview Marcus.Wassmer
#RB none
#TESTS compiled Win64 debug editor, ran agora_p
Change 2826170 on 2016/01/13 by Marcus.Wassmer
Flush unloaded resource properly in LoadMap
#codereview Gil.Gribb
#rb none
#test cycling game. memory is freed properly now.
#lockdown Andrew.Grant
Change 2826135 on 2016/01/12 by Michael.Noland
Orion: Improve login screen on PC to reduce the potential impact of framerate on data center ping calculation
- Disabled async streaming for the duration of the QOS ping measurement to avoid hitches
- Added a circular throbber in the top left corner of the login screen indicating that something is async streaming (as a diagnostic tool for users affected by the datacenter ping, can be removed in the future)
- Added logging of the current average frame time when the datacenter ping is finalized
- Added a 'Pick Ideal Settings' button to the login screen (note: on the actual screen, not the login widget, so it will not appear on PS4)
#jira OR-12453
#rb paul.moore
#tests Ran a QOS server and client and verified that the new logging is occurring, tried out the new benchmark button, etc...
Merging CL# 2826128 using //Orion/Main_to_//Orion/Dev-General
Change 2826131 on 2016/01/12 by Michael.Noland
#UE4 - added print out of MS/FPS during Qos ping evaluation
#rb michael.noland
#tests loaded up through login screen to see output
Merging CL# 2825678 using //Orion/Main_to_//Orion/Dev-General
Change 2826128 on 2016/01/12 by Michael.Noland
Orion: Improve login screen on PC to reduce the potential impact of framerate on data center ping calculation
- Disabled async streaming for the duration of the QOS ping measurement to avoid hitches
- Added a circular throbber in the top left corner of the login screen indicating that something is async streaming (as a diagnostic tool for users affected by the datacenter ping, can be removed in the future)
- Added logging of the current average frame time when the datacenter ping is finalized
- Added a 'Pick Ideal Settings' button to the login screen (note: on the actual screen, not the login widget, so it will not appear on PS4)
#jira OR-12453
#rb paul.moore
#tests Ran a QOS server and client and verified that the new logging is occurring, tried out the new benchmark button, etc...
Merging CL# 2826116 using //Orion/Release-Next->//Orion/Main
Change 2826116 on 2016/01/12 by Michael.Noland
Orion: Improve login screen on PC to reduce the potential impact of framerate on data center ping calculation
- Disabled async streaming for the duration of the QOS ping measurement to avoid hitches
- Added a circular throbber in the top left corner of the login screen indicating that something is async streaming (as a diagnostic tool for users affected by the datacenter ping, can be removed in the future)
- Added logging of the current average frame time when the datacenter ping is finalized
- Added a 'Pick Ideal Settings' button to the login screen (note: on the actual screen, not the login widget, so it will not appear on PS4)
#jira OR-12453
#rb paul.moore
#tests Ran a QOS server and client and verified that the new logging is occurring, tried out the new benchmark button, etc...
#lockdown andrew.grant
#codereview josh.markiewicz
Change 2825772 on 2016/01/12 by Dmitry.Rekman
Linux signal handling improvements.
- Switch crash handlers to use "crash malloc" (preallocated memory) on crash.
- Remove unnecessary memory allocations from graceful termination handler.
#rb none
#tests Run the Linux server and crashed it a few times.
#codereview David.Vossel, Michael.Trepka
Change 2825768 on 2016/01/12 by Josh.Markiewicz
#UE4 - added print out of MS/FPS during Qos ping evaluation
#rb michael.noland
#tests loaded up through login screen to see output
Change 2825703 on 2016/01/12 by Brian.Karis
Switched on new motion blur. Set temporal AA sharpness to 1.
#rb none
#TESTS editor
Change 2825689 on 2016/01/12 by Lina.Halper
Fix for get animation notify crash
https://jira.ol.epicgames.net/browse/OR-12248
https://jira.ol.epicgames.net/browse/OR-12348
- Also fixed the crash in preview of persona due to blend sample cache contains previous animation data
- Also fixed blend space player to reinitialize cache data
- The main issue is marker doesn't clamp the length, causing notifies ensure to trigger.
#rb : Laurent.Delayen
#tests: 10 Sparrows bot match for long time
#code review: Martin.Wilson
#lockdown: Andrew.Grant
Change 2825680 on 2016/01/12 by Martin.Mittring
fixed all cases with r.Tonemapper.ScreenPercentage, ScreenPercentage, Fringe, Vignette, ViewRect, flickering with transluceny (View members have been modified while other thread was reading)
#rb:Olaf.Piesche, David.Hill
#test: PC, many cases
Change 2825579 on 2016/01/12 by Chris.Bunner
Force shadow shape bone indices on the required update list.
#rb Lina.Halper, Rolando.Caloca
#tests Editor
#codereview Daniel.Wright
#jira OR-12339
Change 2825443 on 2016/01/12 by Martin.Mittring
2016-01-14 08:11:47 -05:00
void TriggerGPUTraceIfRecordFallsBelowBudget ( ) ;
2015-10-30 17:41:13 -04:00
/** Begins recording stats to a file. */
UFUNCTION ( BlueprintCallable , Category = Perf )
void BeginStatsFile ( const FString & RecordName ) ;
/** Ends recording stats to a file. */
UFUNCTION ( BlueprintCallable , Category = Perf )
void EndStatsFile ( ) ;
FFunctionalTestExternalProfiler ExternalProfiler ;
/** The path and base name for all output files. */
FString OutputFileBase ;
FString StartOfTestingTime ;
2015-10-28 08:58:16 -04:00
} ;
2014-03-14 14:13:41 -04:00
UENUM ( )
namespace EFunctionalTestResult
{
enum Type
{
Invalid ,
Error ,
Running ,
Failed ,
Succeeded ,
} ;
}
DECLARE_DYNAMIC_MULTICAST_DELEGATE ( FFunctionalTestEventSignature ) ;
DECLARE_DELEGATE_OneParam ( FFunctionalTestDoneSignature , class AFunctionalTest * ) ;
2014-09-03 09:56:49 -04:00
UCLASS ( Blueprintable , MinimalAPI )
2014-03-14 14:13:41 -04:00
class AFunctionalTest : public AActor
{
2015-03-17 05:38:32 -04:00
GENERATED_UCLASS_BODY ( )
2014-03-14 14:13:41 -04:00
static const uint32 DefaultTimeLimit = 60 ; // seconds
2014-10-30 17:10:56 -04:00
private_subobject :
DEPRECATED_FORGAME ( 4.6 , " SpriteComponent should not be accessed directly, please use GetSpriteComponent() function instead. SpriteComponent will soon be private and your code will not compile. " )
2014-03-14 14:13:41 -04:00
UPROPERTY ( )
2014-10-16 09:02:30 -04:00
UBillboardComponent * SpriteComponent ;
public :
2014-03-14 14:13:41 -04:00
UPROPERTY ( BlueprintReadWrite , Category = FunctionalTesting )
TEnumAsByte < EFunctionalTestResult : : Type > Result ;
/** If test is limited by time this is the result that will be returned when time runs out */
UPROPERTY ( EditAnywhere , Category = FunctionalTesting )
TEnumAsByte < EFunctionalTestResult : : Type > TimesUpResult ;
/** Test's time limit. '0' means no limit */
UPROPERTY ( EditAnywhere , BlueprintReadOnly , Category = FunctionalTesting )
float TimeLimit ;
UPROPERTY ( EditAnywhere , BlueprintReadWrite , Category = FunctionalTesting )
FText TimesUpMessage ;
2014-06-09 11:13:04 -04:00
UPROPERTY ( EditAnywhere , BlueprintReadWrite , Category = FunctionalTesting )
AActor * ObservationPoint ;
2014-03-14 14:13:41 -04:00
/** Called when the test is started */
UPROPERTY ( BlueprintAssignable )
FFunctionalTestEventSignature OnTestStart ;
/** Called when the test is finished. Use it to clean up */
UPROPERTY ( BlueprintAssignable )
FFunctionalTestEventSignature OnTestFinished ;
UPROPERTY ( Transient )
TArray < AActor * > AutoDestroyActors ;
2014-06-09 11:13:04 -04:00
2014-04-23 19:29:53 -04:00
FString FailureMessage ;
2014-11-11 10:35:51 -05:00
UPROPERTY ( EditAnywhere , BlueprintReadWrite , Category = FunctionalTesting )
FRandomStream RandomNumbersStream ;
2015-03-11 11:02:39 -04:00
UPROPERTY ( EditAnywhere , BlueprintReadOnly , Category = FunctionalTesting )
FString Description ;
2014-03-14 14:13:41 -04:00
# if WITH_EDITORONLY_DATA
UPROPERTY ( )
class UFuncTestRenderingComponent * RenderComp ;
# endif // WITH_EDITORONLY_DATA
UPROPERTY ( EditAnywhere , BlueprintReadOnly , Category = FunctionalTesting )
2014-04-23 19:29:53 -04:00
uint32 bIsEnabled : 1 ;
2015-10-30 17:41:13 -04:00
/** List of causes we need a re-run. */
TArray < FName > RerunCauses ;
/** Cause of the current rerun if we're in a named rerun. */
FName CurrentRerunCause ;
2014-04-23 19:29:53 -04:00
public :
2014-03-14 14:13:41 -04:00
2014-06-17 08:31:02 -04:00
virtual bool StartTest ( const TArray < FString > & Params = TArray < FString > ( ) ) ;
2014-03-14 14:13:41 -04:00
UFUNCTION ( BlueprintCallable , Category = " Development " )
virtual void FinishTest ( TEnumAsByte < EFunctionalTestResult : : Type > TestResult , const FString & Message ) ;
UFUNCTION ( BlueprintCallable , Category = " Development " )
virtual void LogMessage ( const FString & Message ) ;
UFUNCTION ( BlueprintCallable , Category = " Development " )
virtual void SetTimeLimit ( float NewTimeLimit , TEnumAsByte < EFunctionalTestResult : : Type > ResultWhenTimeRunsOut ) ;
2015-03-11 11:02:39 -04:00
/** Used by debug drawing to gather actors this test is using and point at them on the level to better understand test's setup */
UFUNCTION ( BlueprintImplementableEvent , Category = " FunctionalTesting " )
2015-03-18 17:50:49 -04:00
TArray < AActor * > DebugGatherRelevantActors ( ) const ;
2015-03-11 11:02:39 -04:00
virtual void GatherRelevantActors ( TArray < AActor * > & OutActors ) const ;
2014-04-23 19:29:53 -04:00
/** retrieves information whether test wants to have another run just after finishing */
UFUNCTION ( BlueprintImplementableEvent , Category = " FunctionalTesting " )
2015-03-18 12:16:37 -04:00
bool OnWantsReRunCheck ( ) const ;
virtual bool WantsToRunAgain ( ) const { return false ; }
2014-04-23 19:29:53 -04:00
2015-10-30 17:41:13 -04:00
/** Causes the test to be rerun for a specific named reason. */
UFUNCTION ( BlueprintCallable , Category = " FunctionalTesting " )
void AddRerun ( FName Reason ) ;
/** Returns the current re-run reason if we're in a named re-run. */
UFUNCTION ( BlueprintCallable , Category = " FunctionalTesting " )
FName GetCurrentRerunReason ( ) const ;
2014-04-23 19:29:53 -04:00
UFUNCTION ( BlueprintImplementableEvent , Category = " FunctionalTesting " )
2015-03-18 12:16:37 -04:00
FString OnAdditionalTestFinishedMessageRequest ( EFunctionalTestResult : : Type TestResult ) const ;
virtual FString GetAdditionalTestFinishedMessage ( EFunctionalTestResult : : Type TestResult ) const { return FString ( ) ; }
2014-04-23 19:29:53 -04:00
2014-03-14 14:13:41 -04:00
/** ACtors registered this way will be automatically destroyed (by limiting their lifespan)
* on test finish */
UFUNCTION ( BlueprintCallable , Category = " Development " , meta = ( Keywords = " Delete " ) )
virtual void RegisterAutoDestroyActor ( AActor * ActorToAutoDestroy ) ;
2014-04-23 19:29:53 -04:00
/** Called to clean up when tests is removed from the list of active tests after finishing execution.
* Note that FinishTest gets called after every " cycle " of a test ( where further cycles are enabled by
* WantsToRunAgain calls ) . CleanUp gets called when all cycles are done . */
virtual void CleanUp ( ) ;
2014-06-17 08:31:02 -04:00
virtual FString GetReproString ( ) const { return GetFName ( ) . ToString ( ) ; }
2014-03-14 14:13:41 -04:00
# if WITH_EDITOR
2014-06-13 06:14:46 -04:00
void PostEditChangeProperty ( struct FPropertyChangedEvent & PropertyChangedEvent ) override ;
2015-03-11 11:02:39 -04:00
static void OnSelectObject ( UObject * NewSelection ) ;
2014-03-14 14:13:41 -04:00
# endif // WITH_EDITOR
// AActor interface begin
2014-06-13 06:14:46 -04:00
virtual void Tick ( float DeltaSeconds ) override ;
2014-06-25 05:47:19 -04:00
virtual void EndPlay ( const EEndPlayReason : : Type EndPlayReason ) override ;
2014-03-14 14:13:41 -04:00
// AActor interface end
2014-06-16 15:57:17 -04:00
bool IsSuccessful ( ) const { return Result = = EFunctionalTestResult : : Succeeded ; }
2015-06-19 06:39:41 -04:00
bool IsRunning ( ) const { return ! ! bIsRunning ; }
2014-06-16 09:55:19 -04:00
2014-06-09 11:13:04 -04:00
protected :
void GoToObservationPoint ( ) ;
public :
2014-03-14 14:13:41 -04:00
FFunctionalTestDoneSignature TestFinishedObserver ;
protected :
2015-10-06 15:59:09 -04:00
UPROPERTY ( EditAnywhere , BlueprintReadOnly , Category = FunctionalTesting )
bool bIsRunning ;
2014-06-06 06:27:44 -04:00
float TotalTime ;
2014-10-16 09:02:30 -04:00
public :
/** Returns SpriteComponent subobject **/
2014-10-30 17:10:56 -04:00
UBillboardComponent * GetSpriteComponent ( ) ;
2014-10-16 09:02:30 -04:00
} ;