Skip to content

Commit

Permalink
Add Marking Localization Test (DeltaV-Station#1421)
Browse files Browse the repository at this point in the history
# Description

Actual localization strings added in different PR.

---

<details><summary><h1>Media</h1></summary>
<p>


![image](https://github.com/user-attachments/assets/cca4ae17-f75b-4c1a-8137-564a410e4563)

</p>
</details>

---

Co-authored-by: sleepyyapril <123355664+sleepyyapril@users.noreply.github.com>
  • Loading branch information
sapphirescript and sleepyyapril authored Jan 4, 2025
1 parent 25af801 commit c6f5309
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions Content.IntegrationTests/Tests/Markings/MarkingLocalizationTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Localization;
using Content.Shared.Humanoid.Markings;
using System.Linq;
using System.Collections.Generic;

namespace Content.IntegrationTests.Tests.Traits;

/// <summary>
/// Checks if every marking has a valid name localization string.
/// </summary>
[TestFixture]
[TestOf(typeof(MarkingPrototype))]
public sealed class MarkingLocalizationTest
{
[Test]
public async Task TestMarkingLocalization()
{
await using var pair = await PoolManager.GetServerClient();
var server = pair.Server;

var locale = server.ResolveDependency<ILocalizationManager>();
var proto = server.ResolveDependency<IPrototypeManager>();

await server.WaitAssertion(() =>
{
var missingStrings = new List<string>();

foreach (var markingProto in proto.EnumeratePrototypes<MarkingPrototype>().OrderBy(a => a.ID))
if (!locale.HasString($"marking-{markingProto.ID}") && string.IsNullOrEmpty(markingProto.Name))
missingStrings.Add($"\"{markingProto.ID}\", \"marking-{markingProto.ID}\"");

Assert.That(!missingStrings.Any(), Is.True, $"The following markings are missing localization strings:\n {string.Join("\n ", missingStrings)}");
});

await pair.CleanReturnAsync();
}
}

0 comments on commit c6f5309

Please sign in to comment.