Skip to content

Commit

Permalink
Merge pull request #127 from SkiTles55/transfer-progress
Browse files Browse the repository at this point in the history
Progress transfer function
  • Loading branch information
SkiTles55 authored Jan 4, 2024
2 parents 88e7a6b + 6d371f1 commit 81b4a8a
Show file tree
Hide file tree
Showing 45 changed files with 1,853 additions and 177 deletions.
28 changes: 14 additions & 14 deletions SPT-AKI Profile Editor.Tests/AppLocalizationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@ public void Setup()
[Test]
public void CreatedEnLocalizationCorrect() => CheckLocalization("en", "English");

private void CheckLocalization(string localeKey, string localeName)
{
appLocalization.LoadLocalization(localeKey);
var expected = DefaultValues.DefaultLocalizations().Find(x => x.Key == localeKey);
Assert.That(appLocalization.Translations.Count,
Is.EqualTo(expected.Translations.Count),
$"{localeName} localization strings count not correct");
Assert.That(expected.Translations.Any(x => !appLocalization.Translations.ContainsKey(x.Key)),
Is.False,
$"{localeName} localization does not have all strings");
}

[Test]
public void CreatedRuLocalizationCorrect() => CheckLocalization("ru", "Russian");

Expand All @@ -56,8 +44,8 @@ public void LoadedLocalizationCorrect()
[Test]
public void LocalizationsDictionaryCorrect()
{
var expected = DefaultValues.DefaultLocalizations().ToDictionary(x => x.Key, x => x.Name);
Assert.That(appLocalization.Translations.Count,
var expected = DefaultValues.DefaultLocalizations().ToDictionary(x => x.Key, x => x.Name).Count;
Assert.That(appLocalization.Localizations.Count,
Is.EqualTo(expected),
"Localizations dictionary not correct");
}
Expand All @@ -79,5 +67,17 @@ public void CanLoadEnInsteadOfUnknown()
Assert.That(appLocalization.GetLocalizedString(expected.Key), Is.EqualTo(expected.Value), "En LocalizedString not correct");
Assert.That(AppData.AppSettings.Language, Is.EqualTo("en"), "En not loaded");
}

private void CheckLocalization(string localeKey, string localeName)
{
appLocalization.LoadLocalization(localeKey);
var expected = DefaultValues.DefaultLocalizations().Find(x => x.Key == localeKey);
Assert.That(appLocalization.Translations.Count,
Is.EqualTo(expected.Translations.Count),
$"{localeName} localization strings count not correct");
Assert.That(expected.Translations.Any(x => !appLocalization.Translations.ContainsKey(x.Key)),
Is.False,
$"{localeName} localization does not have all strings");
}
}
}
2 changes: 1 addition & 1 deletion SPT-AKI Profile Editor.Tests/CleaningServiceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private static void AddModdedQuest(JObject profileJObject, string character, str
var questsObject = profileJObject.SelectToken("characters")[character].SelectToken("Quests");
if (!questsObject.HasValues)
{
var newQuests = new CharacterQuest[] { new CharacterQuest { Qid = questQid } };
var newQuests = new CharacterQuest[] { new() { Qid = questQid } };
questsObject.Replace(JToken.FromObject(newQuests));
}
else
Expand Down
7 changes: 7 additions & 0 deletions SPT-AKI Profile Editor.Tests/Hepers/TestHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,12 @@ public static void LoadDatabase()
AppData.AppSettings.ServerPath = serverPath;
AppData.LoadDatabase();
}

public static void SaveAndLoadProfile(string filename)
{
string testFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, filename);
AppData.Profile.Save(profileFile, testFile);
AppData.Profile.Load(testFile);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,17 @@ public Task<GitHubRelease> CheckUpdate()
public IEnumerable<AccentItem> GetColorSchemes()
{
return new List<AccentItem>() {
new AccentItem("test1", "test1", "test1"),
new AccentItem("test2", "test2", "test2")
new("test1", "test1", "test1"),
new("test2", "test2", "test2")
};
}

public void OpenContainerWindow(InventoryItem item, CharacterInventory inventory, bool editingAllowed) => ContainerWindowOpened = true;

public void OpenUrl(string url) => LastOpenedUrl = url;

public void OpenDiscord() { }
public void OpenDiscord()
{ }

public void OpenWeaponBuildWindow(InventoryItem item, CharacterInventory inventory, bool editingAllowed) => WeaponBuildWindowOpened = true;

Expand Down
7 changes: 6 additions & 1 deletion SPT-AKI Profile Editor.Tests/Hepers/TestsWindowsDialogs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public TestsWindowsDialogs()
};
}

public (bool success, string path, string[] paths) OpenBuildDialog()
public (bool success, string path, string[] paths) OpenBuildDialog(bool multiselect = true)
{
return folderBrowserDialogMode switch
{
Expand All @@ -69,6 +69,11 @@ public TestsWindowsDialogs()

public (bool success, string path) SaveEquipmentBuildDialog(string name) => (true, equipmentBuildExportPath);

public (bool success, string path) SaveProfileProgressDialog(string name)
{
throw new NotImplementedException();
}

private static void PrepareTestPaths(string filePath, string directoryPath)
{
if (File.Exists(filePath))
Expand Down
Loading

0 comments on commit 81b4a8a

Please sign in to comment.