public void CanGotoSecondNamedElementWithSameName() { var test = new BaseViewModelTestClass(); test.CreateTextTable("names", 0x100, "Adam Bob Carl Dave Eric Dave Fred Greg Hal Jim".Split(" ")); test.ViewPort.Edit("@00 ^table[content.]names "); test.ViewPort.Goto.Execute("table/Dav~2"); Assert.Equal(5, test.ViewPort.DataOffset); }
public void NameListWithTwoOfSameElementWithSpace_EnterSecondOption_CompleteCorrect() { var test = new BaseViewModelTestClass(); test.CreateTextTable("names", 0x100, "default", "Some Element", "Some Element"); test.CreateEnumTable("enums", 0, "names", 0, 0); test.ViewPort.Goto.Execute(0); test.ViewPort.Edit("\"Some Element~2\""); Assert.Equal(2, test.Model[0]); }
public void NameList_TypeNameWithSingleQuote_AutocompleteCorrect() { var test = new BaseViewModelTestClass(); test.CreateTextTable("names", 0x100, "Basic", "Quote'n'space Element"); test.CreateEnumTable("enums", 0, "names", 0, 0); test.ViewPort.Goto.Execute(0); test.ViewPort.Edit("\"Quote'\""); Assert.Equal(1, test.Model[0]); }
public void AutocompletePicksExpectedElementAndMovesToNextElement() { var test = new BaseViewModelTestClass(); test.CreateTextTable(HardcodeTablesModel.MoveNamesTable, 0x100, "Tackle", "Fire Punch", "Earthquake", "Psycho Boost"); test.CreateEnumTable("pokemoves", 0x00, HardcodeTablesModel.MoveNamesTable, 0, 1, 2, 3); test.ViewPort.Edit("@04 firepunch "); Assert.Equal(1, test.Model.ReadMultiByteValue(0x04, 2)); Assert.Equal(new Point(2, 0), test.ViewPort.SelectionStart); Assert.Equal($"pokemoves/3{Environment.NewLine}pokemoves/\"Psycho Boost\"", test.ViewPort.Tools.TableTool.CurrentElementName); }
public void PlmPointersMoveWhenPlmTableSourceMoves() { var source = new BaseViewModelTestClass(); source.CreateTextTable(HardcodeTablesModel.MoveNamesTable, 0x100, "A B C D E F G".Split(' ')); // Arrange: write the data for a table @0 pointing to PLM run @4. source.Model.WriteMultiByteValue(4, 2, new ModelDelta(), 0x0404); // learn E at level 2 source.Model.WriteMultiByteValue(6, 2, new ModelDelta(), 0xFFFF); // end of stream source.Model.WritePointer(new ModelDelta(), 0, 4); // @0 <000004> source.ViewPort.Goto.Execute("00"); source.ViewPort.Edit($"^{HardcodeTablesModel.LevelMovesTableName}[moves<{PLMRun.SharedFormatString}>]1 "); // Act: extend the PLM table. Note that this will automatically move it to avoid hitting the data @4. source.ViewPort.Goto.Execute("04"); source.ViewPort.Edit("+"); // Assert: the PLMRun at 04 should not have moved. There should be two things pointing to it, since the extended table got a new pointer. var newTableStart = source.Model.GetAddressFromAnchor(new ModelDelta(), -1, HardcodeTablesModel.LevelMovesTableName); var plmRun = (PLMRun)source.Model.GetNextRun(4); Assert.Equal(2, plmRun.PointerSources.Count); Assert.Equal(newTableStart, plmRun.PointerSources[0]); }