Example #1
0
        private void Create2(
            ModeKind kind = ModeKind.VisualCharacter,
            params string[] lines)
        {
            _textView   = EditorUtil.CreateTextView(lines);
            _textBuffer = _textView.TextBuffer;
            var vimTextBuffer = Vim.CreateVimTextBuffer(_textBuffer);
            var vimBufferData = CreateVimBufferData(vimTextBuffer, _textView);

            _selection = _textView.Selection;
            _factory   = new MockRepository(MockBehavior.Strict);
            _tracker   = _factory.Create <ISelectionTracker>();
            _tracker.Setup(x => x.Start());
            _tracker.Setup(x => x.ResetCaret());
            _tracker.Setup(x => x.UpdateSelection());
            _operations = _factory.Create <ICommonOperations>();
            _operations.SetupGet(x => x.TextView).Returns(_textView);
            _commandUtil = _factory.Create <ICommandUtil>();
            var motionUtil = new MotionUtil(vimBufferData);
            var capture    = new MotionCapture(vimBufferData, new IncrementalSearch(vimBufferData, _operations.Object));
            var runner     = new CommandRunner(
                _textView,
                Vim.RegisterMap,
                capture,
                _commandUtil.Object,
                (new Mock <IStatusUtil>()).Object,
                VisualKind.Character);

            _modeRaw = new VisualMode(vimBufferData, _operations.Object, motionUtil, kind, runner, capture, _tracker.Object);
            _mode    = _modeRaw;
            _mode.OnEnter(ModeArgument.None);
        }
Example #2
0
        public void Create2(
            ModeKind kind = ModeKind.VisualCharacter,
            params string[] lines)
        {
            _textView   = EditorUtil.CreateView(lines);
            _textBuffer = _textView.TextBuffer;
            _selection  = _textView.Selection;
            _factory    = new MockRepository(MockBehavior.Strict);
            _map        = VimUtil.CreateRegisterMap(MockObjectFactory.CreateClipboardDevice(_factory).Object);
            _markMap    = new MarkMap(new TrackingLineColumnService());
            _tracker    = _factory.Create <ISelectionTracker>();
            _tracker.Setup(x => x.Start());
            _tracker.Setup(x => x.ResetCaret());
            _tracker.Setup(x => x.UpdateSelection());
            _jumpList           = _factory.Create <IJumpList>(MockBehavior.Loose);
            _undoRedoOperations = _factory.Create <IUndoRedoOperations>();
            _foldManager        = _factory.Create <IFoldManager>();
            _editorOperations   = _factory.Create <IEditorOperations>();
            _operations         = _factory.Create <ICommonOperations>();
            _operations.SetupGet(x => x.FoldManager).Returns(_foldManager.Object);
            _operations.SetupGet(x => x.UndoRedoOperations).Returns(_undoRedoOperations.Object);
            _operations.SetupGet(x => x.EditorOperations).Returns(_editorOperations.Object);
            _operations.SetupGet(x => x.TextView).Returns(_textView);
            _host        = _factory.Create <IVimHost>(MockBehavior.Loose);
            _commandUtil = _factory.Create <ICommandUtil>();
            _commandUtil
            .Setup(x => x.RunCommand(It.Is <Command>(y => y.IsLegacyCommand)))
            .Returns <Command>(c => c.AsLegacyCommand().Item.Function.Invoke(null));
            _incrementalSearch = MockObjectFactory.CreateIncrementalSearch(factory: _factory);
            var globalSettings = new GlobalSettings();
            var localSettings  = new LocalSettings(globalSettings, _textView);
            var motionUtil     = VimUtil.CreateTextViewMotionUtil(
                _textView,
                _markMap,
                localSettings);

            _bufferData = MockObjectFactory.CreateVimBuffer(
                _textView,
                "test",
                MockObjectFactory.CreateVim(_map, host: _host.Object, settings: globalSettings).Object,
                incrementalSearch: _incrementalSearch.Object,
                jumpList: _jumpList.Object,
                motionUtil: motionUtil);
            var capture = new MotionCapture(
                _host.Object,
                _textView,
                _incrementalSearch.Object,
                localSettings);
            var runner = new CommandRunner(
                _textView,
                _map,
                capture,
                _commandUtil.Object,
                (new Mock <IStatusUtil>()).Object,
                VisualKind.Character);

            _modeRaw = new VisualMode(_bufferData.Object, _operations.Object, kind, runner, capture, _tracker.Object);
            _mode    = _modeRaw;
            _mode.OnEnter(ModeArgument.None);
        }
