docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class EqualToTextureConstraint

    Constraint that verifies whether a texture is equal to an expected texture using a specified comparison algorithm.

    Inheritance
    object
    Constraint
    EqualToTextureConstraint
    Implements
    IConstraint
    IResolveConstraint
    Inherited Members
    Constraint.ApplyTo<TActual>(ActualValueDelegate<TActual>)
    Constraint.ApplyTo<TActual>(ref TActual)
    Constraint.GetTestObject<TActual>(ActualValueDelegate<TActual>)
    Constraint.ToString()
    Constraint.GetStringRepresentation()
    Constraint.After(int)
    Constraint.After(int, int)
    Constraint.DisplayName
    Constraint.Arguments
    Constraint.Builder
    Constraint.And
    Constraint.With
    Constraint.Or
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.TestTools.Graphics
    Assembly: UnityEngine.TestTools.Graphics.dll
    Syntax
    public class EqualToTextureConstraint : Constraint, IConstraint, IResolveConstraint

    Constructors

    EqualToTextureConstraint(Texture2D)

    Initializes a new instance of the EqualToTextureConstraint class with the expected texture.

    Declaration
    public EqualToTextureConstraint(Texture2D expected)
    Parameters
    Type Name Description
    Texture2D expected

    The texture expected in the comparison.

    Properties

    Description

    Gets the description of the constraint, based on the comparison algorithm used.

    Declaration
    public override string Description { get; }
    Property Value
    Type Description
    string
    Overrides
    NUnit.Framework.Constraints.Constraint.Description

    Methods

    ApplyTo(object)

    Applies the constraint to the actual value and determines if it matches the expected texture.

    Declaration
    public override ConstraintResult ApplyTo(object actual)
    Parameters
    Type Name Description
    object actual

    The actual value to compare, which must be a Texture2D.

    Returns
    Type Description
    ConstraintResult

    A NUnit.Framework.Constraints.ConstraintResult indicating whether the actual texture matches the expected texture.

    Overrides
    Constraint.ApplyTo(object)
    Exceptions
    Type Condition
    ArgumentException

    Thrown if the actual value is not a Texture2D.

    InvalidOperationException

    Thrown if no comparison algorithm is specified.

    Using(TextureComparisonAlgorithm)

    Specifies the algorithm to use for texture comparison.

    Declaration
    public EqualToTextureConstraint Using(TextureComparisonAlgorithm algorithm)
    Parameters
    Type Name Description
    TextureComparisonAlgorithm algorithm

    The TextureComparisonAlgorithm to use for comparison.

    Returns
    Type Description
    EqualToTextureConstraint

    This constraint instance, allowing for fluent configuration.

    Implements

    NUnit.Framework.Constraints.IConstraint
    NUnit.Framework.Constraints.IResolveConstraint
    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)