Fixed save-as not updating RecentFile (#92)

This commit is contained in:
TheDiamondMiner
2022-06-28 17:09:37 +05:30
committed by GitHub
parent 95e5ee25c7
commit 1f721302eb
2 changed files with 16 additions and 0 deletions

View File

@@ -984,6 +984,7 @@ namespace HavenSoft.HexManiac.Core.ViewModels {
fileSystem.RemoveListenerForFile(viewPort.FileName, viewPort.ConsiderReload);
using (new StubDisposable { Dispose = () => fileSystem.AddListenerToFile(viewPort.FileName, viewPort.ConsiderReload) }) {
innerCommand.Execute(fileSystem);
UpdateRecentFiles(viewPort.FileName);
}
} else {
if (tab is ViewPort vp) vp.MaxDiffSegmentCount = this.maxDiffSegCount;

View File

@@ -631,6 +631,21 @@ ApplicationVersion = '''0.1.0'''
Assert.IsType<PokemonModel>(viewPort.Model);
}
[Fact]
public void Tab_SaveAs_UpdatesRecentFiles() {
var filename = "Test.gba";
editor.Add(new StubViewPort {
FileName = filename,
SaveAs = new StubCommand {
CanExecute = arg => true,
},
});
editor.SaveAs.Execute();
Assert.Contains(filename, editor.RecentFiles);
}
private StubTabContent CreateClosableTab() {
var tab = new StubTabContent();
var close = new StubCommand { CanExecute = arg => true };