Index: Core/Plugins/src/Core.Plugins.OxyPlot/Commands/ToggleLegendViewCommand.cs
===================================================================
diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r170ec8698dfed095e23f4fa822fe2198b3e5f242
--- Core/Plugins/src/Core.Plugins.OxyPlot/Commands/ToggleLegendViewCommand.cs (.../ToggleLegendViewCommand.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Commands/ToggleLegendViewCommand.cs (.../ToggleLegendViewCommand.cs) (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -25,17 +25,17 @@
namespace Core.Plugins.OxyPlot.Commands
{
///
- /// This class describes the command which toggles the visibility of the .
+ /// This class describes the command which toggles the visibility of the .
///
public class ToggleLegendViewCommand : ICommand
{
- private readonly LegendController controller;
+ private readonly ChartLegendController controller;
///
/// Creates a new instance of .
///
- /// The to use to invoke actions and determine state.
- public ToggleLegendViewCommand(LegendController controller)
+ /// The to use to invoke actions and determine state.
+ public ToggleLegendViewCommand(ChartLegendController controller)
{
this.controller = controller;
}
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Core.Plugins.OxyPlot.csproj
===================================================================
diff -u -r44055100aa3c3f382227becdaeae7d97c75d386c -r170ec8698dfed095e23f4fa822fe2198b3e5f242
--- Core/Plugins/src/Core.Plugins.OxyPlot/Core.Plugins.OxyPlot.csproj (.../Core.Plugins.OxyPlot.csproj) (revision 44055100aa3c3f382227becdaeae7d97c75d386c)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Core.Plugins.OxyPlot.csproj (.../Core.Plugins.OxyPlot.csproj) (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -66,13 +66,13 @@
ChartDataView.cs
-
+
UserControl
-
- LegendView.cs
+
+ ChartLegendView.cs
-
+
@@ -133,8 +133,8 @@
ChartDataView.cs
-
- LegendView.cs
+
+ ChartLegendView.cs
Designer
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartLegendController.cs
===================================================================
diff -u
--- Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartLegendController.cs (revision 0)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartLegendController.cs (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -0,0 +1,115 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Core.Common.Controls.Views;
+using Core.Common.Gui;
+using Core.Components.Charting.Data;
+
+namespace Core.Plugins.OxyPlot.Legend
+{
+ ///
+ /// This class controls the actions which are related to controlling visibility and updating contents of a .
+ ///
+ public class ChartLegendController
+ {
+ private readonly IToolViewController toolViewController;
+ private IView legendView;
+
+ ///
+ /// Fired when the legend has been opened.
+ ///
+ public EventHandler OnOpenLegend;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The to invoke actions upon.
+ public ChartLegendController(IToolViewController toolViewController)
+ {
+ if (toolViewController == null)
+ {
+ throw new ArgumentNullException("toolViewController", "Cannot create a ChartLegendController when the tool view controller is null.");
+ }
+ this.toolViewController = toolViewController;
+ }
+
+ ///
+ /// Toggles the .
+ ///
+ public void ToggleLegend()
+ {
+ if (IsLegendViewOpen())
+ {
+ CloseLegendView();
+ }
+ else
+ {
+ OpenLegendView();
+ }
+ }
+
+ ///
+ /// Checks whether a is open.
+ ///
+ /// true if the is open, false otherwise.
+ public bool IsLegendViewOpen()
+ {
+ return toolViewController.IsToolWindowOpen();
+ }
+
+ ///
+ /// Open the .
+ ///
+ private void OpenLegendView()
+ {
+ legendView = new ChartLegendView();
+ toolViewController.OpenToolView(legendView);
+ if (OnOpenLegend != null)
+ {
+ OnOpenLegend(this, EventArgs.Empty);
+ }
+ }
+
+ ///
+ /// Closes the .
+ ///
+ private void CloseLegendView()
+ {
+ toolViewController.CloseToolView(legendView);
+ legendView.Dispose();
+ legendView = null;
+ }
+
+ ///
+ /// Updates the data for the if it is open.
+ ///
+ /// The to show. If null the
+ /// data will be cleared.
+ public void Update(ChartData data)
+ {
+ if (IsLegendViewOpen())
+ {
+ legendView.Data = data;
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartLegendView.Designer.cs
===================================================================
diff -u
--- Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartLegendView.Designer.cs (revision 0)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartLegendView.Designer.cs (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -0,0 +1,44 @@
+using Core.Common.Controls.TreeView;
+
+namespace Core.Plugins.OxyPlot.Legend
+{
+ partial class ChartLegendView
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ChartLegendView));
+ this.treeViewControl = new TreeViewControl();
+ this.SuspendLayout();
+ //
+ // treeViewControl
+ //
+ resources.ApplyResources(this.treeViewControl, "treeViewControl");
+ this.treeViewControl.Name = "treeViewControl";
+ //
+ // ChartLegendView
+ //
+ resources.ApplyResources(this, "$this");
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.treeViewControl);
+ this.Name = "ChartLegendView";
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private TreeViewControl treeViewControl;
+ }
+}
\ No newline at end of file
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartLegendView.cs
===================================================================
diff -u
--- Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartLegendView.cs (revision 0)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartLegendView.cs (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -0,0 +1,162 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Linq;
+using System.Windows.Forms;
+using Core.Common.Base;
+using Core.Common.Controls.TreeView;
+using Core.Common.Controls.Views;
+using Core.Components.Charting.Data;
+using Core.Components.OxyPlot.Forms;
+using OxyPlotResources = Core.Plugins.OxyPlot.Properties.Resources;
+using GuiResources = Core.Common.Gui.Properties.Resources;
+
+namespace Core.Plugins.OxyPlot.Legend
+{
+ ///
+ /// This class defines a view which shows the data that have been added to a .
+ ///
+ public sealed partial class ChartLegendView : UserControl, IView
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ public ChartLegendView()
+ {
+ InitializeComponent();
+ Text = OxyPlotResources.General_Chart;
+
+ RegisterTreeNodeInfos();
+ }
+
+ public object Data
+ {
+ get
+ {
+ return (ChartData) treeViewControl.Data;
+ }
+ set
+ {
+ if (IsDisposed)
+ {
+ return;
+ }
+
+ treeViewControl.Data = (ChartData) value;
+ }
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ Data = null;
+
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+
+ base.Dispose(disposing);
+ }
+
+ private void RegisterTreeNodeInfos()
+ {
+ treeViewControl.RegisterTreeNodeInfo(new TreeNodeInfo
+ {
+ Text = pointData => pointData.Name,
+ Image = pointData => OxyPlotResources.PointsIcon,
+ CanDrag = (pointData, parentData) => true,
+ CanCheck = pointData => true,
+ IsChecked = pointData => pointData.IsVisible,
+ OnNodeChecked = PointBasedChartDataOnNodeChecked
+ });
+
+ treeViewControl.RegisterTreeNodeInfo(new TreeNodeInfo
+ {
+ Text = lineData => lineData.Name,
+ Image = lineData => OxyPlotResources.LineIcon,
+ CanDrag = (lineData, parentData) => true,
+ CanCheck = lineData => true,
+ IsChecked = lineData => lineData.IsVisible,
+ OnNodeChecked = PointBasedChartDataOnNodeChecked
+ });
+
+ treeViewControl.RegisterTreeNodeInfo(new TreeNodeInfo
+ {
+ Text = areaData => areaData.Name,
+ Image = areaData => OxyPlotResources.AreaIcon,
+ CanDrag = (areaData, parentData) => true,
+ CanCheck = areaData => true,
+ IsChecked = areaData => areaData.IsVisible,
+ OnNodeChecked = PointBasedChartDataOnNodeChecked
+ });
+
+ treeViewControl.RegisterTreeNodeInfo(new TreeNodeInfo
+ {
+ Text = chartControl => chartControl.Name,
+ Image = chartControl => GuiResources.folder,
+ ChildNodeObjects = chartControl => chartControl.List.Reverse().Cast().ToArray(),
+ CanDrop = ChartControlCanDrop,
+ CanInsert = ChartControlCanInsert,
+ OnDrop = ChartControlOnDrop
+ });
+ }
+
+ # region ChartData
+
+ private static void PointBasedChartDataOnNodeChecked(PointBasedChartData pointBasedChartData, object parentData)
+ {
+ pointBasedChartData.IsVisible = !pointBasedChartData.IsVisible;
+ pointBasedChartData.NotifyObservers();
+
+ var observableParent = parentData as IObservable;
+ if (observableParent != null)
+ {
+ observableParent.NotifyObservers();
+ }
+ }
+
+ # endregion
+
+ # region ChartDataCollection
+
+ private static bool ChartControlCanDrop(object draggedData, object targetData)
+ {
+ return draggedData is ChartData;
+ }
+
+ private static bool ChartControlCanInsert(object draggedData, object targetData)
+ {
+ return draggedData is ChartData;
+ }
+
+ private static void ChartControlOnDrop(object droppedData, object newParentData, object oldParentData, int position, TreeViewControl control)
+ {
+ var chartData = (ChartData) droppedData;
+ var target = (ChartDataCollection) newParentData;
+
+ target.List.Remove(chartData);
+ target.List.Insert(target.List.Count - position, chartData); // Note: target is the same as the previous parent in this case
+ target.NotifyObservers();
+ }
+
+ # endregion
+ }
+}
\ No newline at end of file
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartLegendView.resx
===================================================================
diff -u
--- Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartLegendView.resx (revision 0)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartLegendView.resx (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -0,0 +1,168 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ Fill
+
+
+
+ 0
+
+
+
+ 0, 0
+
+
+ 0
+
+
+ 228, 412
+
+
+ 2
+
+
+ treeViewControl
+
+
+ Core.Plugins.OxyPlot.Legend.LegendTreeView, Core.Plugins.OxyPlot, Version=0.5.0.1876, Culture=neutral, PublicKeyToken=null
+
+
+ $this
+
+
+ 0
+
+
+ True
+
+
+ 6, 13
+
+
+ 228, 412
+
+
+ ChartLegendView
+
+
+ System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
Fisheye: Tag 170ec8698dfed095e23f4fa822fe2198b3e5f242 refers to a dead (removed) revision in file `Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendController.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 170ec8698dfed095e23f4fa822fe2198b3e5f242 refers to a dead (removed) revision in file `Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.Designer.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 170ec8698dfed095e23f4fa822fe2198b3e5f242 refers to a dead (removed) revision in file `Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 170ec8698dfed095e23f4fa822fe2198b3e5f242 refers to a dead (removed) revision in file `Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.resx'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Plugins/src/Core.Plugins.OxyPlot/OxyPlotGuiPlugin.cs
===================================================================
diff -u -r25bdf707d3cd78e182705e16371a376222b7ee79 -r170ec8698dfed095e23f4fa822fe2198b3e5f242
--- Core/Plugins/src/Core.Plugins.OxyPlot/OxyPlotGuiPlugin.cs (.../OxyPlotGuiPlugin.cs) (revision 25bdf707d3cd78e182705e16371a376222b7ee79)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/OxyPlotGuiPlugin.cs (.../OxyPlotGuiPlugin.cs) (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -40,7 +40,7 @@
{
private ChartingRibbon chartingRibbon;
- private LegendController legendController;
+ private ChartLegendController chartLegendController;
private bool activated;
@@ -54,10 +54,10 @@
public override void Activate()
{
- legendController = CreateLegendController(Gui);
- chartingRibbon = CreateRibbon(legendController, Gui);
+ chartLegendController = CreateLegendController(Gui);
+ chartingRibbon = CreateRibbon(chartLegendController, Gui);
- legendController.ToggleLegend();
+ chartLegendController.ToggleLegend();
Gui.ActiveViewChanged += GuiOnActiveViewChanged;
activated = true;
}
@@ -81,30 +81,30 @@
}
///
- /// Creates a new .
+ /// Creates a new .
///
/// The to use for the controller
- /// .
- /// A new instance.
- private LegendController CreateLegendController(IToolViewController toolViewController)
+ /// .
+ /// A new instance.
+ private ChartLegendController CreateLegendController(IToolViewController toolViewController)
{
- var controller = new LegendController(toolViewController);
+ var controller = new ChartLegendController(toolViewController);
controller.OnOpenLegend += (s,e) => UpdateComponentsForActiveView();
return controller;
}
///
/// Creates the and the commands that will be used when clicking on the buttons.
///
- /// The to use for the
+ /// The to use for the
/// .
/// The controller for Document Views.
/// A new instance.
- private static ChartingRibbon CreateRibbon(LegendController legendController, IDocumentViewController documentViewController)
+ private static ChartingRibbon CreateRibbon(ChartLegendController chartLegendController, IDocumentViewController documentViewController)
{
return new ChartingRibbon
{
- ToggleLegendViewCommand = new ToggleLegendViewCommand(legendController)
+ ToggleLegendViewCommand = new ToggleLegendViewCommand(chartLegendController)
};
}
@@ -123,12 +123,12 @@
if (chartView != null)
{
chartingRibbon.Chart = chartView.Chart;
- legendController.Update(chartView.Chart.Data);
+ chartLegendController.Update(chartView.Chart.Data);
}
else
{
chartingRibbon.Chart = null;
- legendController.Update(null);
+ chartLegendController.Update(null);
}
}
}
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Properties/Resources.Designer.cs
===================================================================
diff -u -r6afedd402a3e74f1dc15367275220d6d5c04fb40 -r170ec8698dfed095e23f4fa822fe2198b3e5f242
--- Core/Plugins/src/Core.Plugins.OxyPlot/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 6afedd402a3e74f1dc15367275220d6d5c04fb40)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
+// Runtime Version:4.0.30319.17929
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -71,33 +71,6 @@
}
///
- /// Looks up a localized string similar to Gebied.
- ///
- public static string ChartData_Area_data_label {
- get {
- return ResourceManager.GetString("ChartData_Area_data_label", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Lijn.
- ///
- public static string ChartData_Line_data_label {
- get {
- return ResourceManager.GetString("ChartData_Line_data_label", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Punten.
- ///
- public static string ChartData_Point_data_label {
- get {
- return ResourceManager.GetString("ChartData_Point_data_label", resourceCulture);
- }
- }
-
- ///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
public static System.Drawing.Bitmap ChartIcon {
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Properties/Resources.resx
===================================================================
diff -u -r6afedd402a3e74f1dc15367275220d6d5c04fb40 -r170ec8698dfed095e23f4fa822fe2198b3e5f242
--- Core/Plugins/src/Core.Plugins.OxyPlot/Properties/Resources.resx (.../Resources.resx) (revision 6afedd402a3e74f1dc15367275220d6d5c04fb40)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Properties/Resources.resx (.../Resources.resx) (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -121,15 +121,6 @@
..\resources\area.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- Gebied
-
-
- Lijn
-
-
- Punten
-
..\resources\chart.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Index: Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapLineDataTreeNodeInfoTest.cs
===================================================================
diff -u -r068e27ad7b5fb663d8f272d4aebbcf2d3e365abf -r170ec8698dfed095e23f4fa822fe2198b3e5f242
--- Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapLineDataTreeNodeInfoTest.cs (.../MapLineDataTreeNodeInfoTest.cs) (revision 068e27ad7b5fb663d8f272d4aebbcf2d3e365abf)
+++ Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapLineDataTreeNodeInfoTest.cs (.../MapLineDataTreeNodeInfoTest.cs) (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -47,7 +47,7 @@
}
[Test]
- public void Text_Always_ReturnsTextFromResource()
+ public void Text_Always_ReturnsNameFromMapData()
{
// Setup
var mocks = CreateDefaultMocks();
Index: Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapPointDataTreeNodeInfoTest.cs
===================================================================
diff -u -r354027b2a36a779798852d3edadaaf339140295c -r170ec8698dfed095e23f4fa822fe2198b3e5f242
--- Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapPointDataTreeNodeInfoTest.cs (.../MapPointDataTreeNodeInfoTest.cs) (revision 354027b2a36a779798852d3edadaaf339140295c)
+++ Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapPointDataTreeNodeInfoTest.cs (.../MapPointDataTreeNodeInfoTest.cs) (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -41,7 +41,7 @@
}
[Test]
- public void Text_Always_ReturnsTextFromResource()
+ public void Text_Always_ReturnsNameFromMapData()
{
// Setup
var mocks = CreateDefaultMocks();
Index: Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapPolygonDataTreeNodeInfoTest.cs
===================================================================
diff -u -r354027b2a36a779798852d3edadaaf339140295c -r170ec8698dfed095e23f4fa822fe2198b3e5f242
--- Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapPolygonDataTreeNodeInfoTest.cs (.../MapPolygonDataTreeNodeInfoTest.cs) (revision 354027b2a36a779798852d3edadaaf339140295c)
+++ Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapPolygonDataTreeNodeInfoTest.cs (.../MapPolygonDataTreeNodeInfoTest.cs) (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -41,7 +41,7 @@
}
[Test]
- public void Text_Always_ReturnsTextFromResource()
+ public void Text_Always_ReturnsNameFromMapData()
{
// Setup
var mocks = CreateDefaultMocks();
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/ChartingRibbonTest.cs
===================================================================
diff -u -r30b12b82918d500fe834eafd9f6cd9b2c5dbe60f -r170ec8698dfed095e23f4fa822fe2198b3e5f242
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/ChartingRibbonTest.cs (.../ChartingRibbonTest.cs) (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/ChartingRibbonTest.cs (.../ChartingRibbonTest.cs) (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -38,7 +38,7 @@
var toolViewController = mocks.Stub();
mocks.ReplayAll();
- var toggleLegendViewCommand = new ToggleLegendViewCommand(new LegendController(toolViewController));
+ var toggleLegendViewCommand = new ToggleLegendViewCommand(new ChartLegendController(toolViewController));
var ribbon = new ChartingRibbon
{
ToggleLegendViewCommand = toggleLegendViewCommand,
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Commands/ToggleLegendViewCommandTest.cs
===================================================================
diff -u -r0d7895f07d2c1b15457ffdc8e8762780a5837030 -r170ec8698dfed095e23f4fa822fe2198b3e5f242
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Commands/ToggleLegendViewCommandTest.cs (.../ToggleLegendViewCommandTest.cs) (revision 0d7895f07d2c1b15457ffdc8e8762780a5837030)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Commands/ToggleLegendViewCommandTest.cs (.../ToggleLegendViewCommandTest.cs) (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -38,11 +38,11 @@
// Setup
var mocks = new MockRepository();
var plugin = mocks.StrictMock();
- plugin.Expect(p => p.IsToolWindowOpen()).Return(open);
+ plugin.Expect(p => p.IsToolWindowOpen()).Return(open);
mocks.ReplayAll();
- var controller = new LegendController(plugin);
+ var controller = new ChartLegendController(plugin);
var command = new ToggleLegendViewCommand(controller);
// Call
@@ -63,16 +63,16 @@
// Open first
using (mocks.Ordered())
{
- plugin.Expect(p => p.IsToolWindowOpen()).Return(false);
- plugin.Expect(p => p.OpenToolView(Arg.Matches(v => true)));
+ plugin.Expect(p => p.IsToolWindowOpen()).Return(false);
+ plugin.Expect(p => p.OpenToolView(Arg.Matches(v => true)));
// Then close
- plugin.Expect(p => p.IsToolWindowOpen()).Return(true);
- plugin.Expect(p => p.CloseToolView(Arg.Matches(v => true)));
+ plugin.Expect(p => p.IsToolWindowOpen()).Return(true);
+ plugin.Expect(p => p.CloseToolView(Arg.Matches(v => true)));
}
mocks.ReplayAll();
- var controller = new LegendController(plugin);
+ var controller = new ChartLegendController(plugin);
var command = new ToggleLegendViewCommand(controller);
// Call
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Core.Plugins.OxyPlot.Test.csproj
===================================================================
diff -u -r25bdf707d3cd78e182705e16371a376222b7ee79 -r170ec8698dfed095e23f4fa822fe2198b3e5f242
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Core.Plugins.OxyPlot.Test.csproj (.../Core.Plugins.OxyPlot.Test.csproj) (revision 25bdf707d3cd78e182705e16371a376222b7ee79)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Core.Plugins.OxyPlot.Test.csproj (.../Core.Plugins.OxyPlot.Test.csproj) (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -62,11 +62,11 @@
-
-
-
-
-
+
+
+
+
+
Fisheye: Tag 170ec8698dfed095e23f4fa822fe2198b3e5f242 refers to a dead (removed) revision in file `Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/AreaDataTreeNodeInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartAreaDataTreeNodeInfoTest.cs
===================================================================
diff -u
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartAreaDataTreeNodeInfoTest.cs (revision 0)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartAreaDataTreeNodeInfoTest.cs (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -0,0 +1,190 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Core.Common.Base;
+using Core.Common.Controls.TreeView;
+using Core.Common.TestUtil;
+using Core.Common.Utils.Reflection;
+using Core.Components.Charting.Data;
+using Core.Plugins.OxyPlot.Legend;
+using Core.Plugins.OxyPlot.Properties;
+using NUnit.Framework;
+using Rhino.Mocks;
+
+namespace Core.Plugins.OxyPlot.Test.Legend
+{
+ [TestFixture]
+ public class ChartAreaDataTreeNodeInfoTest
+ {
+ private MockRepository mocks;
+ private ChartLegendView chartLegendView;
+ private TreeNodeInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ chartLegendView = new ChartLegendView();
+
+ var treeViewControl = TypeUtils.GetField(chartLegendView, "treeViewControl");
+ var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup");
+
+ info = treeNodeInfoLookup[typeof(ChartAreaData)];
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ chartLegendView.Dispose();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(ChartAreaData), info.TagType);
+ Assert.IsNull(info.ForeColor);
+ Assert.IsNull(info.ContextMenuStrip);
+ Assert.IsNull(info.EnsureVisibleOnCreate);
+ Assert.IsNull(info.ChildNodeObjects);
+ Assert.IsNull(info.CanRename);
+ Assert.IsNull(info.OnNodeRenamed);
+ Assert.IsNull(info.CanRemove);
+ Assert.IsNull(info.OnNodeRemoved);
+ Assert.IsNull(info.CanDrop);
+ Assert.IsNull(info.CanInsert);
+ Assert.IsNull(info.OnDrop);
+ }
+
+ [Test]
+ public void Text_Always_ReturnsNameFromChartData()
+ {
+ // Setup
+ var areaData = mocks.StrictMock(Enumerable.Empty>(), "test data");
+
+ mocks.ReplayAll();
+
+ // Call
+ var text = info.Text(areaData);
+
+ // Assert
+ Assert.AreEqual(areaData.Name, text);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Image_Always_ReturnsSetImage()
+ {
+ // Setup
+ var areaData = mocks.StrictMock(Enumerable.Empty>(), "test data");
+
+ mocks.ReplayAll();
+
+ // Call
+ var image = info.Image(areaData);
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(Resources.AreaIcon, image);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CanDrag_Always_ReturnsTrue()
+ {
+ // Setup
+ var areaData = mocks.StrictMock(Enumerable.Empty>(), "test data");
+
+ mocks.ReplayAll();
+
+ // Call
+ var canDrag = info.CanDrag(areaData, null);
+
+ // Assert
+ Assert.IsTrue(canDrag);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CanCheck_Always_ReturnsTrue()
+ {
+ // Setup
+ var areaData = mocks.StrictMock(Enumerable.Empty>(), "test data");
+
+ mocks.ReplayAll();
+
+ // Call
+ var canCheck = info.CanCheck(areaData);
+
+ // Assert
+ Assert.IsTrue(canCheck);
+
+ mocks.VerifyAll();
+ }
+
+ [TestCase(true)]
+ [TestCase(false)]
+ public void IsChecked_Always_ReturnsAccordingToVisibleStateOfAreaData(bool isVisible)
+ {
+ // Setup
+ var areaData = mocks.StrictMock(Enumerable.Empty>(), "test data");
+
+ areaData.IsVisible = isVisible;
+
+ mocks.ReplayAll();
+
+ // Call
+ var canCheck = info.IsChecked(areaData);
+
+ // Assert
+ Assert.AreEqual(isVisible, canCheck);
+
+ mocks.VerifyAll();
+ }
+
+ [TestCase(true)]
+ [TestCase(false)]
+ public void OnNodeChecked_AreaDataNodeWithoutParent_SetsAreaDataVisibility(bool initialVisibleState)
+ {
+ // Setup
+ var areaData = mocks.StrictMock(Enumerable.Empty>(), "test data");
+
+ mocks.ReplayAll();
+
+ areaData.IsVisible = initialVisibleState;
+
+ // Call
+ info.OnNodeChecked(areaData, null);
+
+ // Assert
+ Assert.AreEqual(!initialVisibleState, areaData.IsVisible);
+
+ mocks.VerifyAll();
+ }
+
+ [TestCase(true)]
+ [TestCase(false)]
+ public void OnNodeChecked_AreaDataNodeWithObservableParent_SetsAreaDataVisibilityAndNotifiesParentObservers(bool initialVisibleState)
+ {
+ // Setup
+ var observable = mocks.StrictMock();
+ var areaData = mocks.StrictMock(Enumerable.Empty>(), "test data");
+
+ observable.Expect(o => o.NotifyObservers());
+
+ mocks.ReplayAll();
+
+ areaData.IsVisible = initialVisibleState;
+
+ // Call
+ info.OnNodeChecked(areaData, observable);
+
+ // Assert
+ Assert.AreEqual(!initialVisibleState, areaData.IsVisible);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataCollectionTreeNodeInfoTest.cs
===================================================================
diff -u -r8aa11a9aa48733a5b5b72c58c71674472825b26c -r170ec8698dfed095e23f4fa822fe2198b3e5f242
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataCollectionTreeNodeInfoTest.cs (.../ChartDataCollectionTreeNodeInfoTest.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataCollectionTreeNodeInfoTest.cs (.../ChartDataCollectionTreeNodeInfoTest.cs) (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -18,16 +18,16 @@
public class ChartDataCollectionTreeNodeInfoTest
{
private MockRepository mocks;
- private LegendView legendView;
+ private ChartLegendView chartLegendView;
private TreeNodeInfo info;
[SetUp]
public void SetUp()
{
mocks = new MockRepository();
- legendView = new LegendView();
+ chartLegendView = new ChartLegendView();
- var treeViewControl = TypeUtils.GetField(legendView, "treeViewControl");
+ var treeViewControl = TypeUtils.GetField(chartLegendView, "treeViewControl");
var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup");
info = treeNodeInfoLookup[typeof(ChartDataCollection)];
@@ -36,7 +36,7 @@
[TearDown]
public void TearDown()
{
- legendView.Dispose();
+ chartLegendView.Dispose();
}
[Test]
@@ -58,7 +58,7 @@
}
[Test]
- public void Text_Always_ReturnsTextFromResource()
+ public void Text_Always_ReturnsNameFromChartData()
{
// Setup
var chartDataCollection = mocks.StrictMock(new List(), "test data");
@@ -69,7 +69,7 @@
var text = info.Text(chartDataCollection);
// Assert
- Assert.AreEqual(Resources.General_Chart, text);
+ Assert.AreEqual(chartDataCollection.Name, text);
mocks.VerifyAll();
}
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartLegendControllerTest.cs
===================================================================
diff -u
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartLegendControllerTest.cs (revision 0)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartLegendControllerTest.cs (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -0,0 +1,97 @@
+using System;
+using Core.Common.Gui;
+using Core.Plugins.OxyPlot.Legend;
+using NUnit.Framework;
+using Rhino.Mocks;
+
+namespace Core.Plugins.OxyPlot.Test.Legend
+{
+ [TestFixture]
+ public class ChartLegendControllerTest
+ {
+ [Test]
+ public void Constructor_WithoutPlugin_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => new ChartLegendController(null);
+
+ // Assert
+ Assert.Throws(test);
+ }
+
+ [Test]
+ public void Constructor_WithToolViewController_DoesNotThrow()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var toolViewController = mocks.StrictMock();
+
+ mocks.ReplayAll();
+
+ // Call
+ TestDelegate test = () => new ChartLegendController(toolViewController);
+
+ // Assert
+ Assert.DoesNotThrow(test);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void IsLegendViewOpen_LegendViewOpenAndClosedState_ReturnsExpectedState(bool open)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var toolViewController = mocks.StrictMock();
+ toolViewController.Expect(p => p.IsToolWindowOpen()).Return(open);
+
+ mocks.ReplayAll();
+
+ var controller = new ChartLegendController(toolViewController);
+
+ // Call
+ var result = controller.IsLegendViewOpen();
+
+ // Assert
+ Assert.AreEqual(open, result);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void ToggleLegendView_LegendViewOpenAndClosedState_TogglesStateOfLegendView(bool open)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var toolViewController = mocks.StrictMock();
+ if (open)
+ {
+ toolViewController.Expect(p => p.IsToolWindowOpen()).Return(false);
+ toolViewController.Expect(p => p.OpenToolView(Arg.Matches(c => true)));
+ toolViewController.Expect(p => p.CloseToolView(Arg.Matches(c => true)));
+ }
+ else
+ {
+ toolViewController.Expect(p => p.OpenToolView(Arg.Matches(c => true)));
+ }
+ toolViewController.Expect(p => p.IsToolWindowOpen()).Return(open);
+
+ mocks.ReplayAll();
+
+ var controller = new ChartLegendController(toolViewController);
+
+ if (open)
+ {
+ controller.ToggleLegend();
+ }
+
+ // Call
+ controller.ToggleLegend();
+
+ // Assert
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartLegendViewTest.cs
===================================================================
diff -u
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartLegendViewTest.cs (revision 0)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartLegendViewTest.cs (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -0,0 +1,95 @@
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+using Core.Common.Controls.TreeView;
+using Core.Common.Controls.Views;
+using Core.Common.Utils.Reflection;
+using Core.Components.Charting.Data;
+using Core.Plugins.OxyPlot.Legend;
+using Core.Plugins.OxyPlot.Properties;
+using NUnit.Framework;
+
+namespace Core.Plugins.OxyPlot.Test.Legend
+{
+ [TestFixture]
+ public class ChartLegendViewTest
+ {
+ [Test]
+ public void DefaultConstructor_CreatesUserControl()
+ {
+ // Call
+ using (var view = new ChartLegendView())
+ {
+ // Assert
+ Assert.IsInstanceOf(view);
+ Assert.IsInstanceOf(view);
+ Assert.IsNull(view.Data);
+ Assert.AreEqual(Resources.General_Chart, view.Text);
+ }
+ }
+
+ [Test]
+ public void Data_ChartControl_DataSet()
+ {
+ // Setup
+ using (var view = new ChartLegendView())
+ {
+ var chartDataCollection = new ChartDataCollection(new List(), "test data");
+
+ // Call
+ view.Data = chartDataCollection;
+
+ // Assert
+ Assert.AreSame(chartDataCollection, view.Data);
+ }
+ }
+
+ [Test]
+ public void Data_ForNull_NullSet()
+ {
+ // Setup
+ using (var view = new ChartLegendView())
+ {
+ // Call
+ view.Data = null;
+
+ // Assert
+ Assert.IsNull(view.Data);
+ }
+ }
+
+ [Test]
+ public void Data_OtherObject_ThrowsInvalidCastException()
+ {
+ // Setup
+ using (var view = new ChartLegendView())
+ {
+ // Call
+ TestDelegate test = () => view.Data = new object();
+
+ // Assert
+ Assert.Throws(test);
+ }
+ }
+
+ [Test]
+ public void Dispose_Always_DataSetToNull()
+ {
+ // Setup
+ var legendView = new ChartLegendView
+ {
+ Data = new ChartDataCollection(new List(), "test data")
+ };
+
+ var treeViewControl = TypeUtils.GetField(legendView, "treeViewControl");
+
+ // Call
+ legendView.Dispose();
+
+ // Assert
+ Assert.IsNull(legendView.Data);
+ Assert.IsNull(treeViewControl.Data);
+ Assert.IsTrue(treeViewControl.IsDisposed);
+ }
+ }
+}
\ No newline at end of file
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartLineDataTreeNodeInfoTest.cs
===================================================================
diff -u
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartLineDataTreeNodeInfoTest.cs (revision 0)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartLineDataTreeNodeInfoTest.cs (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -0,0 +1,190 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Core.Common.Base;
+using Core.Common.Controls.TreeView;
+using Core.Common.TestUtil;
+using Core.Common.Utils.Reflection;
+using Core.Components.Charting.Data;
+using Core.Plugins.OxyPlot.Legend;
+using Core.Plugins.OxyPlot.Properties;
+using NUnit.Framework;
+using Rhino.Mocks;
+
+namespace Core.Plugins.OxyPlot.Test.Legend
+{
+ [TestFixture]
+ public class ChartLineDataTreeNodeInfoTest
+ {
+ private MockRepository mocks;
+ private ChartLegendView chartLegendView;
+ private TreeNodeInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ chartLegendView = new ChartLegendView();
+
+ var treeViewControl = TypeUtils.GetField(chartLegendView, "treeViewControl");
+ var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup");
+
+ info = treeNodeInfoLookup[typeof(ChartLineData)];
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ chartLegendView.Dispose();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(ChartLineData), info.TagType);
+ Assert.IsNull(info.ForeColor);
+ Assert.IsNull(info.ContextMenuStrip);
+ Assert.IsNull(info.EnsureVisibleOnCreate);
+ Assert.IsNull(info.ChildNodeObjects);
+ Assert.IsNull(info.CanRename);
+ Assert.IsNull(info.OnNodeRenamed);
+ Assert.IsNull(info.CanRemove);
+ Assert.IsNull(info.OnNodeRemoved);
+ Assert.IsNull(info.CanDrop);
+ Assert.IsNull(info.CanInsert);
+ Assert.IsNull(info.OnDrop);
+ }
+
+ [Test]
+ public void Text_Always_ReturnsNameFromChartData()
+ {
+ // Setup
+ var lineData = mocks.StrictMock(Enumerable.Empty>(), "test data");
+
+ mocks.ReplayAll();
+
+ // Call
+ var text = info.Text(lineData);
+
+ // Assert
+ Assert.AreEqual(lineData.Name, text);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Image_Always_ReturnsSetImage()
+ {
+ // Setup
+ var lineData = mocks.StrictMock(Enumerable.Empty>(), "test data");
+
+ mocks.ReplayAll();
+
+ // Call
+ var image = info.Image(lineData);
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(Resources.LineIcon, image);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CanDrag_Always_ReturnsTrue()
+ {
+ // Setup
+ var lineData = mocks.StrictMock(Enumerable.Empty>(), "test data");
+
+ mocks.ReplayAll();
+
+ // Call
+ var canDrag = info.CanDrag(lineData, null);
+
+ // Assert
+ Assert.IsTrue(canDrag);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CanCheck_Always_ReturnsTrue()
+ {
+ // Setup
+ var lineData = mocks.StrictMock(Enumerable.Empty>(), "test data");
+
+ mocks.ReplayAll();
+
+ // Call
+ var canCheck = info.CanCheck(lineData);
+
+ // Assert
+ Assert.IsTrue(canCheck);
+
+ mocks.VerifyAll();
+ }
+
+ [TestCase(true)]
+ [TestCase(false)]
+ public void IsChecked_Always_ReturnsAccordingToVisibleStateOfLineData(bool isVisible)
+ {
+ // Setup
+ var lineData = mocks.StrictMock(Enumerable.Empty>(), "test data");
+
+ lineData.IsVisible = isVisible;
+
+ mocks.ReplayAll();
+
+ // Call
+ var canCheck = info.IsChecked(lineData);
+
+ // Assert
+ Assert.AreEqual(isVisible, canCheck);
+
+ mocks.VerifyAll();
+ }
+
+ [TestCase(true)]
+ [TestCase(false)]
+ public void LineDataNodeWithoutParent_SetsLineDataVisibility(bool initialVisibleState)
+ {
+ // Setup
+ var lineData = mocks.StrictMock(Enumerable.Empty>(), "test data");
+
+ mocks.ReplayAll();
+
+ lineData.IsVisible = initialVisibleState;
+
+ // Call
+ info.OnNodeChecked(lineData, null);
+
+ // Assert
+ Assert.AreEqual(!initialVisibleState, lineData.IsVisible);
+
+ mocks.VerifyAll();
+ }
+
+ [TestCase(true)]
+ [TestCase(false)]
+ public void OnNodeChecked_LineDataNodeWithObservableParent_SetsLineDataVisibilityAndNotifiesParentObservers(bool initialVisibleState)
+ {
+ // Setup
+ var observable = mocks.StrictMock();
+ var lineData = mocks.StrictMock(Enumerable.Empty>(), "test data");
+
+ observable.Expect(o => o.NotifyObservers());
+
+ mocks.ReplayAll();
+
+ lineData.IsVisible = initialVisibleState;
+
+ // Call
+ info.OnNodeChecked(lineData, observable);
+
+ // Assert
+ Assert.AreEqual(!initialVisibleState, lineData.IsVisible);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartPointDataTreeNodeInfoTest.cs
===================================================================
diff -u
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartPointDataTreeNodeInfoTest.cs (revision 0)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartPointDataTreeNodeInfoTest.cs (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -0,0 +1,190 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Core.Common.Base;
+using Core.Common.Controls.TreeView;
+using Core.Common.TestUtil;
+using Core.Common.Utils.Reflection;
+using Core.Components.Charting.Data;
+using Core.Plugins.OxyPlot.Legend;
+using Core.Plugins.OxyPlot.Properties;
+using NUnit.Framework;
+using Rhino.Mocks;
+
+namespace Core.Plugins.OxyPlot.Test.Legend
+{
+ [TestFixture]
+ public class ChartPointDataTreeNodeInfoTest
+ {
+ private MockRepository mocks;
+ private ChartLegendView chartLegendView;
+ private TreeNodeInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ chartLegendView = new ChartLegendView();
+
+ var treeViewControl = TypeUtils.GetField(chartLegendView, "treeViewControl");
+ var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup");
+
+ info = treeNodeInfoLookup[typeof(ChartPointData)];
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ chartLegendView.Dispose();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(ChartPointData), info.TagType);
+ Assert.IsNull(info.ForeColor);
+ Assert.IsNull(info.ContextMenuStrip);
+ Assert.IsNull(info.EnsureVisibleOnCreate);
+ Assert.IsNull(info.ChildNodeObjects);
+ Assert.IsNull(info.CanRename);
+ Assert.IsNull(info.OnNodeRenamed);
+ Assert.IsNull(info.CanRemove);
+ Assert.IsNull(info.OnNodeRemoved);
+ Assert.IsNull(info.CanDrop);
+ Assert.IsNull(info.CanInsert);
+ Assert.IsNull(info.OnDrop);
+ }
+
+ [Test]
+ public void Text_Always_ReturnsNameFromChartData()
+ {
+ // Setup
+ var pointData = mocks.StrictMock(Enumerable.Empty>(), "test data");
+
+ mocks.ReplayAll();
+
+ // Call
+ var text = info.Text(pointData);
+
+ // Assert
+ Assert.AreEqual(pointData.Name, text);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Image_Always_ReturnsSetImage()
+ {
+ // Setup
+ var pointData = mocks.StrictMock(Enumerable.Empty>(), "test data");
+
+ mocks.ReplayAll();
+
+ // Call
+ var image = info.Image(pointData);
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(Resources.PointsIcon, image);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CanDrag_Always_ReturnsTrue()
+ {
+ // Setup
+ var pointData = mocks.StrictMock(Enumerable.Empty>(), "test data");
+
+ mocks.ReplayAll();
+
+ // Call
+ var canDrag = info.CanDrag(pointData, null);
+
+ // Assert
+ Assert.IsTrue(canDrag);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CanCheck_Always_ReturnsTrue()
+ {
+ // Setup
+ var pointData = mocks.StrictMock(Enumerable.Empty>(), "test data");
+
+ mocks.ReplayAll();
+
+ // Call
+ var canCheck = info.CanCheck(pointData);
+
+ // Assert
+ Assert.IsTrue(canCheck);
+
+ mocks.VerifyAll();
+ }
+
+ [TestCase(true)]
+ [TestCase(false)]
+ public void IsChecked_Always_ReturnsAccordingToVisibleStateOfPointsData(bool isVisible)
+ {
+ // Setup
+ var pointData = mocks.StrictMock(Enumerable.Empty>(), "test data");
+
+ pointData.IsVisible = isVisible;
+
+ mocks.ReplayAll();
+
+ // Call
+ var canCheck = info.IsChecked(pointData);
+
+ // Assert
+ Assert.AreEqual(isVisible, canCheck);
+
+ mocks.VerifyAll();
+ }
+
+ [TestCase(true)]
+ [TestCase(false)]
+ public void PointDataNodeWithoutParent_SetsPointDataVisibility(bool initialVisibleState)
+ {
+ // Setup
+ var pointData = mocks.StrictMock(Enumerable.Empty>(), "test data");
+
+ mocks.ReplayAll();
+
+ pointData.IsVisible = initialVisibleState;
+
+ // Call
+ info.OnNodeChecked(pointData, null);
+
+ // Assert
+ Assert.AreEqual(!initialVisibleState, pointData.IsVisible);
+
+ mocks.VerifyAll();
+ }
+
+ [TestCase(true)]
+ [TestCase(false)]
+ public void OnNodeChecked_PointDataNodeWithObservableParent_SetsPointDataVisibilityAndNotifiesParentObservers(bool initialVisibleState)
+ {
+ // Setup
+ var observable = mocks.StrictMock();
+ var pointData = mocks.StrictMock(Enumerable.Empty>(), "test data");
+
+ observable.Expect(o => o.NotifyObservers());
+
+ mocks.ReplayAll();
+
+ pointData.IsVisible = initialVisibleState;
+
+ // Call
+ info.OnNodeChecked(pointData, observable);
+
+ // Assert
+ Assert.AreEqual(!initialVisibleState, pointData.IsVisible);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 170ec8698dfed095e23f4fa822fe2198b3e5f242 refers to a dead (removed) revision in file `Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/LegendControllerTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 170ec8698dfed095e23f4fa822fe2198b3e5f242 refers to a dead (removed) revision in file `Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/LegendViewTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 170ec8698dfed095e23f4fa822fe2198b3e5f242 refers to a dead (removed) revision in file `Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/LineDataTreeNodeInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 170ec8698dfed095e23f4fa822fe2198b3e5f242 refers to a dead (removed) revision in file `Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/PointDataTreeNodeInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/OxyPlotGuiPluginTest.cs
===================================================================
diff -u -r8aa11a9aa48733a5b5b72c58c71674472825b26c -r170ec8698dfed095e23f4fa822fe2198b3e5f242
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/OxyPlotGuiPluginTest.cs (.../OxyPlotGuiPluginTest.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/OxyPlotGuiPluginTest.cs (.../OxyPlotGuiPluginTest.cs) (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242)
@@ -77,9 +77,9 @@
{
var gui = mocks.StrictMock();
- gui.Stub(g => g.IsToolWindowOpen()).Return(false);
+ gui.Stub(g => g.IsToolWindowOpen()).Return(false);
- gui.Expect(g => g.OpenToolView(Arg.Matches(c => true)));
+ gui.Expect(g => g.OpenToolView(Arg.Matches(c => true)));
gui.Expect(g => g.ActiveViewChanged += null).IgnoreArguments();
gui.Expect(g => g.ActiveViewChanged -= null).IgnoreArguments();
gui.Expect(g => g.ActiveView).Return(view);