Index: Core/Plugins/src/Core.Plugins.CommonTools.Gui/Commands/Charting/ChartViewCommandBase.cs
===================================================================
diff -u -r3bfa4dc5fb5ea3560752479de86cb843419f8fe3 -rb0df2017d77cc00832a846a46518a2c96f927247
--- Core/Plugins/src/Core.Plugins.CommonTools.Gui/Commands/Charting/ChartViewCommandBase.cs (.../ChartViewCommandBase.cs) (revision 3bfa4dc5fb5ea3560752479de86cb843419f8fe3)
+++ Core/Plugins/src/Core.Plugins.CommonTools.Gui/Commands/Charting/ChartViewCommandBase.cs (.../ChartViewCommandBase.cs) (revision b0df2017d77cc00832a846a46518a2c96f927247)
@@ -31,12 +31,12 @@
/// Gets the currently active view if it is a and
/// null otherwise.
///
- protected ChartView View
+ protected IChartView View
{
get
{
return Gui != null
- ? Gui.DocumentViews.ActiveView as ChartView
+ ? Gui.DocumentViews.ActiveView as IChartView
: null;
}
}
Index: Core/Plugins/test/Core.Plugins.CommonTools.Gui.Test/Commands/Charting/ChartViewCommandBaseTest.cs
===================================================================
diff -u -r3bfa4dc5fb5ea3560752479de86cb843419f8fe3 -rb0df2017d77cc00832a846a46518a2c96f927247
--- Core/Plugins/test/Core.Plugins.CommonTools.Gui.Test/Commands/Charting/ChartViewCommandBaseTest.cs (.../ChartViewCommandBaseTest.cs) (revision 3bfa4dc5fb5ea3560752479de86cb843419f8fe3)
+++ Core/Plugins/test/Core.Plugins.CommonTools.Gui.Test/Commands/Charting/ChartViewCommandBaseTest.cs (.../ChartViewCommandBaseTest.cs) (revision b0df2017d77cc00832a846a46518a2c96f927247)
@@ -181,7 +181,7 @@
return base.GetChangedFontSize(font, points);
}
- public ChartView GetView()
+ public IChartView GetView()
{
return View;
}
Index: Core/Plugins/test/Core.Plugins.CommonTools.Gui.Test/Commands/Charting/DecreaseFontSizeCommandTest.cs
===================================================================
diff -u
--- Core/Plugins/test/Core.Plugins.CommonTools.Gui.Test/Commands/Charting/DecreaseFontSizeCommandTest.cs (revision 0)
+++ Core/Plugins/test/Core.Plugins.CommonTools.Gui.Test/Commands/Charting/DecreaseFontSizeCommandTest.cs (revision b0df2017d77cc00832a846a46518a2c96f927247)
@@ -0,0 +1,95 @@
+using System.Drawing;
+using Core.Common.Controls.Swf.Charting;
+using Core.Common.Gui;
+using Core.Common.Test.TestObjects;
+using Core.Plugins.CommonTools.Gui.Commands.Charting;
+using NUnit.Framework;
+using Rhino.Mocks;
+
+namespace Core.Plugins.CommonTools.Gui.Test.Commands.Charting
+{
+ [TestFixture]
+ public class DecreaseFontSizeCommandTest
+ {
+ private MockRepository mocks;
+ private IGui gui;
+ private IViewList documentsView;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ gui = mocks.StrictMock();
+ documentsView = mocks.StrictMock();
+ gui.Expect(g => g.DocumentViews).Return(documentsView);
+ }
+
+ [Test]
+ public void Execute_WithActiveChartView_FontSizesDecreasedByOne()
+ {
+ // Setup
+ IChart chart = new Chart();
+ var view = new ChartView
+ {
+ Chart = chart
+ };
+ var command = new DecreaseFontSizeCommand
+ {
+ Gui = gui
+ };
+
+ documentsView.Expect(dv => dv.ActiveView).Return(view);
+
+ var family = FontFamily.GenericSansSerif;
+ var size = 12;
+
+ chart.Font = new Font(family, size);
+ chart.Legend.Font = new Font(family, size);
+ chart.LeftAxis.LabelsFont = new Font(family, size);
+ chart.LeftAxis.TitleFont = new Font(family, size);
+ chart.BottomAxis.LabelsFont = new Font(family, size);
+ chart.BottomAxis.TitleFont = new Font(family, size);
+ chart.RightAxis.LabelsFont = new Font(family, size);
+ chart.RightAxis.TitleFont = new Font(family, size);
+
+ mocks.ReplayAll();
+
+ // Call
+ command.Execute();
+
+ // Assert
+ var expectedSize = size - 1;
+ Assert.AreEqual(expectedSize, chart.Font.SizeInPoints);
+ Assert.AreEqual(expectedSize, chart.Legend.Font.SizeInPoints);
+ Assert.AreEqual(expectedSize, chart.LeftAxis.LabelsFont.SizeInPoints);
+ Assert.AreEqual(expectedSize, chart.LeftAxis.TitleFont.SizeInPoints);
+ Assert.AreEqual(expectedSize, chart.BottomAxis.LabelsFont.SizeInPoints);
+ Assert.AreEqual(expectedSize, chart.BottomAxis.TitleFont.SizeInPoints);
+ Assert.AreEqual(expectedSize, chart.RightAxis.LabelsFont.SizeInPoints);
+ Assert.AreEqual(expectedSize, chart.RightAxis.TitleFont.SizeInPoints);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Execute_WithActiveOtherView_DoesNotThrow()
+ {
+ // Setup
+ var view = new TestView();
+ var command = new DecreaseFontSizeCommand
+ {
+ Gui = gui
+ };
+
+ documentsView.Expect(dv => dv.ActiveView).Return(view);
+
+ mocks.ReplayAll();
+
+ // Call
+ command.Execute();
+
+ // Assert
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Core/Plugins/test/Core.Plugins.CommonTools.Gui.Test/Commands/Charting/ExportChartAsImageCommandTest.cs
===================================================================
diff -u
--- Core/Plugins/test/Core.Plugins.CommonTools.Gui.Test/Commands/Charting/ExportChartAsImageCommandTest.cs (revision 0)
+++ Core/Plugins/test/Core.Plugins.CommonTools.Gui.Test/Commands/Charting/ExportChartAsImageCommandTest.cs (revision b0df2017d77cc00832a846a46518a2c96f927247)
@@ -0,0 +1,69 @@
+using Core.Common.Controls.Swf.Charting;
+using Core.Common.Gui;
+using Core.Common.Test.TestObjects;
+using Core.Plugins.CommonTools.Gui.Commands.Charting;
+using NUnit.Framework;
+using Rhino.Mocks;
+
+namespace Core.Plugins.CommonTools.Gui.Test.Commands.Charting
+{
+ [TestFixture]
+ public class ExportChartAsImageCommandTest
+ {
+ private MockRepository mocks;
+ private IGui gui;
+ private IViewList documentsView;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ gui = mocks.StrictMock();
+ documentsView = mocks.StrictMock();
+ gui.Expect(g => g.DocumentViews).Return(documentsView);
+ }
+
+ [Test]
+ public void Execute_WithActiveChartView_CallsExportAsImage()
+ {
+ // Setup
+ var chartView = mocks.StrictMock();
+ chartView.Expect(cv => cv.ExportAsImage());
+ documentsView.Expect(dv => dv.ActiveView).Return(chartView);
+
+ mocks.ReplayAll();
+
+ var command = new ExportChartAsImageCommand
+ {
+ Gui = gui
+ };
+
+ // Call
+ command.Execute();
+
+ // Assert
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Execute_WithActiveOtherView_DoesNotThrow()
+ {
+ // Setup
+ var view = new TestView();
+ var command = new IncreaseFontSizeCommand
+ {
+ Gui = gui
+ };
+
+ documentsView.Expect(dv => dv.ActiveView).Return(view);
+
+ mocks.ReplayAll();
+
+ // Call
+ command.Execute();
+
+ // Assert
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Core/Plugins/test/Core.Plugins.CommonTools.Gui.Test/Commands/Charting/IncreaseFontSizeCommandTest.cs
===================================================================
diff -u
--- Core/Plugins/test/Core.Plugins.CommonTools.Gui.Test/Commands/Charting/IncreaseFontSizeCommandTest.cs (revision 0)
+++ Core/Plugins/test/Core.Plugins.CommonTools.Gui.Test/Commands/Charting/IncreaseFontSizeCommandTest.cs (revision b0df2017d77cc00832a846a46518a2c96f927247)
@@ -0,0 +1,95 @@
+using System.Drawing;
+using Core.Common.Controls.Swf.Charting;
+using Core.Common.Gui;
+using Core.Common.Test.TestObjects;
+using Core.Plugins.CommonTools.Gui.Commands.Charting;
+using NUnit.Framework;
+using Rhino.Mocks;
+
+namespace Core.Plugins.CommonTools.Gui.Test.Commands.Charting
+{
+ [TestFixture]
+ public class IncreaseFontSizeCommandTest
+ {
+ private MockRepository mocks;
+ private IGui gui;
+ private IViewList documentsView;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ gui = mocks.StrictMock();
+ documentsView = mocks.StrictMock();
+ gui.Expect(g => g.DocumentViews).Return(documentsView);
+ }
+
+ [Test]
+ public void Execute_WithActiveChartView_FontSizesDecreasedByOne()
+ {
+ // Setup
+ IChart chart = new Chart();
+ var view = new ChartView
+ {
+ Chart = chart
+ };
+ var command = new IncreaseFontSizeCommand
+ {
+ Gui = gui
+ };
+
+ documentsView.Expect(dv => dv.ActiveView).Return(view);
+
+ var family = FontFamily.GenericSansSerif;
+ var size = 12;
+
+ chart.Font = new Font(family, size);
+ chart.Legend.Font = new Font(family, size);
+ chart.LeftAxis.LabelsFont = new Font(family, size);
+ chart.LeftAxis.TitleFont = new Font(family, size);
+ chart.BottomAxis.LabelsFont = new Font(family, size);
+ chart.BottomAxis.TitleFont = new Font(family, size);
+ chart.RightAxis.LabelsFont = new Font(family, size);
+ chart.RightAxis.TitleFont = new Font(family, size);
+
+ mocks.ReplayAll();
+
+ // Call
+ command.Execute();
+
+ // Assert
+ var expectedSize = size + 1;
+ Assert.AreEqual(expectedSize, chart.Font.SizeInPoints);
+ Assert.AreEqual(expectedSize, chart.Legend.Font.SizeInPoints);
+ Assert.AreEqual(expectedSize, chart.LeftAxis.LabelsFont.SizeInPoints);
+ Assert.AreEqual(expectedSize, chart.LeftAxis.TitleFont.SizeInPoints);
+ Assert.AreEqual(expectedSize, chart.BottomAxis.LabelsFont.SizeInPoints);
+ Assert.AreEqual(expectedSize, chart.BottomAxis.TitleFont.SizeInPoints);
+ Assert.AreEqual(expectedSize, chart.RightAxis.LabelsFont.SizeInPoints);
+ Assert.AreEqual(expectedSize, chart.RightAxis.TitleFont.SizeInPoints);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Execute_WithActiveOtherView_DoesNotThrow()
+ {
+ // Setup
+ var view = new TestView();
+ var command = new IncreaseFontSizeCommand
+ {
+ Gui = gui
+ };
+
+ documentsView.Expect(dv => dv.ActiveView).Return(view);
+
+ mocks.ReplayAll();
+
+ // Call
+ command.Execute();
+
+ // Assert
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Core/Plugins/test/Core.Plugins.CommonTools.Gui.Test/Core.Plugins.CommonTools.Gui.Test.csproj
===================================================================
diff -u -r3bfa4dc5fb5ea3560752479de86cb843419f8fe3 -rb0df2017d77cc00832a846a46518a2c96f927247
--- Core/Plugins/test/Core.Plugins.CommonTools.Gui.Test/Core.Plugins.CommonTools.Gui.Test.csproj (.../Core.Plugins.CommonTools.Gui.Test.csproj) (revision 3bfa4dc5fb5ea3560752479de86cb843419f8fe3)
+++ Core/Plugins/test/Core.Plugins.CommonTools.Gui.Test/Core.Plugins.CommonTools.Gui.Test.csproj (.../Core.Plugins.CommonTools.Gui.Test.csproj) (revision b0df2017d77cc00832a846a46518a2c96f927247)
@@ -77,6 +77,9 @@
+
+
+