Class ImageAssert
Provides test assertion helpers for working with images.
Namespace: UnityEngine.TestTools.Graphics
Syntax
public class ImageAssert
Methods
AllocatesMemory(Camera, ImageComparisonSettings, Int32)
Render an image from the given camera and check if it allocated memory while doing so.
Declaration
public static void AllocatesMemory(Camera camera, ImageComparisonSettings settings = null, int gcAllocThreshold = 2)
Parameters
Type | Name | Description |
---|---|---|
Camera | camera | The camera to render from. |
ImageComparisonSettings | settings | |
Int32 | gcAllocThreshold |
AreEqual(Texture2D, Camera, ImageComparisonSettings)
Render an image from the given camera and compare it to the reference image.
Declaration
public static void AreEqual(Texture2D expected, Camera camera, ImageComparisonSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | expected | The expected image that should be rendered by the camera. |
Camera | camera | The camera to render from. |
ImageComparisonSettings | settings | Optional settings that control how the image comparison is performed. Can be null, in which case the rendered image is required to be exactly identical to the reference. |
AreEqual(Texture2D, IEnumerable<Camera>, ImageComparisonSettings)
Render an image from the given cameras and compare it to the reference image.
Declaration
public static void AreEqual(Texture2D expected, IEnumerable<Camera> cameras, ImageComparisonSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | expected | The expected image that should be rendered by the camera. |
IEnumerable<Camera> | cameras | The cameras to render from. |
ImageComparisonSettings | settings | Optional settings that control how the image comparison is performed. Can be null, in which case the rendered image is required to be exactly identical to the reference. |
AreEqual(Texture2D, Texture2D, ImageComparisonSettings)
Compares an image to a 'reference' image to see if it looks correct.
Declaration
public static void AreEqual(Texture2D expected, Texture2D actual, ImageComparisonSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | expected | What the image is supposed to look like. |
Texture2D | actual | What the image actually looks like. |
ImageComparisonSettings | settings | Optional settings that control how the comparison is performed. Can be null, in which case the images are required to be exactly identical. |