Example #3
0
        private void Create(KeyRemapMode countKeyRemapMode, params string[] lines)
        {
            _textView = CreateTextView(lines);
            _vimTextBuffer = Vim.CreateVimTextBuffer(_textView.TextBuffer);
            _registerMap = Vim.RegisterMap;
            var vimBufferData = CreateVimBufferData(
                _vimTextBuffer,
                _textView);
            _commandUtil = CreateCommandUtil(vimBufferData);
            var incrementalSearch = new IncrementalSearch(
                vimBufferData,
                CommonOperationsFactory.GetCommonOperations(vimBufferData));
            var motionCapture = new MotionCapture(vimBufferData, incrementalSearch);

            _runnerRaw = new CommandRunner(
                _textView,
                _registerMap,
                motionCapture,
                vimBufferData.LocalSettings,
                _commandUtil,
                new StatusUtil(),
                VisualKind.Character,
                countKeyRemapMode);
            _runner = _runnerRaw;
        }
Example #4
0
        private void Create2(
            ModeKind kind = ModeKind.VisualCharacter,
            params string[] lines)
        {
            _textView   = CreateTextView(lines);
            _textBuffer = _textView.TextBuffer;
            var vimTextBuffer = Vim.CreateVimTextBuffer(_textBuffer);
            var vimBufferData = CreateVimBufferData(vimTextBuffer, _textView);
            var visualKind    = VisualKind.OfModeKind(kind).Value;

            _selection = _textView.Selection;
            _factory   = new MockRepository(MockBehavior.Strict);
            _tracker   = _factory.Create <ISelectionTracker>();
            _tracker.Setup(x => x.Start());
            _tracker.Setup(x => x.UpdateSelection());
            _tracker.Setup(x => x.RecordCaretTrackingPoint(It.IsAny <ModeArgument>()));
            _tracker.SetupGet(x => x.IsRunning).Returns(true);
            _operations = _factory.Create <ICommonOperations>();
            _operations.SetupGet(x => x.TextView).Returns(_textView);
            _operations.Setup(x => x.MoveCaretToPoint(It.IsAny <SnapshotPoint>(), ViewFlags.Standard));
            _commandUtil = _factory.Create <ICommandUtil>();
            var motionUtil = new MotionUtil(vimBufferData, _operations.Object);
            var capture    = new MotionCapture(vimBufferData, new IncrementalSearch(vimBufferData, _operations.Object, motionUtil));
            var runner     = new CommandRunner(
                vimBufferData,
                capture,
                _commandUtil.Object,
                VisualKind.Character,
                KeyRemapMode.Visual);

            _modeRaw = new VisualMode(vimBufferData, _operations.Object, motionUtil, visualKind, runner, capture, _tracker.Object);
            _mode    = _modeRaw;
            _mode.OnEnter(ModeArgument.None);
        }
Example #5
0
 public void Play()
 {
     MotionCapture.Play((d) => {
         objectToPlay.localPosition    = d.data[0].postion;
         objectToPlay.localEulerAngles = d.data[0].rotation;
     }, Application.persistentDataPath + "/test.json");
 }
Example #6
0
        private void Create(params string[] lines)
        {
            _textView    = EditorUtil.CreateView(lines);
            _factory     = new MockRepository(MockBehavior.Strict);
            _host        = _factory.Create <IVimHost>();
            _statusUtil  = _factory.Create <IStatusUtil>();
            _registerMap = VimUtil.CreateRegisterMap(MockObjectFactory.CreateClipboardDevice(_factory).Object);
            _vimData     = new VimData();
            var settings      = new GlobalSettings();
            var localSettings = new LocalSettings(settings, _textView);
            var motionUtil    = VimUtil.CreateTextViewMotionUtil(
                _textView,
                settings: localSettings,
                vimData: _vimData);
            var capture = new MotionCapture(
                _host.Object,
                _textView,
                MockObjectFactory.CreateIncrementalSearch(factory: _factory).Object,
                localSettings);

            _commandUtil = VimUtil.CreateCommandUtil(
                _textView,
                motionUtil: motionUtil,
                statusUtil: _statusUtil.Object,
                registerMap: _registerMap,
                vimData: _vimData);
            _runnerRaw = new CommandRunner(
                _textView,
                _registerMap,
                capture,
                _commandUtil,
                _statusUtil.Object,
                VisualKind.Character);
            _runner = _runnerRaw;
        }
Example #7
0
        private void Create(KeyRemapMode countKeyRemapMode, params string[] lines)
        {
            _textView      = CreateTextView(lines);
            _vimTextBuffer = Vim.CreateVimTextBuffer(_textView.TextBuffer);
            _registerMap   = Vim.RegisterMap;
            var vimBufferData = CreateVimBufferData(
                _vimTextBuffer,
                _textView);

            _commandUtil = CreateCommandUtil(vimBufferData);
            var incrementalSearch = new IncrementalSearch(
                vimBufferData,
                CommonOperationsFactory.GetCommonOperations(vimBufferData));
            var motionCapture = new MotionCapture(vimBufferData, incrementalSearch);

            _runnerRaw = new CommandRunner(
                _textView,
                _registerMap,
                motionCapture,
                vimBufferData.LocalSettings,
                _commandUtil,
                new StatusUtil(),
                VisualKind.Character,
                countKeyRemapMode);
            _runner = _runnerRaw;
        }
