예제 #1
0
 public IPlotHistory GetPlotHistory(IRSession session)
 {
     if (_instance == null)
     {
         _instance = new PlotHistory(session);
     }
     return(_instance);
 }
예제 #2
0
        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();
        }
예제 #3
0
        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();
        }
예제 #4
0
        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()) {
                        try {
                            await interaction.RespondAsync(c + Environment.NewLine);
                            EventsPump.DoEvents(100);
                        } catch (RException) { }
                    }
                }

                for (int i = _commands.Length - 1; i >= 0; i--) {
                    try {
                        await history.PlotContentProvider.PreviousPlotAsync();
                        EventsPump.DoEvents(100);
                    } catch (RException) { }
                }

                for (int i = 0; i < _commands.Length; i++) {
                    try {
                        await history.PlotContentProvider.NextPlotAsync();
                        EventsPump.DoEvents(500);
                    } catch (RException) { }
                }

                EventsPump.DoEvents(1000);
            }
        }
예제 #5
0
 public IPlotHistory GetPlotHistory(IRSession session) {
     if(_instance == null) {
         _instance = new PlotHistory(session);
     }
     return _instance;
 }
예제 #6
0
        public void ExportPlotAsImage() {
            var history = new PlotHistory();
            var cmd = new ExportPlotAsImageCommand(history);

            cmd.CommandID.ID.Should().Be(RPackageCommandId.icmdExportPlotAsImage);
            cmd.Should().BeDisabled();

            history.ActivePlotIndex = 0;
            history.PlotCount = 1;
            cmd.Should().BeEnabled();
        }
예제 #7
0
        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();
        }
예제 #8
0
        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();
        }