public void Dispose() { try { _synchronizationContext.RunAll(); } finally { _synchronizationContext.Dispose(); } }
private void EnterMode(SnapshotSpan span) { var characterSpan = CharacterSpan.CreateForSpan(span); var visualSelection = VisualSelection.NewCharacter(characterSpan, true); CommonUtil.SelectAndUpdateCaret(_textView, visualSelection); Assert.IsFalse(_context.IsEmpty); _context.RunAll(); Assert.IsTrue(_context.IsEmpty); }
public void CloseBeforePost() { RaiseTextViewCreated(_textView); RaiseVimBufferCreated(_vimBuffer); _textView.Close(); TestableSynchronizationContext.RunAll(); }
/// <summary> /// Run the given KeyInput against the Visual Studio simulation /// </summary> internal void Run(KeyInput keyInput) { _testableSynchronizationContext.Install(); try { // Update the KeyModifiers while this is being processed by our key processor var keyModifiers = keyInput.KeyModifiers; // The KeyInput for an upper letter doesn't have a Shift modifier. However the // keyboard state which produced the letter will likely have it (not sure about // caps lock). Need to simulate that here if (Char.IsLetter(keyInput.Char) && Char.IsUpper(keyInput.Char)) { keyModifiers |= KeyModifiers.Shift; } _defaultKeyboardDevice.DownKeyModifiers = keyInput.KeyModifiers; if (!RunInOleCommandTarget(keyInput)) { RunInWpf(keyInput); } _testableSynchronizationContext.RunAll(); } finally { _defaultKeyboardDevice.DownKeyModifiers = KeyModifiers.None; _testableSynchronizationContext.Uninstall(); } }
public void Start5() { Create(VisualKind.Line, "foo", "bar"); _context.RunAll(); Assert.AreEqual(_view.TextBuffer.GetLineFromLineNumber(0).Start, _view.Selection.Start.Position); Assert.AreEqual(_view.TextBuffer.GetLineFromLineNumber(0).EndIncludingLineBreak, _view.Selection.End.Position); }
public void SelectionChanged3() { _buffer.SetupGet(x => x.IsProcessingInput).Returns(false).Verifiable(); _buffer.SetupGet(x => x.ModeKind).Returns(ModeKind.Normal).Verifiable(); _selection.SetupGet(x => x.IsEmpty).Returns(false).Verifiable(); _selection.Raise(x => x.SelectionChanged += null, null, EventArgs.Empty); Assert.IsFalse(_context.IsEmpty); _factory.Verify(); _buffer .Setup(x => x.SwitchMode(ModeKind.VisualCharacter, ModeArgument.None)) .Returns(_factory.Create <IMode>().Object) .Verifiable(); _context.RunAll(); _factory.Verify(); }
/// <summary> /// Run the given KeyInput against the Visual Studio simulation /// </summary> internal void Run(KeyInput keyInput) { using (var context = new TestableSynchronizationContext()) { _vsKeyboardInputSimulation.Run(keyInput); context.RunAll(); } }
public void TextViewOnlyNoVimRc() { VimRcState = VimRcState.LoadFailed; RaiseTextViewCreated(_textView); _synchronizer.Setup(x => x.StartSynchronizing(_vimBuffer, SettingSyncSource.Editor)).Verifiable(); TestableSynchronizationContext.RunAll(); Dispatcher.CurrentDispatcher.DoEvents(); _synchronizer.Verify(); }
public void TextViewOnlyWithVimRcAndEditorDefaults() { VimRcState = VimRcState.NewLoadSucceeded(new VimRcPath(VimRcKind.VimRc, "test"), new string[] { }); _vimApplicationSettings.SetupGet(x => x.UseEditorDefaults).Returns(true); RaiseTextViewCreated(_textView); _synchronizer.Setup(x => x.StartSynchronizing(_vimBuffer, SettingSyncSource.Editor)).Verifiable(); TestableSynchronizationContext.RunAll(); Dispatcher.CurrentDispatcher.DoEvents(); _synchronizer.Verify(); }
private void EnterMode(SnapshotSpan span, TextSelectionMode mode = TextSelectionMode.Stream) { _textView.SelectAndUpdateCaret(span, mode); Assert.IsFalse(_context.IsEmpty); _context.RunAll(); Assert.IsTrue(_context.IsEmpty); }
public void BothViewsUseEditor() { _vimApplicationSettings.SetupGet(x => x.UseEditorDefaults).Returns(true); SetupVsTextView(); RaiseTextViewCreated(_textView); RaiseVimBufferCreated(_vimBuffer); _synchronizer.Setup(x => x.StartSynchronizing(_vimBuffer, SettingSyncSource.Editor)).Verifiable(); RaiseVsTextViewCreated(_vsTextView.Object); _synchronizer.Verify(); InvalidateSynchronizer(); TestableSynchronizationContext.RunAll(); }
/// <summary> /// Run the given KeyInput against the Visual Studio simulation /// </summary> internal void Run(KeyInput keyInput) { _testableSynchronizationContext.Install(); try { _vsKeyProcessorSimulation.Run(keyInput); _testableSynchronizationContext.RunAll(); } finally { _testableSynchronizationContext.Uninstall(); } }
public void BothViewsWithVimRcAndEditorDefaults() { VimRcState = VimRcState.NewLoadSucceeded(new VimRcPath(VimRcKind.VimRc, "test"), new string[] { }); _vimApplicationSettings.SetupGet(x => x.UseEditorDefaults).Returns(true); SetupVsTextView(); RaiseTextViewCreated(_textView); RaiseVimBufferCreated(_vimBuffer); _synchronizer.Setup(x => x.StartSynchronizing(_vimBuffer, SettingSyncSource.Editor)).Verifiable(); RaiseVsTextViewCreated(_vsTextView.Object); _synchronizer.Verify(); InvalidateSynchronizer(); TestableSynchronizationContext.RunAll(); }
private List <ITagSpan <TextMarkerTag> > GetTagsFull(SnapshotSpan span, out bool wasAsync) { Assert.IsTrue(_asyncTagger.AsyncBackgroundRequest.IsNone()); wasAsync = false; var tags = _asyncTagger.GetTags(new NormalizedSnapshotSpanCollection(span)).ToList(); if (_asyncTagger.AsyncBackgroundRequest.IsSome()) { _asyncTagger.AsyncBackgroundRequest.Value.Task.Wait(); _synchronizationContext.RunAll(); tags = _asyncTagger.GetTags(new NormalizedSnapshotSpanCollection(span)).ToList(); wasAsync = true; } return(tags); }
internal void RunExec(EditCommand editCommand) { var oleCommandData = OleCommandData.Empty; try { Assert.True(OleCommandUtil.TryConvert(editCommand, out oleCommandData)); _target.Exec(oleCommandData); } finally { oleCommandData.Dispose(); } TestableSynchronizationContext.RunAll(); }
public void Dispose() { _synchronizationContext.RunAll(); _synchronizationContext.Uninstall(); }
public override void Dispose() { base.Dispose(); _synchronizationContext.RunAll(); _synchronizationContext.Uninstall(); }