Example #8
0
 private void SetData()
 {
     MotionCapture.Record(new Dictionary <int, MotionNode>()
     {
         {
             0,
             new MotionNode {
                 postion  = objectToRecord.localPosition,
                 rotation = objectToRecord.localEulerAngles
             }
         }
     });
 }
Example #9
0
 public void SetUp()
 {
     _textView          = EditorUtil.CreateView();
     _localSettings     = new LocalSettings(new GlobalSettings(), _textView);
     _incrementalSearch = VimUtil.CreateIncrementalSearch(_textView, _localSettings, new VimData());
     _factory           = new MockRepository(MockBehavior.Strict);
     _host       = _factory.Create <IVimHost>();
     _captureRaw = new MotionCapture(
         _host.Object,
         _textView,
         _incrementalSearch,
         _localSettings);
     _capture = _captureRaw;
 }
Example #10
0
        public MotionCaptureTest()
        {
            _textView = CreateTextView();

            var vimTextBuffer = Vim.CreateVimTextBuffer(_textView.TextBuffer);
            var vimBufferData = CreateVimBufferData(vimTextBuffer, _textView);
            _incrementalSearch = new IncrementalSearch(
                vimBufferData,
                CommonOperationsFactory.GetCommonOperations(vimBufferData));
            _localSettings = vimTextBuffer.LocalSettings;
            _captureRaw = new MotionCapture(
                vimBufferData,
                _incrementalSearch);
            _capture = _captureRaw;
        }
Example #11
0
        public MotionCaptureTest()
        {
            _textView = CreateTextView();

            var vimTextBuffer = Vim.CreateVimTextBuffer(_textView.TextBuffer);
            var vimBufferData = CreateVimBufferData(vimTextBuffer, _textView);

            _incrementalSearch = new IncrementalSearch(
                vimBufferData,
                CommonOperationsFactory.GetCommonOperations(vimBufferData));
            _localSettings = vimTextBuffer.LocalSettings;
            _captureRaw    = new MotionCapture(
                vimBufferData,
                _incrementalSearch);
            _capture = _captureRaw;
        }
Example #12
0
        public void CreateCore(IMotionUtil motionUtil, params string[] lines)
        {
            _textView = CreateTextView(lines);
            _textView.Caret.MoveTo(new SnapshotPoint(_textView.TextSnapshot, 0));
            _unnamedRegister = Vim.RegisterMap.GetRegister(RegisterName.Unnamed);
            _factory = new MockRepository(MockBehavior.Strict);
            _incrementalSearch = MockObjectFactory.CreateIncrementalSearch(factory: _factory);
            _commandUtil = _factory.Create<ICommandUtil>();

            _globalSettings = Vim.GlobalSettings;

            var vimTextBuffer = Vim.CreateVimTextBuffer(_textView.TextBuffer);
            var vimBufferData = CreateVimBufferData(vimTextBuffer, _textView);
            var operations = CommonOperationsFactory.GetCommonOperations(vimBufferData);
            motionUtil = motionUtil ?? new MotionUtil(vimBufferData, operations);
            var lineChangeTracker = new LineChangeTracker(vimBufferData);

            var capture = new MotionCapture(vimBufferData, _incrementalSearch.Object);
            var runner = new CommandRunner(
                _textView,
                Vim.RegisterMap,
                capture,
                vimBufferData.LocalSettings,
                _commandUtil.Object,
                vimBufferData.StatusUtil,
                VisualKind.Character,
                KeyRemapMode.Normal);
            _modeRaw = new NormalMode(
                vimBufferData,
                operations,
                motionUtil,
                runner,
                capture);
            _mode = _modeRaw;
            _mode.OnEnter(ModeArgument.None);
        }
Example #13
0
        private void Create2(
            ModeKind kind = ModeKind.VisualCharacter,
            params string[] lines)
        {
            _textView = CreateTextView(lines);
            _textBuffer = _textView.TextBuffer;
            var vimTextBuffer = Vim.CreateVimTextBuffer(_textBuffer);
            var vimBufferData = CreateVimBufferData(vimTextBuffer, _textView);
            var visualKind = VisualKind.OfModeKind(kind).Value;

            _selection = _textView.Selection;
            _factory = new MockRepository(MockBehavior.Strict);
            _tracker = _factory.Create<ISelectionTracker>();
            _tracker.Setup(x => x.Start());
            _tracker.Setup(x => x.UpdateSelection());
            _tracker.Setup(x => x.RecordCaretTrackingPoint(It.IsAny<ModeArgument>()));
            _tracker.SetupGet(x => x.IsRunning).Returns(true);
            _operations = _factory.Create<ICommonOperations>();
            _operations.SetupGet(x => x.TextView).Returns(_textView);
            _operations.Setup(x => x.MoveCaretToPoint(It.IsAny<SnapshotPoint>(), ViewFlags.Standard));
            _commandUtil = _factory.Create<ICommandUtil>();
            var motionUtil = new MotionUtil(vimBufferData, _operations.Object);
            var capture = new MotionCapture(vimBufferData, new IncrementalSearch(vimBufferData, _operations.Object));
            var runner = new CommandRunner(
                _textView,
                Vim.RegisterMap,
                capture,
                vimBufferData.LocalSettings,
                _commandUtil.Object,
                (new Mock<IStatusUtil>()).Object,
                VisualKind.Character,
                KeyRemapMode.Visual);
            _modeRaw = new VisualMode(vimBufferData, _operations.Object, motionUtil, visualKind, runner, capture, _tracker.Object);
            _mode = _modeRaw;
            _mode.OnEnter(ModeArgument.None);
        }
