Przeglądaj źródła

Moved Overlapped stuff to ApplicationOverlap static class. Fixed nullable warnings.

Tig 1 rok temu
rodzic
commit
cb3e80666f

+ 2 - 4
Terminal.Gui/Application/Application.Overlapped.cs

@@ -106,10 +106,8 @@ public static class ApplicationOverlapped
     /// <returns></returns>
     /// <returns></returns>
     public static bool MoveToOverlappedChild (Toplevel? top)
     public static bool MoveToOverlappedChild (Toplevel? top)
     {
     {
-        if (top is null)
-        {
-            return false;
-        }
+        ArgumentNullException.ThrowIfNull (top);
+
         if (top.Visible && OverlappedTop is { } && Application.Current?.Modal == false)
         if (top.Visible && OverlappedTop is { } && Application.Current?.Modal == false)
         {
         {
             lock (Application.TopLevels)
             lock (Application.TopLevels)

+ 1 - 1
UnitTests/Views/OverlappedTests.cs

@@ -527,7 +527,7 @@ public class OverlappedTests
     [Fact]
     [Fact]
     public void MoveToOverlappedChild_Throw_NullReferenceException_Passing_Null_Parameter ()
     public void MoveToOverlappedChild_Throw_NullReferenceException_Passing_Null_Parameter ()
     {
     {
-        Assert.Throws<NullReferenceException> (delegate { ApplicationOverlapped.MoveToOverlappedChild (null); });
+        Assert.Throws<ArgumentNullException> (delegate { ApplicationOverlapped.MoveToOverlappedChild (null); });
     }
     }
 
 
     [Fact]
     [Fact]