Exemple #1
0
        public void StreamElementViewModel_AutocompleteWithNoCompletion_ZIndexDoesNotChange()
        {
            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);

            vm.GetAutoCompleteOptions("xzy", 0, 3);

            Assert.Equal(0, vm.ZIndex);
        }
Exemple #2
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)));
        }