Example #14
0
 public void Record()
 {
     MotionCapture.StartRecording();
     _isRecording = true;
 }
Example #15
0
 public void Stop()
 {
     _isRecording = false;
     MotionCapture.EndRecording(Application.persistentDataPath + "/test.json");
 }
Example #16
0
 public void Create2(
     ModeKind kind = ModeKind.VisualCharacter,
     params string[] lines)
 {
     _textView = EditorUtil.CreateTextView(lines);
     _textBuffer = _textView.TextBuffer;
     _selection = _textView.Selection;
     _factory = new MockRepository(MockBehavior.Strict);
     _map = VimUtil.CreateRegisterMap(MockObjectFactory.CreateClipboardDevice(_factory).Object);
     _markMap = new MarkMap(new TrackingLineColumnService());
     _tracker = _factory.Create<ISelectionTracker>();
     _tracker.Setup(x => x.Start());
     _tracker.Setup(x => x.ResetCaret());
     _tracker.Setup(x => x.UpdateSelection());
     _jumpList = _factory.Create<IJumpList>(MockBehavior.Loose);
     _undoRedoOperations = _factory.Create<IUndoRedoOperations>();
     _foldManager = _factory.Create<IFoldManager>();
     _editorOperations = _factory.Create<IEditorOperations>();
     _operations = _factory.Create<ICommonOperations>();
     _operations.SetupGet(x => x.UndoRedoOperations).Returns(_undoRedoOperations.Object);
     _operations.SetupGet(x => x.EditorOperations).Returns(_editorOperations.Object);
     _operations.SetupGet(x => x.TextView).Returns(_textView);
     _host = _factory.Create<IVimHost>(MockBehavior.Loose);
     _commandUtil = _factory.Create<ICommandUtil>();
     _incrementalSearch = MockObjectFactory.CreateIncrementalSearch(factory: _factory);
     var globalSettings = new GlobalSettings();
     var localSettings = new LocalSettings(globalSettings, EditorUtil.GetEditorOptions(_textView), _textView);
     var motionUtil = VimUtil.CreateTextViewMotionUtil(
         _textView,
         _markMap,
         localSettings);
     _bufferData = MockObjectFactory.CreateVimBuffer(
         _textView,
         "test",
         MockObjectFactory.CreateVim(_map, host: _host.Object, settings: globalSettings).Object,
         incrementalSearch: _incrementalSearch.Object,
         jumpList: _jumpList.Object,
         motionUtil: motionUtil);
     var capture = new MotionCapture(
         _host.Object,
         _textView,
         _incrementalSearch.Object,
         localSettings);
     var runner = new CommandRunner(
         _textView,
         _map,
         capture,
         _commandUtil.Object,
         (new Mock<IStatusUtil>()).Object,
         VisualKind.Character);
     _modeRaw = new VisualMode(_bufferData.Object, _operations.Object, kind, runner, capture, _tracker.Object);
     _mode = _modeRaw;
     _mode.OnEnter(ModeArgument.None);
 }
