Class EqualToTextureConstraint
Constraint that verifies whether a texture is equal to an expected texture using a specified comparison algorithm.
Implements
Inherited Members
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
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
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. |