mirror of
https://github.com/haven1433/HexManiacAdvance.git
synced 2026-10-01 04:36:35 -05:00
fix failing tests
several tests expect AllowMultipleElementsPerLine = true
This commit is contained in:
@@ -2200,7 +2200,7 @@ namespace HavenSoft.HexManiac.Core.ViewModels {
|
||||
#endregion
|
||||
|
||||
public IChildViewPort CreateChildView(int startAddress, int endAddress) {
|
||||
var child = new ChildViewPort(this, dispatcher, Singletons) { PreferredWidth = 16, Width = Math.Min(24, Width) };
|
||||
var child = new ChildViewPort(this, dispatcher, Singletons) { AllowMultipleElementsPerLine = true, PreferredWidth = 16, Width = Math.Min(24, Width) };
|
||||
|
||||
var run = Model.GetNextRun(startAddress);
|
||||
if (run is ArrayRun array) {
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace HavenSoft.HexManiac.Tests {
|
||||
New = new New(FileSystem, Singletons);
|
||||
Data = new byte[modelLength];
|
||||
Model = new PokemonModel(Data, singletons: Singletons);
|
||||
ViewPort = new ViewPort("file.txt", Model, InstantDispatch.Instance, Singletons) { Width = 0x10, Height = 0x10 };
|
||||
ViewPort = new ViewPort("file.txt", Model, InstantDispatch.Instance, Singletons) { AllowMultipleElementsPerLine = true, Width = 0x10, Height = 0x10 };
|
||||
ViewPort.OnError += (sender, e) => { if (!string.IsNullOrEmpty(e)) Errors.Add(e); };
|
||||
ViewPort.OnMessage += (sender, e) => Messages.Add(e);
|
||||
}
|
||||
|
||||
@@ -1157,7 +1157,7 @@ namespace HavenSoft.HexManiac.Tests {
|
||||
private static void StandardSetup(out byte[] data, out PokemonModel model, out ViewPort viewPort) {
|
||||
data = new byte[0x200];
|
||||
model = new PokemonModel(data);
|
||||
viewPort = new ViewPort("file.txt", model, InstantDispatch.Instance, BaseViewModelTestClass.Singletons) { Width = 0x10, Height = 0x10 };
|
||||
viewPort = new ViewPort("file.txt", model, InstantDispatch.Instance, BaseViewModelTestClass.Singletons) { AllowMultipleElementsPerLine = true, Width = 0x10, Height = 0x10 };
|
||||
}
|
||||
|
||||
private static void WriteStrings(byte[] buffer, int start, params string[] content) {
|
||||
|
||||
@@ -458,7 +458,7 @@ namespace HavenSoft.HexManiac.Tests {
|
||||
private void StandardSetup(out byte[] data, out PokemonModel model, out ViewPort viewPort) {
|
||||
data = Enumerable.Repeat((byte)0xFF, 0x200).ToArray();
|
||||
model = new PokemonModel(data);
|
||||
viewPort = new ViewPort("file.txt", model, InstantDispatch.Instance, BaseViewModelTestClass.Singletons) { Width = 0x10, Height = 0x10 };
|
||||
viewPort = new ViewPort("file.txt", model, InstantDispatch.Instance, BaseViewModelTestClass.Singletons) { AllowMultipleElementsPerLine = true, Width = 0x10, Height = 0x10 };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace HavenSoft.HexManiac.Tests {
|
||||
|
||||
public NestedTablesTests() {
|
||||
model = new PokemonModel(data);
|
||||
viewPort = new ViewPort("file.txt", model, InstantDispatch.Instance) { Width = 0x10, Height = 0x10 };
|
||||
viewPort = new ViewPort("file.txt", model, InstantDispatch.Instance) { AllowMultipleElementsPerLine = true, Width = 0x10, Height = 0x10 };
|
||||
viewPort.OnError += (sender, e) => errors.Add(e);
|
||||
viewPort.OnMessage += (sender, e) => messages.Add(e);
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
using HavenSoft.HexManiac.Core;
|
||||
using HavenSoft.HexManiac.Core.Models;
|
||||
using HavenSoft.HexManiac.Core.Models.Runs;
|
||||
using HavenSoft.HexManiac.Core.Models.Runs.Sprites;
|
||||
using HavenSoft.HexManiac.Core.ViewModels;
|
||||
using HavenSoft.HexManiac.Core.ViewModels.Visitors;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Xunit;
|
||||
|
||||
namespace HavenSoft.HexManiac.Tests {
|
||||
public class ViewPortCursorTests {
|
||||
private ViewPort NewViewPort(LoadedFile file) => new ViewPort(file) { AllowMultipleElementsPerLine = true, Width = 5, Height = 5 };
|
||||
|
||||
[Fact]
|
||||
public void CursorCanMoveAllFourDirections() {
|
||||
var loadedFile = new LoadedFile("test", new byte[25]);
|
||||
@@ -106,7 +105,7 @@ namespace HavenSoft.HexManiac.Tests {
|
||||
[Fact]
|
||||
public void ScrollingUpdatesSelection() {
|
||||
var loadedFile = new LoadedFile("test", new byte[25]);
|
||||
var viewPort = new ViewPort(loadedFile) { Width = 5, Height = 5 };
|
||||
var viewPort = NewViewPort(loadedFile);
|
||||
|
||||
viewPort.SelectionStart = new Point(0, 2);
|
||||
viewPort.SelectionEnd = new Point(4, 2);
|
||||
@@ -119,7 +118,7 @@ namespace HavenSoft.HexManiac.Tests {
|
||||
[Fact]
|
||||
public void ForwardSelectionWorks() {
|
||||
var loadedFile = new LoadedFile("test", new byte[25]);
|
||||
var viewPort = new ViewPort(loadedFile) { Width = 5, Height = 5 };
|
||||
var viewPort = NewViewPort(loadedFile);
|
||||
|
||||
viewPort.SelectionStart = new Point(2, 1);
|
||||
viewPort.SelectionEnd = new Point(3, 3);
|
||||
@@ -130,7 +129,7 @@ namespace HavenSoft.HexManiac.Tests {
|
||||
[Fact]
|
||||
public void BackSelectionWorks() {
|
||||
var loadedFile = new LoadedFile("test", new byte[25]);
|
||||
var viewPort = new ViewPort(loadedFile) { Width = 5, Height = 5 };
|
||||
var viewPort = NewViewPort(loadedFile);
|
||||
|
||||
viewPort.SelectionStart = new Point(3, 3);
|
||||
viewPort.SelectionEnd = new Point(2, 1);
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace HavenSoft.HexManiac.Tests {
|
||||
this.singletons = singletons;
|
||||
}
|
||||
|
||||
public EditorViewModel EditorViewModel() => new EditorViewModel(fs, singletons.WorkDispatcher, false);
|
||||
public EditorViewModel EditorViewModel() => new EditorViewModel(fs, singletons.WorkDispatcher, false) { AllowMultipleElementsPerLine = true };
|
||||
|
||||
public IDataModel PokemonModel(byte[] data, StoredMetadata metadata) => new PokemonModel(data, metadata, singletons);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user