Example #17
0
        public void CreateCore(IMotionUtil motionUtil, params string[] lines)
        {
            _textView = EditorUtil.CreateTextView(lines);
            _textView.Caret.MoveTo(new SnapshotPoint(_textView.TextSnapshot, 0));
            _map = VimUtil.CreateRegisterMap(MockObjectFactory.CreateClipboardDevice().Object);
            _unnamedRegister = _map.GetRegister(RegisterName.Unnamed);
            _factory = new MockRepository(MockBehavior.Strict);
            _editorOperations = _factory.Create<IEditorOperations>(MockBehavior.Loose);
            _incrementalSearch = MockObjectFactory.CreateIncrementalSearch(factory: _factory);
            _jumpList = _factory.Create<IJumpList>(MockBehavior.Strict);
            _statusUtil = _factory.Create<IStatusUtil>(MockBehavior.Strict);
            _foldManager = _factory.Create<IFoldManager>(MockBehavior.Strict);
            _host = _factory.Create<IVimHost>(MockBehavior.Loose);
            _commandUtil = _factory.Create<ICommandUtil>();
            _displayWindowBroker = _factory.Create<IDisplayWindowBroker>(MockBehavior.Strict);
            _displayWindowBroker.SetupGet(x => x.IsCompletionActive).Returns(false);
            _displayWindowBroker.SetupGet(x => x.IsSignatureHelpActive).Returns(false);
            _displayWindowBroker.SetupGet(x => x.IsSmartTagSessionActive).Returns(false);
            _vimData = new VimData();

            _globalSettings = new Vim.GlobalSettings();
            _localSettings = new LocalSettings(_globalSettings, EditorUtil.GetEditorOptions(_textView), _textView);
            motionUtil = motionUtil ?? VimUtil.CreateTextViewMotionUtil(
                _textView,
                new MarkMap(new TrackingLineColumnService()),
                _localSettings);
            _buffer = MockObjectFactory.CreateVimBuffer(
                _textView,
                "test",
                MockObjectFactory.CreateVim(_map, host: _host.Object, vimData: _vimData).Object,
                _jumpList.Object,
                incrementalSearch: _incrementalSearch.Object,
                motionUtil: motionUtil,
                settings: _localSettings);
            _operations = _factory.Create<ICommonOperations>(MockBehavior.Strict);
            _operations.SetupGet(x => x.EditorOperations).Returns(_editorOperations.Object);
            _operations.SetupGet(x => x.TextView).Returns(_textView);

            var capture = new MotionCapture(
                _host.Object,
                _textView,
                _incrementalSearch.Object,
                new LocalSettings(new GlobalSettings(), EditorUtil.GetEditorOptions(_textView), _textView));
            var runner = new CommandRunner(_textView, _map, capture, _commandUtil.Object, _statusUtil.Object, VisualKind.Character);
            _modeRaw = new NormalMode(
                _buffer.Object,
                _operations.Object,
                _statusUtil.Object,
                _displayWindowBroker.Object,
                runner,
                capture);
            _mode = _modeRaw;
            _mode.OnEnter(ModeArgument.None);
        }
Example #18
0
 public void SetUp()
 {
     _textView = EditorUtil.CreateTextView();
     _localSettings = new LocalSettings(new GlobalSettings(), EditorUtil.GetEditorOptions(_textView), _textView);
     _incrementalSearch = VimUtil.CreateIncrementalSearch(_textView, _localSettings, new VimData());
     _factory = new MockRepository(MockBehavior.Strict);
     _host = _factory.Create<IVimHost>();
     _captureRaw = new MotionCapture(
         _host.Object,
         _textView,
         _incrementalSearch,
         _localSettings);
     _capture = _captureRaw;
 }
Example #19
0
        public void CreateCore(IMotionUtil motionUtil, params string[] lines)
        {
            _textView = CreateTextView(lines);
            _textView.Caret.MoveTo(new SnapshotPoint(_textView.TextSnapshot, 0));
            _unnamedRegister = Vim.RegisterMap.GetRegister(RegisterName.Unnamed);
            _factory = new MockRepository(MockBehavior.Strict);
            _incrementalSearch = MockObjectFactory.CreateIncrementalSearch(factory: _factory);
            _commandUtil = _factory.Create<ICommandUtil>();
            _displayWindowBroker = _factory.Create<IDisplayWindowBroker>(MockBehavior.Strict);
            _displayWindowBroker.SetupGet(x => x.IsCompletionActive).Returns(false);
            _displayWindowBroker.SetupGet(x => x.IsSignatureHelpActive).Returns(false);
            _displayWindowBroker.SetupGet(x => x.IsSmartTagSessionActive).Returns(false);

            _globalSettings = Vim.GlobalSettings;

            var vimTextBuffer = Vim.CreateVimTextBuffer(_textView.TextBuffer);
            var vimBufferData = CreateVimBufferData(vimTextBuffer, _textView);
            var operations = CommonOperationsFactory.GetCommonOperations(vimBufferData);
            motionUtil = motionUtil ?? new MotionUtil(vimBufferData);

            var capture = new MotionCapture(vimBufferData, _incrementalSearch.Object);
            var runner = new CommandRunner(
                _textView,
                Vim.RegisterMap,
                capture,
                _commandUtil.Object,
                vimBufferData.StatusUtil,
                VisualKind.Character);
            _modeRaw = new NormalMode(
                vimBufferData,
                operations,
                motionUtil,
                _displayWindowBroker.Object,
                runner,
                capture);
            _mode = _modeRaw;
            _mode.OnEnter(ModeArgument.None);
        }
