Ejemplo n.º 1
0
        public void PointerGetsSetToZeroAfterAnchorGetsDeleted()
        {
            var buffer   = new byte[0x100];
            var model    = new PokemonModel(buffer);
            var viewPort = new ViewPort("file.txt", model)
            {
                Width = 0x10, Height = 0x10
            };
            var token = new ModelDelta();

            viewPort.SelectionStart = new Point(0, 1);
            viewPort.Edit("^bob ");
            viewPort.SelectionStart = new Point(0, 2);
            viewPort.Edit("<bob>");
            viewPort.SelectionStart = new Point(0, 1);

            // as an alternative to being able to delete an anchor from the viewPort,
            // just edit the model directly and then scroll to force the viewPort to refresh
            model.ClearFormatAndData(token, 0xF, 2);
            viewPort.ScrollValue = 1;
            viewPort.ScrollValue = 0;

            Assert.Equal(Pointer.NULL, ((Pointer)viewPort[0, 2].Format).Destination);
        }