public async Task PlotALot() { var sessionProvider = VsAppShell.Current.ExportProvider.GetExportedValue <IRSessionProvider>(); var app = new RHostClientPlotTestApp(); using (var script = new RHostScript(sessionProvider, app)) { var history = new PlotHistory(script.Session); app.History = history; foreach (var c in _commands) { using (var interaction = await script.Session.BeginInteractionAsync()) { await interaction.RespondAsync(c + Environment.NewLine); EventsPump.DoEvents(100); } } for (int i = _commands.Length - 1; i >= 0; i--) { await history.PlotContentProvider.PreviousPlotAsync(); EventsPump.DoEvents(100); } for (int i = 0; i < _commands.Length; i++) { await history.PlotContentProvider.NextPlotAsync(); EventsPump.DoEvents(500); } EventsPump.DoEvents(1000); } }
public void ExportPlotAsImage() { var history = new PlotHistory(); var cmd = new ExportPlotAsImageCommand(null, history); cmd.CommandID.ID.Should().Be(RPackageCommandId.icmdExportPlotAsImage); cmd.Should().BeDisabled(); history.ActivePlotIndex = 0; history.PlotCount = 1; cmd.Should().BeEnabled(); }
public void CopyPlotAsMetafile() { var history = new PlotHistory(); var cmd = new CopyPlotAsMetafileCommand(history); cmd.CommandID.ID.Should().Be(RPackageCommandId.icmdCopyPlotAsMetafile); cmd.Should().BeDisabled(); history.ActivePlotIndex = 0; history.PlotCount = 1; cmd.Should().BeEnabled(); }
public void RemovePlot() { var history = new PlotHistory(); var cmd = new RemovePlotCommand(history); cmd.CommandID.ID.Should().Be(RPackageCommandId.icmdRemovePlot); cmd.Should().BeDisabled(); history.ActivePlotIndex = 0; history.PlotCount = 1; cmd.Should().BeEnabled(); }
public void ClearAllPlots() { var history = new PlotHistory(); var cmd = new ClearPlotsCommand(history); cmd.CommandID.ID.Should().Be(RPackageCommandId.icmdClearPlots); cmd.Should().BeDisabled(); history.ActivePlotIndex = 0; history.PlotCount = 1; cmd.Should().BeEnabled(); }
public void HistoryPrevious() { var history = new PlotHistory(); var cmd = new HistoryPreviousPlotCommand(history); cmd.CommandID.ID.Should().Be(RPackageCommandId.icmdPrevPlot); cmd.Should().BeDisabled(); history.ActivePlotIndex = 0; history.PlotCount = 1; cmd.Should().BeDisabled(); history.ActivePlotIndex = 0; history.PlotCount = 2; cmd.Should().BeDisabled(); history.ActivePlotIndex = 1; history.PlotCount = 2; cmd.Should().BeEnabled(); }