Example #20
0
 private void Create(params string[] lines)
 {
     _textView = EditorUtil.CreateView(lines);
     _factory = new MockRepository(MockBehavior.Strict);
     _host = _factory.Create<IVimHost>();
     _statusUtil = _factory.Create<IStatusUtil>();
     _registerMap = VimUtil.CreateRegisterMap(MockObjectFactory.CreateClipboardDevice(_factory).Object);
     _vimData = new VimData();
     var settings = new GlobalSettings();
     var localSettings = new LocalSettings(settings, _textView);
     var motionUtil = VimUtil.CreateTextViewMotionUtil(
         _textView,
         settings: localSettings,
         vimData: _vimData);
     var capture = new MotionCapture(
         _host.Object,
         _textView,
         MockObjectFactory.CreateIncrementalSearch(factory: _factory).Object,
         localSettings);
     _commandUtil = VimUtil.CreateCommandUtil(
         _textView,
         motionUtil: motionUtil,
         statusUtil: _statusUtil.Object,
         registerMap: _registerMap,
         vimData: _vimData);
     _runnerRaw = new CommandRunner(
         _textView,
         _registerMap,
         capture,
         _commandUtil,
         _statusUtil.Object,
         VisualKind.Character);
     _runner = _runnerRaw;
 }
Example #21
0
 private void Create(params string[] lines)
 {
     _textView = EditorUtil.CreateView(lines);
     _factory = new MockRepository(MockBehavior.Strict);
     _host = _factory.Create<IVimHost>();
     _statusUtil = _factory.Create<IStatusUtil>();
     _registerMap = new RegisterMap(MockObjectFactory.CreateClipboardDevice(_factory).Object);
     var capture = new MotionCapture(
         _host.Object,
         _textView,
         new TextViewMotionUtil(_textView, new Vim.LocalSettings(new Vim.GlobalSettings(), _textView)),
         new MotionCaptureGlobalData());
     _runnerRaw = new CommandRunner(
         _textView,
         _registerMap,
         (IMotionCapture)capture,
         _statusUtil.Object);
     _runner = _runnerRaw;
 }
Example #22
0
 public void Create2(
     ModeKind kind = ModeKind.VisualCharacter,
     params string[] lines)
 {
     _buffer = EditorUtil.CreateBuffer(lines);
     _factory = new MockRepository(MockBehavior.Strict);
     _caret = _factory.Create<ITextCaret>();
     _view = _factory.Create<IWpfTextView>();
     _selection = _factory.Create<ITextSelection>();
     _selection.Setup(x => x.Clear());
     _selection.SetupSet(x => x.Mode = TextSelectionMode.Stream);
     _view.SetupGet(x => x.Caret).Returns(_caret.Object);
     _view.SetupGet(x => x.Selection).Returns(_selection.Object);
     _view.SetupGet(x => x.TextBuffer).Returns(_buffer);
     _view.SetupGet(x => x.TextSnapshot).Returns(() => _buffer.CurrentSnapshot);
     _view.SetupGet(x => x.IsClosed).Returns(false);
     _map = new RegisterMap(MockObjectFactory.CreateClipboardDevice(_factory).Object);
     _tracker = _factory.Create<ISelectionTracker>();
     _tracker.Setup(x => x.Start());
     _tracker.Setup(x => x.ResetCaret());
     _undoRedoOperations = _factory.Create<IUndoRedoOperations>();
     _foldManager = _factory.Create<IFoldManager>();
     _editorOperations = _factory.Create<IEditorOperations>();
     _operations = _factory.Create<ICommonOperations>();
     _operations.SetupGet(x => x.FoldManager).Returns(_foldManager.Object);
     _operations.SetupGet(x => x.UndoRedoOperations).Returns(_undoRedoOperations.Object);
     _operations.SetupGet(x => x.EditorOperations).Returns(_editorOperations.Object);
     _host = _factory.Create<IVimHost>(MockBehavior.Loose);
     _bufferData = MockObjectFactory.CreateVimBuffer(
         _view.Object,
         "test",
         MockObjectFactory.CreateVim(_map, host: _host.Object).Object,
         factory: _factory);
     var capture = new MotionCapture(
         _host.Object,
         _view.Object,
         new TextViewMotionUtil(_view.Object, new Vim.LocalSettings(_bufferData.Object.Settings.GlobalSettings, _view.Object)),
         new MotionCaptureGlobalData());
     var runner = new CommandRunner(_view.Object, _map, (IMotionCapture)capture, (new Mock<IStatusUtil>()).Object);
     _modeRaw = new Vim.Modes.Visual.VisualMode(_bufferData.Object, _operations.Object, kind, runner, capture, _tracker.Object);
     _mode = _modeRaw;
     _mode.OnEnter(ModeArgument.None);
 }
Example #23
0
 private void Create(params string[] lines)
 {
     _textView = EditorUtil.CreateView(lines);
     _factory = new MockRepository(MockBehavior.Strict);
     _host = _factory.Create<IVimHost>();
     _statusUtil = _factory.Create<IStatusUtil>();
     _registerMap = VimUtil.CreateRegisterMap(MockObjectFactory.CreateClipboardDevice(_factory).Object);
     _vimData = new VimData();
     var capture = new MotionCapture(
         _host.Object,
         _textView,
         new TextViewMotionUtil(
             _textView,
             new MarkMap(new TrackingLineColumnService()),
             new Vim.LocalSettings(new Vim.GlobalSettings(), _textView)),
         MockObjectFactory.CreateIncrementalSearch(factory: _factory).Object,
         _factory.Create<IJumpList>().Object,
         _vimData,
         new LocalSettings(new Vim.GlobalSettings(), _textView));
     _runnerRaw = new CommandRunner(
         _textView,
         _registerMap,
         (IMotionCapture)capture,
         _statusUtil.Object);
     _runner = _runnerRaw;
 }
