docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class GraphicsTestAttributeBase

    Base class for attributes that define graphics tests.

    Inheritance
    object
    Attribute
    GraphicsTestAttributeBase
    GraphicsTestAttribute
    SceneGraphicsTestAttribute
    Implements
    ITestBuilder
    IImplyFixture
    ITestAction
    Inherited Members
    Attribute.Equals(object)
    Attribute.GetCustomAttribute(Assembly, Type)
    Attribute.GetCustomAttribute(Assembly, Type, bool)
    Attribute.GetCustomAttribute(MemberInfo, Type)
    Attribute.GetCustomAttribute(MemberInfo, Type, bool)
    Attribute.GetCustomAttribute(Module, Type)
    Attribute.GetCustomAttribute(Module, Type, bool)
    Attribute.GetCustomAttribute(ParameterInfo, Type)
    Attribute.GetCustomAttribute(ParameterInfo, Type, bool)
    Attribute.GetCustomAttributes(Assembly)
    Attribute.GetCustomAttributes(Assembly, bool)
    Attribute.GetCustomAttributes(Assembly, Type)
    Attribute.GetCustomAttributes(Assembly, Type, bool)
    Attribute.GetCustomAttributes(MemberInfo)
    Attribute.GetCustomAttributes(MemberInfo, bool)
    Attribute.GetCustomAttributes(MemberInfo, Type)
    Attribute.GetCustomAttributes(MemberInfo, Type, bool)
    Attribute.GetCustomAttributes(Module)
    Attribute.GetCustomAttributes(Module, bool)
    Attribute.GetCustomAttributes(Module, Type)
    Attribute.GetCustomAttributes(Module, Type, bool)
    Attribute.GetCustomAttributes(ParameterInfo)
    Attribute.GetCustomAttributes(ParameterInfo, bool)
    Attribute.GetCustomAttributes(ParameterInfo, Type)
    Attribute.GetCustomAttributes(ParameterInfo, Type, bool)
    Attribute.GetHashCode()
    Attribute.IsDefaultAttribute()
    Attribute.IsDefined(Assembly, Type)
    Attribute.IsDefined(Assembly, Type, bool)
    Attribute.IsDefined(MemberInfo, Type)
    Attribute.IsDefined(MemberInfo, Type, bool)
    Attribute.IsDefined(Module, Type)
    Attribute.IsDefined(Module, Type, bool)
    Attribute.IsDefined(ParameterInfo, Type)
    Attribute.IsDefined(ParameterInfo, Type, bool)
    Attribute.Match(object)
    Attribute.TypeId
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    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.

    Implements

    NUnit.Framework.Interfaces.ITestBuilder
    NUnit.Framework.Interfaces.IImplyFixture
    NUnit.Framework.ITestAction
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)