Index: Core/Components/test/Core.Components.OxyPlot.Forms.Test/LinearPlotViewTest.cs =================================================================== diff -u -rc5672681b9872a622ff718acd6975118ad59474f -r51df95d01a9a147c47519f5dec24a2d27b6f9a9a --- Core/Components/test/Core.Components.OxyPlot.Forms.Test/LinearPlotViewTest.cs (.../LinearPlotViewTest.cs) (revision c5672681b9872a622ff718acd6975118ad59474f) +++ Core/Components/test/Core.Components.OxyPlot.Forms.Test/LinearPlotViewTest.cs (.../LinearPlotViewTest.cs) (revision 51df95d01a9a147c47519f5dec24a2d27b6f9a9a) @@ -4,7 +4,6 @@ using OxyPlot; using OxyPlot.Axes; using Core.Components.OxyPlot.Forms.Properties; -using OxyPlot.Series; using OxyPlot.WindowsForms; using TickStyle = OxyPlot.Axes.TickStyle; @@ -37,107 +36,22 @@ } [Test] - public void ZoomToAll_ViewInForm_AxesAreSetToOriginal() + public void ZoomToAll_ViewInForm_InvalidatesView() { // Setup var form = new Form(); - var view = new LinearPlotView - { - Dock = DockStyle.Fill - }; - + var view = new LinearPlotView(); form.Controls.Add(view); + var invalidated = 0; + view.Invalidated += (sender, args) => invalidated++; form.Show(); - view.Model.Series.Add(new LineSeries - { - Points = - { - new DataPoint(0,0), - new DataPoint(10,10) - } - }); - - view.Refresh(); - - var maxX = view.Model.Axes[0].ActualMaximum; - var minX = view.Model.Axes[0].ActualMinimum; - var maxY = view.Model.Axes[1].ActualMaximum; - var minY = view.Model.Axes[1].ActualMinimum; - - view.Model.ZoomAllAxes(1.2); - - // Preconditions - Assert.AreNotEqual(maxX, view.Model.Axes[0].ActualMaximum); - Assert.AreNotEqual(minX, view.Model.Axes[0].ActualMinimum); - Assert.AreNotEqual(maxY, view.Model.Axes[1].ActualMaximum); - Assert.AreNotEqual(minY, view.Model.Axes[1].ActualMinimum); - // Call view.ZoomToAll(); // Assert - Assert.AreEqual(maxX, view.Model.Axes[0].ActualMaximum); - Assert.AreEqual(minX, view.Model.Axes[0].ActualMinimum); - Assert.AreEqual(maxY, view.Model.Axes[1].ActualMaximum); - Assert.AreEqual(minY, view.Model.Axes[1].ActualMinimum); + Assert.AreEqual(1, invalidated); } - - [Test] - public void ZoomToAll_ViewInFormSerieVisibilityUpdated_AxesAreUpdated() - { - // Setup - var form = new Form(); - var view = new LinearPlotView - { - Dock = DockStyle.Fill, - Padding = new Padding(0) - }; - - form.Controls.Add(view); - - form.Show(); - - var lineSeries = new LineSeries - { - Points = - { - new DataPoint(0,0), - new DataPoint(5,5) - } - }; - var lineSeriesToBeUpdated = new LineSeries - { - Points = - { - new DataPoint(5,5), - new DataPoint(10,10) - } - }; - view.Model.Series.Add(lineSeries); - view.Model.Series.Add(lineSeriesToBeUpdated); - - view.Refresh(); - - var maxX = view.Model.Axes[0].ActualMaximum; - var minX = view.Model.Axes[0].ActualMinimum; - var maxY = view.Model.Axes[1].ActualMaximum; - var minY = view.Model.Axes[1].ActualMinimum; - - lineSeriesToBeUpdated.IsVisible = false; - view.InvalidatePlot(true); - view.Refresh(); - - // Call - view.ZoomToAll(); - - // Assert - - Assert.Greater(maxX, view.Model.Axes[0].ActualMaximum); - Assert.AreEqual(minX/2, view.Model.Axes[0].ActualMinimum, 1e-6); - Assert.Greater(maxY, view.Model.Axes[1].ActualMaximum); - Assert.AreEqual(minY/2, view.Model.Axes[1].ActualMinimum, 1e-6); - } } } \ No newline at end of file