Example #24
0
        public void CreateCore(ITextViewMotionUtil motionUtil, params string[] lines)
        {
            _view = EditorUtil.CreateView(lines);
            _view.Caret.MoveTo(new SnapshotPoint(_view.TextSnapshot, 0));
            _map = new RegisterMap(MockObjectFactory.CreateClipboardDevice().Object);
            _editorOperations = new Mock<IEditorOperations>();
            _incrementalSearch = new Mock<IIncrementalSearch>(MockBehavior.Strict);
            _jumpList = new Mock<IJumpList>(MockBehavior.Strict);
            _statusUtil = new Mock<IStatusUtil>(MockBehavior.Strict);
            _changeTracker = new Mock<IChangeTracker>(MockBehavior.Strict);
            _foldManager = new Mock<IFoldManager>(MockBehavior.Strict);
            _visualSpanCalculator = new Mock<IVisualSpanCalculator>(MockBehavior.Strict);
            _host = new Mock<IVimHost>(MockBehavior.Loose);
            _displayWindowBroker = new Mock<IDisplayWindowBroker>(MockBehavior.Strict);
            _displayWindowBroker.SetupGet(x => x.IsCompletionActive).Returns(false);
            _displayWindowBroker.SetupGet(x => x.IsSignatureHelpActive).Returns(false);
            _displayWindowBroker.SetupGet(x => x.IsSmartTagSessionActive).Returns(false);
            _bufferData = MockRepository.CreateVimBuffer(
                _view,
                "test",
                MockRepository.CreateVim(_map, changeTracker: _changeTracker.Object, host: _host.Object).Object,
                _jumpList.Object);
            _operations = new Mock<IOperations>(MockBehavior.Strict);
            _operations.SetupGet(x => x.EditorOperations).Returns(_editorOperations.Object);
            _operations.SetupGet(x => x.TextView).Returns(_view);
            _operations.SetupGet(x => x.FoldManager).Returns(_foldManager.Object);

            motionUtil = motionUtil ?? new TextViewMotionUtil(_view, new Vim.LocalSettings(
                    new Vim.GlobalSettings(),
                    _view));
            var capture = new MotionCapture(_host.Object, _view, motionUtil, new MotionCaptureGlobalData());
            var runner = new CommandRunner(_view, _map, (IMotionCapture)capture, _statusUtil.Object);
            _modeRaw = new Vim.Modes.Normal.NormalMode(
                _bufferData.Object,
                _operations.Object,
                _incrementalSearch.Object,
                _statusUtil.Object,
                _displayWindowBroker.Object,
                (ICommandRunner)runner,
                (IMotionCapture)capture,
                _visualSpanCalculator.Object);
            _mode = _modeRaw;
            _mode.OnEnter(ModeArgument.None);
        }
Example #25
0
 public void Create2(
     ModeKind kind=ModeKind.VisualCharacter,
     params string[] lines)
 {
     _buffer = EditorUtil.CreateBuffer(lines);
     _caret = new Mock<ITextCaret>(MockBehavior.Strict);
     _view = new Mock<IWpfTextView>(MockBehavior.Strict);
     _selection = new Mock<ITextSelection>(MockBehavior.Strict);
     _view.SetupGet(x => x.Caret).Returns(_caret.Object);
     _view.SetupGet(x => x.Selection).Returns(_selection.Object);
     _view.SetupGet(x => x.TextBuffer).Returns(_buffer);
     _view.SetupGet(x => x.TextSnapshot).Returns(() => _buffer.CurrentSnapshot);
     _map = new RegisterMap();
     _tracker = new Mock<ISelectionTracker>(MockBehavior.Strict);
     _tracker.Setup(x => x.Start());
     _operations = new Mock<IOperations>(MockBehavior.Strict);
     _operations.SetupGet(x => x.SelectionTracker).Returns(_tracker.Object);
     _bufferData = MockObjectFactory.CreateVimBuffer(
         _view.Object,
         "test",
         MockObjectFactory.CreateVim(_map).Object);
     var capture = new MotionCapture(_view.Object, new MotionUtil(_view.Object, _bufferData.Object.Settings.GlobalSettings));
     var runner = new CommandRunner(Tuple.Create((ITextView)_view.Object, _map, (IMotionCapture)capture, (new Mock<IStatusUtil>()).Object));
     _modeRaw = new Vim.Modes.Visual.VisualMode(_bufferData.Object, _operations.Object, kind, runner, capture);
     _mode = _modeRaw;
     _mode.OnEnter();
 }
