Class LegacyColorDifferenceAlgorithm
The algorithm that was initially used with ImageAssert.AreEqual
Inherited Members
Namespace: UnityEngine.TestTools.Graphics.LegacyColorDifference
Assembly: UnityEngine.TestTools.Graphics.dll
Syntax
public class LegacyColorDifferenceAlgorithm : TextureComparisonAlgorithm
Constructors
LegacyColorDifferenceAlgorithm(ImageComparisonSettings)
Instantiates the algorithm with the right thresholds, based on the legacy settings
Declaration
public LegacyColorDifferenceAlgorithm(ImageComparisonSettings settings)
Parameters
| Type | Name | Description |
|---|---|---|
| ImageComparisonSettings | settings | Settings including the thresholds and enabled tests |
Methods
Compare(Texture2D, Texture2D)
Compares the two given texture using the algorithm
Declaration
public override ITextureComparisonResult Compare(Texture2D expected, Texture2D actual)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture2D | expected | The expected texture |
| Texture2D | actual | The actual texture |
Returns
| Type | Description |
|---|---|
| ITextureComparisonResult | A comparison result |
Overrides
Compare(Texture2D[], Texture2D[])
Compare two arrays of texture
Declaration
public override ITextureComparisonResult Compare(Texture2D[] expected, Texture2D[] actual)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture2D[] | expected | Expected textures |
| Texture2D[] | actual | Actual textures |
Returns
| Type | Description |
|---|---|
| ITextureComparisonResult | The result of the comparison |
Overrides
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Not Supported for this algorithm |
CompareAsync(Texture2D, Texture2D)
This is not supported yet.
Declaration
public override Task<ITextureComparisonResult> CompareAsync(Texture2D expected, Texture2D actual)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture2D | expected | expected |
| Texture2D | actual | actual |
Returns
| Type | Description |
|---|---|
| Task<ITextureComparisonResult> | An exception |
Overrides
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | There is no working implementation for this method right now |
Evaluate(ITextureComparisonResult)
This is used in conjunction with the NUnit constraint so that the algorithm can be outside the ImageAssert class with a nice syntax.
Declaration
public override (object, bool) Evaluate(ITextureComparisonResult result)
Parameters
| Type | Name | Description |
|---|---|---|
| ITextureComparisonResult | result | The result of the comparison |
Returns
| Type | Description |
|---|---|
| (object, bool) | A tuple with the result and whether the assertion passed or failed |