fix broken tests

This commit is contained in:
haven1433 2023-09-08 06:52:14 -05:00
parent 81f988ede8
commit bc66dbf733
3 changed files with 6 additions and 1 deletions

View File

@ -71,6 +71,7 @@ namespace HavenSoft.HexManiac.Core.Models {
BattleScriptLines = new ScriptLine[0];
AnimationScriptLines = new ScriptLine[0];
BattleAIScriptLines = new ScriptLine[0];
DocReference = new Dictionary<string, IReadOnlyList<DocLabel>>();
WorkDispatcher = InstantDispatch.Instance;
CopyLimit = copyLimit;
PythonUtility = string.Empty;

View File

@ -1025,7 +1025,10 @@ namespace HavenSoft.HexManiac.Core.ViewModels {
public ViewPort(string fileName, IDataModel model, IWorkDispatcher dispatcher, Singletons singletons = null, MapTutorialsViewModel tutorials = null, IFileSystem fs = null, PythonTool pythonTool = null, ChangeHistory<ModelDelta> changeHistory = null, EventTemplate eventTemplate = null) {
Singletons = singletons ?? new Singletons();
this.docs = model.Count >= 0x100 && Singletons.DocReference.TryGetValue(model.GetGameCode().Substring(4), out var docs) ? docs : new List<DocLabel>();
this.docs = new List<DocLabel>();
if (model.Count >= 0x100 && Singletons.DocReference.TryGetValue(model.GetGameCode().Substring(4), out var docs)) {
this.docs = docs;
}
PythonTool = pythonTool;
ownsHistory = changeHistory == null;

View File

@ -14,6 +14,7 @@ namespace HavenSoft.HexManiac.Tests {
private readonly ScriptParser battle;
public ScriptTests() {
Model.LoadMetadata(BaseModel.GetDefaultMetadatas().First()); // load default script-related lists, like script_compare
battle = ViewPort.Tools.CodeTool.BattleScriptParser;
}