Example #26
0
 public void Create()
 {
     _factory = new MockRepository(MockBehavior.Strict);
     _util = _factory.Create<ITextViewMotionUtil>();
     _textView = MockObjectFactory.CreateTextView(factory: _factory);
     _host = _factory.Create<IVimHost>();
     _data = _factory.Create<IMotionCaptureGlobalData>(MockBehavior.Loose);
     _captureRaw = new MotionCapture(_host.Object, _textView.Object, _util.Object, _data.Object);
     _capture = _captureRaw;
 }
Example #27
0
 private void Create(params string[] lines)
 {
     _textView = EditorUtil.CreateView(lines);
     _factory = new MockFactory(MockBehavior.Strict);
     _statusUtil = _factory.Create<IStatusUtil>();
     _registerMap = new RegisterMap();
     var capture = new MotionCapture(_textView, new MotionUtil(_textView, new Vim.GlobalSettings()));
     _runnerRaw = new CommandRunner(Tuple.Create(
         _textView,
         _registerMap,
         (IMotionCapture)capture,
         _statusUtil.Object));
     _runner = _runnerRaw;
 }
Example #28
0
        private void Create2(
            ModeKind kind = ModeKind.VisualCharacter,
            params string[] lines)
        {
            _textView = CreateTextView(lines);
            _textBuffer = _textView.TextBuffer;
            var vimTextBuffer = Vim.CreateVimTextBuffer(_textBuffer);
            var vimBufferData = CreateVimBufferData(vimTextBuffer, _textView);

            _selection = _textView.Selection;
            _factory = new MockRepository(MockBehavior.Strict);
            _tracker = _factory.Create<ISelectionTracker>();
            _tracker.Setup(x => x.Start());
            _tracker.Setup(x => x.UpdateSelection());
            _tracker.SetupGet(x => x.IsRunning).Returns(true);
            _operations = _factory.Create<ICommonOperations>();
            _operations.SetupGet(x => x.TextView).Returns(_textView);
            _commandUtil = _factory.Create<ICommandUtil>();
            var motionUtil = new MotionUtil(vimBufferData);
            var capture = new MotionCapture(vimBufferData, new IncrementalSearch(vimBufferData, _operations.Object));
            var runner = new CommandRunner(
                _textView,
                Vim.RegisterMap,
                capture,
                _commandUtil.Object,
                (new Mock<IStatusUtil>()).Object,
                VisualKind.Character);
            _modeRaw = new VisualMode(vimBufferData, _operations.Object, motionUtil, kind, runner, capture, _tracker.Object);
            _mode = _modeRaw;
            _mode.OnEnter(ModeArgument.None);
        }
Example #29
0
 public void Create()
 {
     _util = new Mock<IMotionUtil>(MockBehavior.Strict);
     _textView = Mock.MockObjectFactory.CreateTextView();
     _captureRaw = new MotionCapture(_textView.Object, _util.Object);
     _capture = _captureRaw;
 }
Example #30
0
        public void CreateCore(IMotionUtil motionUtil, params string[] lines)
        {
            _view = Utils.EditorUtil.CreateView(lines);
            _view.Caret.MoveTo(new SnapshotPoint(_view.TextSnapshot, 0));
            _map = new RegisterMap();
            _editorOperations = new Mock<IEditorOperations>();
            _incrementalSearch = new Mock<IIncrementalSearch>(MockBehavior.Strict);
            _jumpList = new Mock<IJumpList>(MockBehavior.Strict);
            _statusUtil = new Mock<IStatusUtil>(MockBehavior.Strict);
            _changeTracker = new Mock<IChangeTracker>(MockBehavior.Strict);
            _displayWindowBroker = new Mock<IDisplayWindowBroker>(MockBehavior.Strict);
            _displayWindowBroker.SetupGet(x => x.IsSmartTagWindowActive).Returns(false);
            _bufferData = MockFactory.CreateVimBuffer(
                _view,
                "test",
                MockFactory.CreateVim(_map,changeTracker:_changeTracker.Object).Object,
                _jumpList.Object);
            _operations = new Mock<IOperations>(MockBehavior.Strict);
            _operations.SetupGet(x => x.EditorOperations).Returns(_editorOperations.Object);
            _operations.SetupGet(x => x.TextView).Returns(_view);

            motionUtil = motionUtil ?? new MotionUtil(_view, new Vim.GlobalSettings());
            var capture = new MotionCapture(_view, motionUtil);
            var runner = new CommandRunner(Tuple.Create((ITextView)_view, _map,(IMotionCapture)capture, _statusUtil.Object));
            _modeRaw = new Vim.Modes.Normal.NormalMode(
                _bufferData.Object,
                _operations.Object,
                _incrementalSearch.Object,
                _statusUtil.Object,
                _displayWindowBroker.Object,
                (ICommandRunner)runner,
                (IMotionCapture)capture);
            _mode = _modeRaw;
            _mode.OnEnter();
        }