fix broken tests

This commit is contained in:
haven1433 2023-06-26 23:22:36 -05:00
parent 2379814133
commit edd2ee1c36
4 changed files with 20 additions and 6 deletions

View File

@ -203,8 +203,13 @@ namespace HavenSoft.HexManiac.Core.ViewModels.Tools {
var (start, end) = (selection.Scroll.ViewPointToDataIndex(selection.SelectionStart), selection.Scroll.ViewPointToDataIndex(selection.SelectionEnd));
var array = (ITableRun)model.GetNextRun(address);
start -= array.ElementLength;
end -= array.ElementLength;
if (array.Start <= start && start < array.Start + array.Length && array.Start <= end && end < array.Start + array.Length) {
start -= array.ElementLength;
end -= array.ElementLength;
} else {
start = address - array.ElementLength;
end = address - 1;
}
selection.SelectionStart = selection.Scroll.DataIndexToViewPoint(start);
selection.SelectionEnd = selection.Scroll.DataIndexToViewPoint(end);
}
@ -222,8 +227,13 @@ namespace HavenSoft.HexManiac.Core.ViewModels.Tools {
var (start, end) = (selection.Scroll.ViewPointToDataIndex(selection.SelectionStart), selection.Scroll.ViewPointToDataIndex(selection.SelectionEnd));
var array = (ITableRun)model.GetNextRun(address);
start += array.ElementLength;
end += array.ElementLength;
if (array.Start <= start && start < array.Start + array.Length && array.Start <= end && end < array.Start + array.Length) {
start += array.ElementLength;
end += array.ElementLength;
} else {
start = address + array.ElementLength;
end = address + array.ElementLength * 2 - 1;
}
selection.SelectionStart = selection.Scroll.DataIndexToViewPoint(start);
selection.SelectionEnd = selection.Scroll.DataIndexToViewPoint(end);
}

View File

@ -30,7 +30,7 @@ namespace HavenSoft.HexManiac.Integration {
}
[SkippableFact]
public void BrockScript_ExpandSelection_EntireScriptSelected() {
public void BrockScript_ExpandSelection_MultipleSectionsSelected() {
var firered = LoadReadOnlyFireRed();
firered.Goto.Execute("data.maps.banks/6/maps/2/map/0/events/0/objects/0/script/");
@ -39,7 +39,7 @@ namespace HavenSoft.HexManiac.Integration {
var firstAddress = firered.ConvertViewPointToAddress(firered.SelectionStart);
var lastAddress = firered.ConvertViewPointToAddress(firered.SelectionEnd);
var length = lastAddress - firstAddress + 1;
Assert.Equal(171, length);
Assert.Equal(95, length);
}
[SkippableFact]

View File

@ -45,6 +45,8 @@
del "$(TargetDir)Models\Code\*.toml"
copy "$(TargetDir)Models\Code\*.hma" "$(TargetDir)resources"
del "$(TargetDir)Models\Code\*.hma"
copy "$(TargetDir)Models\Code\*.py" "$(TargetDir)resources"
del "$(TargetDir)Models\Code\*.py"
copy "$(SolutionDir)src\HexManiac.WPF\Scripts\*.hma" "$(TargetDir)resources\Scripts"
</PostBuildEvent>
</PropertyGroup>

View File

@ -61,6 +61,8 @@
del "$(TargetDir)Models\Code\*.toml"
copy "$(TargetDir)Models\Code\*.hma" "$(TargetDir)resources"
del "$(TargetDir)Models\Code\*.hma"
copy "$(TargetDir)Models\Code\*.py" "$(TargetDir)resources"
del "$(TargetDir)Models\Code\*.py"
copy "$(SolutionDir)src\HexManiac.WPF\Scripts\*.hma" "$(TargetDir)resources\Scripts"
</PostBuildEvent>
</PropertyGroup>