mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 11:40:52 +01:00
* sloth is so going to kill me * the voices in my head told me to do this * Register ILocalizationManagerInternal on client * Avoid breaking change * Cleanup * Release notes
45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using NUnit.Framework;
|
|
using Robust.Shared.ContentPack;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Localization;
|
|
using Robust.Shared.Log;
|
|
|
|
namespace Robust.UnitTesting.Shared.Localization;
|
|
|
|
[TestFixture]
|
|
public sealed class LoadLocalizationTest : RobustUnitTest
|
|
{
|
|
private const string DuplicateTerm = @"
|
|
term1 = 1
|
|
term1 = 2
|
|
";
|
|
protected override void OverrideIoC()
|
|
{
|
|
base.OverrideIoC();
|
|
|
|
IoCManager.Register<ILogManager, SpyLogManager>(overwrite: true);
|
|
}
|
|
|
|
|
|
[Test]
|
|
public void TestLoadLocalization()
|
|
{
|
|
var res = IoCManager.Resolve<IResourceManagerInternal>();
|
|
res.MountString("/Locale/en-US/a.ftl", DuplicateTerm);
|
|
|
|
var loc = IoCManager.Resolve<ILocalizationManager>();
|
|
loc.Initialize();
|
|
|
|
var spyLog = (SpyLogManager) IoCManager.Resolve<ILogManager>();
|
|
var culture = new CultureInfo("en-US", false);
|
|
|
|
var x = spyLog.CountError;
|
|
loc.LoadCulture(culture);
|
|
Assert.That(spyLog.CountError, NUnit.Framework.Is.GreaterThan(x));
|
|
}
|
|
}
|
|
|