Class GraphicsTestAttributeBase
Base class for attributes that define graphics tests.
Implements
Inherited Members
Namespace: UnityEngine.TestTools.Graphics
Assembly: UnityEngine.TestTools.Graphics.dll
Syntax
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public abstract class GraphicsTestAttributeBase : Attribute, ITestBuilder, IImplyFixture, ITestAction
Constructors
GraphicsTestAttributeBase(Type)
Creates a new instance of the GraphicsTestAttributeBase class.
Declaration
protected GraphicsTestAttributeBase(Type sourceType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | sourceType | The source type to use for generating test cases. |
Remarks
This constructor uses the specified source type to generate test cases. The source type must implement the GraphicsTestCaseSource interface.
Properties
ImageExtension
The extension of the reference image. If not set, the default is "png".
Declaration
public ImageExtension ImageExtension { get; init; }
Property Value
| Type | Description |
|---|---|
| ImageExtension |
Remarks
This is only used for the reference image asset path.
ReferenceImageNamingStrategyType
Optional type implementing IReferenceImageNamingStrategy with a public parameterless constructor. When set, takes precedence over ReferenceImageRootSource.
Declaration
public Type ReferenceImageNamingStrategyType { get; init; }
Property Value
| Type | Description |
|---|---|
| Type |
ReferenceImageRootSource
Controls how the reference image file stem is chosen when the test method is parameterized. Ignored when ReferenceImageNamingStrategyType is set and successfully returns a descriptor.
Declaration
public ReferenceImageRootSource ReferenceImageRootSource { get; init; }
Property Value
| Type | Description |
|---|---|
| ReferenceImageRootSource |
Remarks
SceneAssetFileStem makes every parameter combination for the same scene-based case use one reference image named after the scene file.
Targets
Declaration
public ActionTargets Targets { get; }
Property Value
| Type | Description |
|---|---|
| ActionTargets |
TextureFormat
The type of texture to use for the reference image.
Declaration
public TextureFormat TextureFormat { get; init; }
Property Value
| Type | Description |
|---|---|
| TextureFormat |
Remarks
This is used to determine how the reference image is to be loaded and used.
Methods
AfterTest(ITest)
Declaration
public void AfterTest(ITest test)
Parameters
| Type | Name | Description |
|---|---|---|
| ITest | test |
BeforeTest(ITest)
Declaration
public void BeforeTest(ITest test)
Parameters
| Type | Name | Description |
|---|---|---|
| ITest | test |
Events
TestCaseCreated
Event that is raised when a new graphics test case is created. This event can be used to perform additional setup actions for the test case or to process the test case in some way.
Declaration
public static event EventHandler<GraphicsTestCaseCreatedArgs> TestCaseCreated
Event Type
| Type | Description |
|---|---|
| EventHandler<GraphicsTestCaseCreatedArgs> |
Remarks
This event is raised after the test case is created but before it is executed. The event handler receives the test case and the setup actions as parameters.