Class ReferenceImageFileDescriptor
Default implementation that uses a pattern of "root.extension" or "rootinteger.extension".
Implements
Inherited Members
Namespace: UnityEngine.TestTools.Graphics
Assembly: UnityEngine.TestTools.Graphics.dll
Syntax
public class ReferenceImageFileDescriptor : IReferenceImageFileDescriptor
Constructors
ReferenceImageFileDescriptor(string, string, ImageExtension, TextureFormat)
Initializes a new instance with an explicit variant base.
Declaration
public ReferenceImageFileDescriptor(string root, string variantBase, ImageExtension extension, TextureFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| string | root | The root of the file name stem. |
| string | variantBase | The base for variants (for example "0"). |
| ImageExtension | extension | The file extension. |
| TextureFormat | format | The texture format. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when root or extension are null or empty. |
ReferenceImageFileDescriptor(string, ImageExtension, TextureFormat)
Initializes a new instance with a default integer variant base of "0".
Declaration
public ReferenceImageFileDescriptor(string root, ImageExtension extension, TextureFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| string | root | The root of the file name stem. |
| ImageExtension | extension | The file extension. |
| TextureFormat | format | The texture format. |
Properties
Extension
Gets the file extension.
Declaration
public ImageExtension Extension { get; }
Property Value
| Type | Description |
|---|---|
| ImageExtension |
Format
Gets the texture format associated with the reference image.
Declaration
public TextureFormat Format { get; }
Property Value
| Type | Description |
|---|---|
| TextureFormat |
Root
Gets the root part of the file name (stem without variant or extension).
Declaration
public string Root { get; }
Property Value
| Type | Description |
|---|---|
| string |
VariantBase
Gets the configured base for the variant (for example "0" for integers).
Declaration
public string VariantBase { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
BuildDefaultName()
Builds the default name stem without extension.
Declaration
public string BuildDefaultName()
Returns
| Type | Description |
|---|---|
| string | The default stem. |
BuildVariant(int)
Build the variant, using the variant at the specified index, starting from the provided base.
Declaration
public string BuildVariant(int i)
Parameters
| Type | Name | Description |
|---|---|---|
| int | i | Index of the variant, starting from the base |
Returns
| Type | Description |
|---|---|
| string | A variant name |
ToString()
Returns a string that describes the naming pattern used by this descriptor.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | A string describing the pattern. |
Overrides
TryParse(string, string)
Tries to validate and parse a filename against the expected root and extension.
Declaration
public bool TryParse(string filename, string expectedRoot)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filename | The filename to validate. |
| string | expectedRoot | The expected root to match. |
Returns
| Type | Description |
|---|---|
| bool | True if the filename matches the pattern and expected root; otherwise, false. |