From a83e380991dda4e53e6dca0d4f5b2fbda115ddae Mon Sep 17 00:00:00 2001 From: Benjamin Popp Date: Fri, 11 Sep 2020 07:08:06 -0500 Subject: [PATCH] Refactor --- .../Models/Code/scriptReference.txt | 2 +- .../Before_Baseclass/ToolTests.cs | 17 +++++------------ src/HexManiac.Tests/ImageEditorTests.cs | 4 ++-- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/HexManiac.Core/Models/Code/scriptReference.txt b/src/HexManiac.Core/Models/Code/scriptReference.txt index f0eda13a..c770d012 100644 --- a/src/HexManiac.Core/Models/Code/scriptReference.txt +++ b/src/HexManiac.Core/Models/Code/scriptReference.txt @@ -170,7 +170,7 @@ 76 hidepokepic # hides all shown pokepics 77 showcontestwinner contest. # nop in FireRed. Shows the painting of a wenner of the given contest. 78 braille text<> # displays a message in braille. The text must be formatted to use braille. -79 givePokemon species:data.pokemon.names level. item: filler:: filler:: filler. +79 givePokemon species:data.pokemon.names level. item: filler. filler:: filler:: # gives the player one of that pokemon. the last 9 bytes are all 00. # 800D=0 if it was added to the party # 800D=1 if it was put in the PC diff --git a/src/HexManiac.Tests/Before_Baseclass/ToolTests.cs b/src/HexManiac.Tests/Before_Baseclass/ToolTests.cs index 14b8f1cf..57d61035 100644 --- a/src/HexManiac.Tests/Before_Baseclass/ToolTests.cs +++ b/src/HexManiac.Tests/Before_Baseclass/ToolTests.cs @@ -14,6 +14,9 @@ using Xunit; namespace HavenSoft.HexManiac.Tests { public class ToolTests : BaseViewModelTestClass { + private readonly ThumbParser parser; + public ToolTests() => parser = new ThumbParser(Singletons); + [Fact] public void ViewPortHasTools() { var viewPort = new ViewPort(new LoadedFile("file.txt", new byte[100])); @@ -90,11 +93,8 @@ namespace HavenSoft.HexManiac.Tests { [Fact] public void HideCommandClosesAnyOpenTools() { - var model = new PokemonModel(new byte[0x200]); - var history = new ChangeHistory(null); - var tools = new ToolTray(singletons, model, new Selection(new ScrollRegion(), model), history, null) { - SelectedIndex = 1 - }; + var tools = ViewPort.Tools; + tools.SelectedIndex = 1; tools.HideCommand.Execute(); Assert.Equal(-1, tools.SelectedIndex); @@ -614,12 +614,5 @@ namespace HavenSoft.HexManiac.Tests { Assert.EndsWith("/2", tableTool.CurrentElementName); } - - private static readonly Singletons singletons; - private static readonly ThumbParser parser; - static ToolTests() { - singletons = new Singletons(); - parser = new ThumbParser(singletons); - } } } diff --git a/src/HexManiac.Tests/ImageEditorTests.cs b/src/HexManiac.Tests/ImageEditorTests.cs index 691128e9..85b99191 100644 --- a/src/HexManiac.Tests/ImageEditorTests.cs +++ b/src/HexManiac.Tests/ImageEditorTests.cs @@ -37,8 +37,8 @@ namespace HavenSoft.HexManiac.Tests { [Fact] public void NewColor_Draw_PixelsChange() { var palette = editor.Palette; - palette.Elements[0].Color = Rgb(31, 31, 31); - palette.Elements[0].Selected = true; + palette.Elements[1].Color = Rgb(31, 31, 31); + palette.Elements[1].Selected = true; editor.ToolDown(new Point(0, 0)); editor.ToolUp(new Point(0, 0));