public async Task HistoryAutoHide() { using (_workflow.Plots.GetOrCreateVisualComponent(_plotHistoryVisualComponentContainerFactory, 0)) { var historyVC = _workflow.Plots.HistoryVisualComponent; var historyCommands = new RPlotHistoryCommands(_workflow, historyVC); historyVC.AutoHide = false; historyCommands.AutoHide.Should().BeVisibleAndEnabled(); historyCommands.AutoHide.Should().BeUnchecked(); await historyCommands.AutoHide.InvokeAsync(); historyVC.AutoHide.Should().BeTrue(); historyCommands.AutoHide.Should().BeVisibleAndEnabled(); historyCommands.AutoHide.Should().BeChecked(); await historyCommands.AutoHide.InvokeAsync(); historyVC.AutoHide.Should().BeFalse(); historyCommands.AutoHide.Should().BeVisibleAndEnabled(); historyCommands.AutoHide.Should().BeUnchecked(); } }
public async Task HistoryZoom() { using (_workflow.Plots.GetOrCreateVisualComponent(_plotHistoryVisualComponentContainerFactory, 0)) { var historyVC = _workflow.Plots.HistoryVisualComponent; var historyCommands = new RPlotHistoryCommands(_workflow, historyVC); // Default is 96, and minimum is 48, so we are able to zoom out once historyCommands.ZoomOut.Should().BeEnabled(); await historyCommands.ZoomOut.InvokeAsync(); historyCommands.ZoomOut.Should().BeDisabled(); historyCommands.ZoomIn.Should().BeEnabled(); await historyCommands.ZoomIn.InvokeAsync(); historyCommands.ZoomOut.Should().BeEnabled(); } }
public async Task HistoryCopy() { using (_workflow.Plots.GetOrCreateVisualComponent(_plotHistoryVisualComponentContainerFactory, 0)) { await InitializeGraphicsDevice(); await ExecuteAndWaitForPlotsAsync(new string[] { "plot(1:10)", }); var historyVC = _workflow.Plots.HistoryVisualComponent; var historyCommands = new RPlotHistoryCommands(_workflow, historyVC); var device1 = _workflow.Plots.ActiveDevice; var device1VC = _workflow.Plots.GetPlotVisualComponent(device1); var plot1 = device1.ActivePlot; await InitializeGraphicsDevice(); await ExecuteAndWaitForPlotsAsync(new string[] { "plot(2:10)", }); var device2 = _workflow.Plots.ActiveDevice; var device2VC = _workflow.Plots.GetPlotVisualComponent(device2); var device2Commands = new RPlotDeviceCommands(_workflow, device2VC); var plot2 = device2.ActivePlot; historyVC.SelectedPlot = plot1; historyCommands.Copy.Should().BeEnabled(); await historyCommands.Copy.InvokeAsync(); CoreShell.LastShownErrorMessage.Should().BeNullOrEmpty(); device2Commands.Paste.Should().BeEnabled(); var plotReceivedTask = EventTaskSources.IRPlotDevice.PlotAddedOrUpdated.Create(device2); await device2Commands.Paste.InvokeAsync(); await plotReceivedTask; CoreShell.LastShownErrorMessage.Should().BeNullOrEmpty(); device2.ActivePlot.Image.Should().HaveSamePixels(plot1.Image); } }
public async Task HistoryRemove() { using (_workflow.Plots.GetOrCreateVisualComponent(_plotHistoryVisualComponentContainerFactory, 0)) { await InitializeGraphicsDevice(); await ExecuteAndWaitForPlotsAsync(new string[] { "plot(1:10)", }); var historyVC = _workflow.Plots.HistoryVisualComponent; var historyCommands = new RPlotHistoryCommands(_workflow, historyVC); var device1 = _workflow.Plots.ActiveDevice; var device1VC = _workflow.Plots.GetPlotVisualComponent(device1); var plot1 = device1.ActivePlot; await InitializeGraphicsDevice(); await ExecuteAndWaitForPlotsAsync(new string[] { "plot(2:10)", }); var device2 = _workflow.Plots.ActiveDevice; var device2VC = _workflow.Plots.GetPlotVisualComponent(device2); var plot2 = device2.ActivePlot; historyVC.SelectedPlot = null; historyCommands.Remove.Should().BeDisabled(); // Select the only plot in device 1 and remove it historyVC.SelectedPlot = plot1; historyCommands.Remove.Should().BeEnabled(); var plotRemovedTask = EventTaskSources.IRPlotDevice.PlotRemoved.Create(device1); await historyCommands.Remove.InvokeAsync(); await plotRemovedTask; device1.ActivePlot.Should().BeNull(); device1.PlotCount.Should().Be(0); device1.ActiveIndex.Should().Be(-1); // Deleting the plot from device 1 should not have changed the active device _workflow.Plots.ActiveDevice.Should().Be(device2); // Select the only plot in device 2 and remove it historyVC.SelectedPlot = plot2; historyCommands.Remove.Should().BeEnabled(); plotRemovedTask = EventTaskSources.IRPlotDevice.PlotRemoved.Create(device2); await historyCommands.Remove.InvokeAsync(); await plotRemovedTask; device2.ActivePlot.Should().BeNull(); device2.PlotCount.Should().Be(0); device2.ActiveIndex.Should().Be(-1); } }
public async Task HistoryActivate() { using (_workflow.Plots.GetOrCreateVisualComponent(_plotHistoryVisualComponentContainerFactory, 0)) { var plot1to10 = await GetExpectedImageAsync("bmp", 600, 500, 96, "plot1-10", "plot(1:10)"); var plot2to10 = await GetExpectedImageAsync("bmp", 600, 500, 96, "plot2-10", "plot(2:10)"); await InitializeGraphicsDevice(); await ExecuteAndWaitForPlotsAsync(new string[] { "plot(1:10)", "plot(2:10)", }); var deviceVC = _workflow.Plots.GetPlotVisualComponent(_workflow.Plots.ActiveDevice); var historyVC = _workflow.Plots.HistoryVisualComponent; var historyCommands = new RPlotHistoryCommands(_workflow, historyVC); historyCommands.ActivatePlot.Should().BeDisabled(); // Select and activate the first plot historyVC.SelectedPlot = _workflow.Plots.ActiveDevice.GetPlotAt(0); historyCommands.ActivatePlot.Should().BeEnabled(); var plotReceivedTask = EventTaskSources.IRPlotDevice.PlotAddedOrUpdated.Create(_workflow.Plots.ActiveDevice); await historyCommands.ActivatePlot.InvokeAsync(); await plotReceivedTask; _workflow.Plots.ActiveDevice.ActivePlot.Image.Should().HaveSamePixels(plot1to10); CoreShell.LastShownErrorMessage.Should().BeNullOrEmpty(); } }