Пример #1
0
        public void TextData_DoubleClick_OpenTextTool()
        {
            SetFullModel(0xFF);
            ViewPort.Edit("^bob\"\" \"Some Text\"");
            ViewPort.Tools.SelectedIndex = -1;
            var view = new StubView(ViewPort.Tools);

            ViewPort.FollowLink(0, 0);

            Assert.Contains(nameof(ViewPort.Tools.SelectedIndex), view.PropertyNotifications);
            Assert.IsType <PCSTool>(ViewPort.Tools[ViewPort.Tools.SelectedIndex]);
        }
Пример #2
0
        public void Insert00_Insert_SelectionTextMatchesSelection()
        {
            SetFullModel(0xFF);
            var lazyGuard = ViewPort.SelectedBytes;

            var view = new StubView(ViewPort);

            ViewPort.Edit("@!00(8) ");

            Assert.Equal(new Point(0, 0), ViewPort.SelectionStart);
            Assert.Equal(new Point(3, 0), ViewPort.SelectionEnd);
            Assert.Equal("Selected Bytes: 00 00 00 00", ViewPort.SelectedBytes.Trim());
            Assert.Contains(nameof(ViewPort.SelectedBytes), view.PropertyNotifications);
        }
Пример #3
0
        public void StreamElementViewModel_CallAutocomplete_ZIndexChanges()
        {
            Model.SetList("options", new[] { "PoisonPowder", "\"Poison Gas\"", "other" });
            Model.WritePointer(ViewPort.CurrentChange, 0x100, 0);
            var stream = new TableStreamRun(Model, 0, SortedSpan <int> .None, "[abc.options]", null, new FixedLengthStreamStrategy(2));

            Model.ObserveRunWritten(new NoDataChangeDeltaModel(), stream);
            var vm   = new TextStreamElementViewModel(ViewPort, 0x100, stream.FormatString);
            var view = new StubView(vm);

            Assert.Equal(0, vm.ZIndex);

            vm.GetAutoCompleteOptions(string.Empty, 0, 0);
            Assert.Equal(1, vm.ZIndex);

            vm.ClearAutocomplete();
            Assert.Equal(0, vm.ZIndex);
            Assert.Equal(2, view.PropertyNotifications.Count(pname => pname == nameof(vm.ZIndex)));
        }