Browse Source

Default orientation is Horiz

Tig 1 year ago
parent
commit
2097a17213

+ 1 - 1
Terminal.Gui/View/Orientation/OrientationHelper.cs

@@ -46,7 +46,7 @@
 /// </example>
 public class OrientationHelper
 {
-    private Orientation _orientation = Orientation.Vertical;
+    private Orientation _orientation;
     private readonly IOrientation _owner;
 
     /// <summary>

+ 1 - 0
Terminal.Gui/Views/RadioGroup.cs

@@ -108,6 +108,7 @@ public class RadioGroup : View, IDesignable, IOrientation
                     });
 
         _orientationHelper = new (this);
+        _orientationHelper.Orientation = Orientation.Vertical;
         _orientationHelper.OrientationChanging += (sender, e) => OrientationChanging?.Invoke (this, e);
         _orientationHelper.OrientationChanged += (sender, e) => OrientationChanged?.Invoke (this, e);
 

+ 9 - 9
UnitTests/View/Orientation/OrientationHelperTests.cs

@@ -17,7 +17,7 @@ public class OrientationHelperTests
         orientationHelper.OrientationChanged += (sender, e) => { changedEventInvoked = true; };
 
         // Act
-        orientationHelper.Orientation = Orientation.Horizontal;
+        orientationHelper.Orientation = Orientation.Vertical;
 
         // Assert
         Assert.True (changingEventInvoked, "OrientationChanging event was not invoked.");
@@ -42,7 +42,7 @@ public class OrientationHelperTests
         var orientationHelper = new OrientationHelper (mockIOrientation.Object);
 
         // Act
-        orientationHelper.Orientation = Orientation.Horizontal;
+        orientationHelper.Orientation = Orientation.Vertical;
 
         // Assert
         Assert.True (onChangingOverrideCalled, "OnOrientationChanging override was not called.");
@@ -55,7 +55,7 @@ public class OrientationHelperTests
         // Arrange
         Mock<IOrientation> mockIOrientation = new Mock<IOrientation> ();
         var orientationHelper = new OrientationHelper (mockIOrientation.Object);
-        orientationHelper.Orientation = Orientation.Vertical; // Set initial orientation
+        orientationHelper.Orientation = Orientation.Horizontal; // Set initial orientation
         var changingEventInvoked = false;
         var changedEventInvoked = false;
 
@@ -63,7 +63,7 @@ public class OrientationHelperTests
         orientationHelper.OrientationChanged += (sender, e) => { changedEventInvoked = true; };
 
         // Act
-        orientationHelper.Orientation = Orientation.Vertical; // Set to the same value
+        orientationHelper.Orientation = Orientation.Horizontal; // Set to the same value
 
         // Assert
         Assert.False (changingEventInvoked, "OrientationChanging event was invoked.");
@@ -79,10 +79,10 @@ public class OrientationHelperTests
         orientationHelper.OrientationChanging += (sender, e) => { e.Cancel = true; }; // Cancel the change
 
         // Act
-        orientationHelper.Orientation = Orientation.Horizontal;
+        orientationHelper.Orientation = Orientation.Vertical;
 
         // Assert
-        Assert.Equal (Orientation.Vertical, orientationHelper.Orientation); // Initial orientation is Vertical
+        Assert.Equal (Orientation.Horizontal, orientationHelper.Orientation); // Initial orientation is Horizontal
     }
 
     [Fact]
@@ -97,11 +97,11 @@ public class OrientationHelperTests
         var orientationHelper = new OrientationHelper (mockIOrientation.Object);
 
         // Act
-        orientationHelper.Orientation = Orientation.Horizontal;
+        orientationHelper.Orientation = Orientation.Vertical;
 
         // Assert
         Assert.Equal (
-                      Orientation.Vertical,
-                      orientationHelper.Orientation); // Initial orientation is Vertical, and it should remain unchanged due to cancellation
+                      Orientation.Horizontal,
+                      orientationHelper.Orientation); // Initial orientation is Horizontal, and it should remain unchanged due to cancellation
     }
 }