Index: Core/Components/test/Core.Components.DotSpatial.Forms.Test/MapControlTest.cs =================================================================== diff -u -r98b126b6d45b128483be32b5d76285ddfbe5655b -r0ee5f95cffed8079f7cf36e95e2909b425a133cd --- Core/Components/test/Core.Components.DotSpatial.Forms.Test/MapControlTest.cs (.../MapControlTest.cs) (revision 98b126b6d45b128483be32b5d76285ddfbe5655b) +++ Core/Components/test/Core.Components.DotSpatial.Forms.Test/MapControlTest.cs (.../MapControlTest.cs) (revision 0ee5f95cffed8079f7cf36e95e2909b425a133cd) @@ -73,9 +73,6 @@ Assert.IsInstanceOf(map); Assert.IsNull(map.Data); Assert.IsNull(map.BackgroundMapData); - Assert.IsTrue(map.IsPanningEnabled); - Assert.IsFalse(map.IsRectangleZoomingEnabled); - Assert.IsTrue(map.IsMouseCoordinatesVisible); } } @@ -2822,142 +2819,5 @@ } #endregion - - #region Toggle - - [Test] - [Apartment(ApartmentState.STA)] - public void ToggleRectangleZooming_Always_CorrectlySetsMapFunctions() - { - using (var form = new Form()) - { - // Setup - var mapControl = new MapControl(); - form.Controls.Add(mapControl); - form.Show(); - - var map = (Map) new ControlTester("Map").TheObject; - MapFunctionPan mapFunctionPan = map.MapFunctions.OfType().First(); - MapFunctionSelectionZoom mapFunctionSelectionZoom = map.MapFunctions.OfType().First(); - - // Call - mapControl.ToggleRectangleZooming(); - - // Assert - Assert.IsTrue(mapFunctionSelectionZoom.Enabled); - Assert.IsFalse(mapFunctionPan.Enabled); - Assert.AreEqual(FunctionMode.None, map.FunctionMode); - } - } - - [Test] - [Apartment(ApartmentState.STA)] - public void TogglePanning_Always_CorrectlySetsMapFunctions() - { - using (var form = new Form()) - { - // Setup - var mapControl = new MapControl(); - form.Controls.Add(mapControl); - form.Show(); - - mapControl.ToggleRectangleZooming(); - - var map = (Map) new ControlTester("Map").TheObject; - MapFunctionPan mapFunctionPan = map.MapFunctions.OfType().First(); - MapFunctionSelectionZoom mapFunctionSelectionZoom = map.MapFunctions.OfType().First(); - - // Call - mapControl.TogglePanning(); - - // Assert - Assert.IsTrue(mapFunctionPan.Enabled); - Assert.IsFalse(mapFunctionSelectionZoom.Enabled); - Assert.AreEqual(FunctionMode.Pan, map.FunctionMode); - } - } - - [Test] - [TestCase(true)] - [TestCase(false)] - public void ToggleRectangleZooming_Always_ChangesState(bool isRectangleZooming) - { - // Setup - using (var map = new MapControl()) - { - if (isRectangleZooming) - { - map.ToggleRectangleZooming(); - } - - // Precondition - Assert.AreEqual(isRectangleZooming, map.IsRectangleZoomingEnabled, - $"Precondition failed: IsRectangleZoomingEnabled is {map.IsRectangleZoomingEnabled}"); - Assert.AreEqual(!isRectangleZooming, map.IsPanningEnabled, - $"Precondition failed: IsPanningEnabled is {map.IsPanningEnabled}"); - - // Call - map.ToggleRectangleZooming(); - - // Assert - Assert.IsTrue(map.IsRectangleZoomingEnabled); - Assert.IsFalse(map.IsPanningEnabled); - } - } - - [Test] - [TestCase(true)] - [TestCase(false)] - public void TogglePanning_Always_ChangesState(bool isPanning) - { - // Setup - using (var map = new MapControl()) - { - if (!isPanning) - { - map.ToggleRectangleZooming(); - } - - // Precondition - Assert.AreEqual(isPanning, map.IsPanningEnabled, - $"Precondition failed: IsPanningEnabled is {map.IsPanningEnabled}"); - Assert.AreEqual(!isPanning, map.IsRectangleZoomingEnabled, - $"Precondition failed: IsRectangleZoomingEnabled is {map.IsRectangleZoomingEnabled}"); - - // Call - map.TogglePanning(); - - // Assert - Assert.IsTrue(map.IsPanningEnabled); - Assert.IsFalse(map.IsRectangleZoomingEnabled); - } - } - - [Test] - [TestCase(true)] - [TestCase(false)] - public void ToggleMouseCoordinatesVisibility_Always_ChangesState(bool isShowingCoordinates) - { - // Setup - using (var map = new MapControl()) - { - if (!isShowingCoordinates) - { - // Make sure the state is correct - map.ToggleMouseCoordinatesVisibility(); - - // Precondition - Assert.IsFalse(map.IsMouseCoordinatesVisible); - } - - // Call - map.ToggleMouseCoordinatesVisibility(); - - // Assert - Assert.AreNotEqual(isShowingCoordinates, map.IsMouseCoordinatesVisible); - } - } - - #endregion } } \ No newline at end of file