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 |
DescribeActual(ITextureComparisonResult)
Describes the measured values of a comparison result produced by this algorithm, as named values for structured result reporting. The algorithm owns the keys. Returns null when the algorithm does not provide structured values (or the result is not one of its own); reporting then falls back to the result's ToString().
Declaration
public override IReadOnlyDictionary<string, object> DescribeActual(ITextureComparisonResult result)
Parameters
| Type | Name | Description |
|---|---|---|
| ITextureComparisonResult | result | The result of a comparison run by this algorithm. |
Returns
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, object> | The measured values as named values, or null. |
Overrides
DescribeExpected()
Describes the thresholds this algorithm compares against, as named values for structured result reporting. The algorithm owns the keys. Returns null when the algorithm does not provide structured values; reporting then falls back to Description.
Declaration
public override IReadOnlyDictionary<string, object> DescribeExpected()
Returns
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, object> | The configured thresholds as named values, or null. |
Overrides
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 |