mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Add some AutoTranslatePayload.Text self-tests
This commit is contained in:
parent
9b224857f1
commit
374f9fcbd0
1 changed files with 52 additions and 0 deletions
|
|
@ -1,6 +1,9 @@
|
|||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Configuration.Internal;
|
||||
using Dalamud.Game.ClientState;
|
||||
using Dalamud.Game.Text.Evaluator;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
|
||||
using Lumina.Text.ReadOnly;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
|
||||
|
|
@ -75,6 +78,55 @@ internal class SeStringEvaluatorSelfTestStep : ISelfTestStep
|
|||
return SelfTestStepResult.Waiting;
|
||||
}
|
||||
|
||||
this.step++;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
ImGui.Text("Checking AutoTranslatePayload.Text results..."u8);
|
||||
|
||||
var config = Service<DalamudConfiguration>.Get();
|
||||
var originalLanguageOverride = config.LanguageOverride;
|
||||
|
||||
Span<(string Language, uint Group, uint Key, string ExpectedText)> tests = [
|
||||
("en", 49u, 209u, " albino karakul "), // Mount
|
||||
("en", 62u, 116u, " /echo "), // TextCommand - testing Command
|
||||
("en", 62u, 143u, " /dutyfinder "), // TextCommand - testing Alias over Command
|
||||
("en", 65u, 67u, " Minion of Light "), // Companion - testing noun handling for the german language (special case)
|
||||
("en", 71u, 7u, " Phantom Geomancer "), // MKDSupportJob
|
||||
|
||||
("de", 49u, 209u, " Albino-Karakul "), // Mount
|
||||
("de", 62u, 115u, " /freiegesellschaft "), // TextCommand - testing Alias over Command
|
||||
("de", 62u, 116u, " /echo "), // TextCommand - testing Command
|
||||
("de", 65u, 67u, " Begleiter des Lichts "), // Companion - testing noun handling for the german language (special case)
|
||||
("de", 71u, 7u, " Phantom-Geomant "), // MKDSupportJob
|
||||
];
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var (language, group, key, expectedText) in tests)
|
||||
{
|
||||
config.LanguageOverride = language;
|
||||
|
||||
var payload = new AutoTranslatePayload(group, key);
|
||||
|
||||
if (payload.Text != expectedText)
|
||||
{
|
||||
ImGui.Text($"Test failed for Group {group}, Key {key}");
|
||||
ImGui.Text($"Expected: {expectedText}");
|
||||
ImGui.Text($"Got: {payload.Text}");
|
||||
|
||||
if (ImGui.Button("Continue"u8))
|
||||
return SelfTestStepResult.Fail;
|
||||
|
||||
return SelfTestStepResult.Waiting;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
config.LanguageOverride = originalLanguageOverride;
|
||||
}
|
||||
|
||||
return SelfTestStepResult.Pass;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue