Class LocalizationAddressablesTestCleanup
Removes the Addressables groups and labels Unity Localization's own package machinery auto-creates per
locale, which live under Assets/AddressableAssetsData rather than any fixture's own temp folder
and so survive that fixture's path-prefix Addressables-entry sweep entirely. Shared by every Localization
editor test fixture that registers ephemeral locales, and by the pattern-based sweeps in
LocalizationEphemeralGroupGuard and LocalizationTestGroupLeakSentinel, so the
cleanup is written once instead of copied per file.
Inherited Members
Namespace: Serenity.Localization.Tests.Editor
Assembly: Serenity.Localization.Tests.Editor.dll
Syntax
public static class LocalizationAddressablesTestCleanup
Remarks
Without this, every fixture locale leaves a group asset (plus its schema assets and a per-locale label) behind on every run — the exact Addressables pollution the project forbids tests from causing.
Methods
IsEphemeralFixtureGroupName(string)
Whether groupName is one of the ephemeral per-locale groups Unity Localization
creates for a fixture's pseudo-locale codes ("zt-*" and "zpk{digit}"). These codes are reserved by
the Localization test fixtures; no real project group may use them, so any group matching this
pattern is a test leak, never a legitimate asset.
Declaration
public static bool IsEphemeralFixtureGroupName(string groupName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | groupName |
Returns
| Type | Description |
|---|---|
| bool |
IsEphemeralFixtureLabelName(string)
Whether labelName is one of the ephemeral per-locale labels ("Locale-zt-*",
"Locale-zpk{digit}") Unity Localization adds to the Addressables settings alongside the per-locale
groups. Same reservation rule as IsEphemeralFixtureGroupName(string): no real label may use
the fixture codes.
Declaration
public static bool IsEphemeralFixtureLabelName(string labelName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | labelName |
Returns
| Type | Description |
|---|---|
| bool |
RemoveEphemeralGroups(AddressableAssetSettings)
Removes every group matching IsEphemeralFixtureGroupName(string), regardless of which fixture created it. The pattern-based counterpart of RemoveGroupsAndLabelsCreatedForLocales(IEnumerable<string>) for callers that cannot know the codes (the guard's tick sweep and the sentinel).
Declaration
public static List<string> RemoveEphemeralGroups(AddressableAssetSettings settings)
Parameters
| Type | Name | Description |
|---|---|---|
| AddressableAssetSettings | settings | The Addressables settings to sweep. |
Returns
| Type | Description |
|---|---|
| List<string> | The removed group names, empty when nothing matched. |
RemoveEphemeralLabels(AddressableAssetSettings)
Removes every ephemeral per-locale label from the settings, regardless of which fixture created it. The label counterpart of RemoveEphemeralGroups(AddressableAssetSettings).
Declaration
public static List<string> RemoveEphemeralLabels(AddressableAssetSettings settings)
Parameters
| Type | Name | Description |
|---|---|---|
| AddressableAssetSettings | settings | The Addressables settings to sweep. |
Returns
| Type | Description |
|---|---|
| List<string> | The removed label names, empty when nothing matched. |
RemoveGroupsAndLabelsCreatedForLocales(IEnumerable<string>)
Removes the per-locale Addressables groups and labels Unity Localization created for
localeCodes, if any. The fixture-facing entry point: call it from
[TearDown] with the locale codes the fixture registered.
Declaration
public static void RemoveGroupsAndLabelsCreatedForLocales(IEnumerable<string> localeCodes)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<string> | localeCodes |