Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -rdd91bb7a97e4246970fcb455a884bde554e40426 -r7abe36a7f4949221955e0c974564f61c1350e81c
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision dd91bb7a97e4246970fcb455a884bde554e40426)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 7abe36a7f4949221955e0c974564f61c1350e81c)
@@ -287,7 +287,7 @@
}
///
- /// Looks up a localized string similar to Toetspeil.
+ /// Looks up a localized string similar to Toetspeilen.
///
public static string DesignWaterLevel_DisplayName {
get {
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx
===================================================================
diff -u -rdd91bb7a97e4246970fcb455a884bde554e40426 -r7abe36a7f4949221955e0c974564f61c1350e81c
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision dd91bb7a97e4246970fcb455a884bde554e40426)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 7abe36a7f4949221955e0c974564f61c1350e81c)
@@ -303,7 +303,7 @@
T&raject toevoegen...
- Toetspeil
+ Toetspeilen
Golfhoogtes
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs
===================================================================
diff -u -r1e096895772e9946fe12cd79003d895e094b5d4b -r7abe36a7f4949221955e0c974564f61c1350e81c
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 1e096895772e9946fe12cd79003d895e094b5d4b)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 7abe36a7f4949221955e0c974564f61c1350e81c)
@@ -440,23 +440,25 @@
yield return new TreeNodeInfo
{
- Text = designWaterLevel => RingtoetsFormsResources.DesignWaterLevel_DisplayName,
+ Text = designWaterLevel => RingtoetsFormsResources.DesignWaterLevel_DisplayName,
Image = designWaterLevel => RingtoetsCommonFormsResources.GenericInputOutputIcon,
CanRename = (context, o) => false,
- ForeColor = context => context.WrappedData.HydraulicBoundaryDatabase == null ?
- Color.FromKnownColor(KnownColor.GrayText) :
- Color.FromKnownColor(KnownColor.ControlText),
+ ForeColor = context => context.WrappedData.HydraulicBoundaryDatabase != null &&
+ context.WrappedData.HydraulicBoundaryDatabase.Locations.Any(l => !double.IsNaN(l.DesignWaterLevel)) ?
+ Color.FromKnownColor(KnownColor.ControlText) :
+ Color.FromKnownColor(KnownColor.GrayText),
ContextMenuStrip = DesignWaterLevelContextMenuStrip
};
-
+
yield return new TreeNodeInfo
{
Text = waveHeight => RingtoetsFormsResources.WaveHeightContext_DisplayName,
Image = waveHeight => RingtoetsCommonFormsResources.GenericInputOutputIcon,
CanRename = (context, o) => false,
- ForeColor = context => context.WrappedData.HydraulicBoundaryDatabase == null ?
- Color.FromKnownColor(KnownColor.GrayText) :
- Color.FromKnownColor(KnownColor.ControlText),
+ ForeColor = context => context.WrappedData.HydraulicBoundaryDatabase != null &&
+ context.WrappedData.HydraulicBoundaryDatabase.Locations.Any(l => !double.IsNaN(l.WaveHeight)) ?
+ Color.FromKnownColor(KnownColor.ControlText) :
+ Color.FromKnownColor(KnownColor.GrayText),
ContextMenuStrip = WaveHeightContextMenuStrip
};
@@ -1068,6 +1070,8 @@
.AddSeparator()
.AddExpandAllItem()
.AddCollapseAllItem()
+ .AddSeparator()
+ .AddPropertiesItem()
.Build();
}
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/DesignWaterLevelContextTreeNodeInfoTest.cs
===================================================================
diff -u -rdd91bb7a97e4246970fcb455a884bde554e40426 -r7abe36a7f4949221955e0c974564f61c1350e81c
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/DesignWaterLevelContextTreeNodeInfoTest.cs (.../DesignWaterLevelContextTreeNodeInfoTest.cs) (revision dd91bb7a97e4246970fcb455a884bde554e40426)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/DesignWaterLevelContextTreeNodeInfoTest.cs (.../DesignWaterLevelContextTreeNodeInfoTest.cs) (revision 7abe36a7f4949221955e0c974564f61c1350e81c)
@@ -22,6 +22,7 @@
using System;
using System.Drawing;
using System.Linq;
+using Core.Common.Base;
using Core.Common.Controls.TreeView;
using Core.Common.Gui;
using Core.Common.Gui.ContextMenu;
@@ -84,7 +85,7 @@
var text = info.Text(null);
// Assert
- Assert.AreEqual("Toetspeil", text);
+ Assert.AreEqual("Toetspeilen", text);
}
}
@@ -311,7 +312,7 @@
}
[Test]
- public void ForeColor_ContextHasHydraulicBoundaryDatabaseData_ReturnControlText()
+ public void ForeColor_ContextHasNoCalculations_ReturnDisabledColor()
{
// Setup
var assessmentSection = mocks.Stub();
@@ -328,6 +329,34 @@
Color color = info.ForeColor(designWaterLevelContext);
// Assert
+ Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color);
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void ForeColor_ContextHasCalculations_ReturnControlColor()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
+ var location = new HydraulicBoundaryLocation(123, "aName", 1.1, 2.2)
+ {
+ DesignWaterLevel = 1.0
+ };
+ assessmentSection.HydraulicBoundaryDatabase.Locations.Add(location);
+ mocks.ReplayAll();
+
+ var designWaterLevelContext = new DesignWaterLevelContext(assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ var info = GetInfo(plugin);
+
+ // Call
+ Color color = info.ForeColor(designWaterLevelContext);
+
+ // Assert
Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), color);
}
mocks.VerifyAll();
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs
===================================================================
diff -u -rf5af57abda671e4a646797b0e78e03ba1835c6d5 -r7abe36a7f4949221955e0c974564f61c1350e81c
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs (.../HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs) (revision f5af57abda671e4a646797b0e78e03ba1835c6d5)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs (.../HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs) (revision 7abe36a7f4949221955e0c974564f61c1350e81c)
@@ -158,6 +158,8 @@
menuBuilderMock.Expect(mb => mb.AddSeparator()).Return(menuBuilderMock);
menuBuilderMock.Expect(mb => mb.AddExpandAllItem()).Return(menuBuilderMock);
menuBuilderMock.Expect(mb => mb.AddCollapseAllItem()).Return(menuBuilderMock);
+ menuBuilderMock.Expect(mb => mb.AddSeparator()).Return(menuBuilderMock);
+ menuBuilderMock.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilderMock);
menuBuilderMock.Expect(mb => mb.Build()).Return(null);
guiMock.Stub(g => g.ProjectOpened += null).IgnoreArguments();
guiMock.Stub(g => g.ProjectOpened -= null).IgnoreArguments();
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveHeightContextTreeNodeInfoTest.cs
===================================================================
diff -u -r5cf6fd5b4bd57890b104182c35fff4180b9d7aba -r7abe36a7f4949221955e0c974564f61c1350e81c
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveHeightContextTreeNodeInfoTest.cs (.../WaveHeightContextTreeNodeInfoTest.cs) (revision 5cf6fd5b4bd57890b104182c35fff4180b9d7aba)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveHeightContextTreeNodeInfoTest.cs (.../WaveHeightContextTreeNodeInfoTest.cs) (revision 7abe36a7f4949221955e0c974564f61c1350e81c)
@@ -256,7 +256,7 @@
}
[Test]
- public void ForeColor_ContextHasHydraulicBoundaryDatabaseData_ReturnControlText()
+ public void ForeColor_ContextHasNoCalculations_ReturnDisabledColor()
{
// Setup
var assessmentSection = mockRepository.Stub();
@@ -273,12 +273,39 @@
Color color = info.ForeColor(waterLevelContext);
// Assert
- Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), color);
+ Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color);
}
mockRepository.VerifyAll();
}
+ [Test]
+ public void ForeColor_ContextHasCalculations_ReturnControlColor()
+ {
+ // Setup
+ var assessmentSection = mockRepository.Stub();
+ assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
+ var location = new HydraulicBoundaryLocation(123, "aName", 1.1, 2.2)
+ {
+ WaveHeight = 1.0
+ };
+ assessmentSection.HydraulicBoundaryDatabase.Locations.Add(location);
+ mockRepository.ReplayAll();
+ var waterLevelContext = new WaveHeightContext(assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ var info = GetInfo(plugin);
+
+ // Call
+ Color color = info.ForeColor(waterLevelContext);
+
+ // Assert
+ Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), color);
+ }
+ mockRepository.VerifyAll();
+ }
+
[Test]
public void GivenHydraulicBoundaryDatabaseWithNonExistingFilePath_WhenCalculatingAssessmentLevelFromContextMenu_ThenLogMessagesAddedPreviousOutputNotAffected()
{