Forráskód Böngészése

Merge branch 'v2_develop' into gradients

Tig 1 éve
szülő
commit
ddaec2e689

+ 2 - 2
.github/workflows/codeql-analysis.yml

@@ -4,7 +4,7 @@ name: "Code scanning"
 
 on:
   push:
-    branches: [main]
+    branches: [main, v2_release]
     paths-ignore:
       - '**/*.md'
       - '**/*.txt'
@@ -12,7 +12,7 @@ on:
       - docs
       - docfx
   pull_request:
-    branches: [main]
+    branches: [main, v2_release]
     paths-ignore:
       - '**/*.md'
       - '**/*.txt'

+ 24 - 16
.github/workflows/dotnet-core.yml

@@ -15,16 +15,18 @@ jobs:
 
     runs-on: ${{ matrix.os }}
     strategy:
-      # Turn on fail-fast once we have the tests running on all platforms
-      fail-fast: false
+      # Turn off fail-fast to let all runners run even if there are errors
+      fail-fast: true
       matrix:
-        os: [ windows-latest ]
-        #os: [ ubuntu-latest, windows-latest, macos-latest ]
+        os: [ ubuntu-latest, windows-latest, macos-latest ]
 
     timeout-minutes: 10
     steps:
-    
-    - uses: actions/checkout@v4
+
+# Build
+
+    - name: Checkout code
+      uses: actions/checkout@v4
 
     - name: Setup .NET Core
       uses: actions/setup-dotnet@v4
@@ -39,31 +41,37 @@ jobs:
     - name: Build Debug
       run: dotnet build --configuration Debug --no-restore
 
-    - name: Install sed on macOS and update xunit.runner.json
+# Test
+    # Note: The --blame and VSTEST_DUMP_PATH stuff is needed to diagnose the test runner crashing on ubuntu/mac
+    # See https://github.com/microsoft/vstest/issues/2952 for why the --blame stuff below is needed.
+    # Without it, the test runner crashes on ubuntu (but not Windows or mac)
+
+    - name: MacOS - Patch test runner settings to stop on fail
       if: runner.os == 'macOS'
       run: |
-          brew install gnu-sed
-          PATH="/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH"
-          sed -i 's/"stopOnFail": false/"stopOnFail": true/g' UnitTests/xunit.runner.json
+        brew install gnu-sed
+        gsed -i 's/"stopOnFail": false/"stopOnFail": true/g' UnitTests/xunit.runner.json
 
-    - name: Update xunit.runner.json (Windows/Ubuntu)
+    - name: Windows/Linux - Patch test runner settings to stop on fail
       if: runner.os != 'macOS'
       run: |
           sed -i 's/"stopOnFail": false/"stopOnFail": true/g' UnitTests/xunit.runner.json
 
-      # See https://github.com/microsoft/vstest/issues/2952 for why the --blame stuff below is needed.
-      # Without it, the test runner crashes on ubuntu (but not Windows or mac)
+    - name: Set VSTEST_DUMP_PATH
+      shell: bash
+      run: echo "{VSTEST_DUMP_PATH}={logs/${{ runner.os }}/}" >> $GITHUB_ENV
+
     - name: Test
       run: |
-        dotnet test --verbosity normal --collect:"XPlat Code Coverage" --settings UnitTests/coverlet.runsettings --diag:logs/logs.txt --blame --blame-crash --blame-hang --blame-hang-timeout 60s --blame-crash-collect-always 
+       dotnet test --verbosity normal --collect:"XPlat Code Coverage" --settings UnitTests/coverlet.runsettings --diag:logs/${{ runner.os }}/logs.txt --blame --blame-crash --blame-hang --blame-hang-timeout 60s --blame-crash-collect-always 
      
-        # mv -v UnitTests/TestResults/*/*.* UnitTests/TestResults/
+       # mv -v UnitTests/TestResults/*/*.* UnitTests/TestResults/
 
     - name: Upload Test Logs
       if: always()
       uses: actions/upload-artifact@v4
       with:
-        name: test-logs-for-blame-debugging
+        name: test-logs-${{ runner.os }}
         path: |
           logs/    
           UnitTests/TestResults/

+ 103 - 0
GitVersion.yml.orig

@@ -0,0 +1,103 @@
+mode: ContinuousDeployment
+tag-prefix: '[vV]'
+continuous-delivery-fallback-tag: dev
+branches:
+  develop:
+    mode: ContinuousDeployment
+    tag: dev
+    regex: develop
+    source-branches:
+    - main
+    pre-release-weight: 100
+
+  v2_develop:
+    mode: ContinuousDeployment
+    tag: dev
+    regex: ^v2_develop?[/-]
+<<<<<<< HEAD
+    #is-release-branch: true
+=======
+>>>>>>> v2_develop
+    tracks-release-branches: true
+    is-source-branch-for: ['v2_release']
+    source-branches: []
+
+  v2_release:
+    mode: ContinuousDeployment
+    tag: prealpha
+    regex: v2_release
+    is-release-branch: true
+    source-branches: ['v2_develop']
+
+  pull-request:
+    mode: ContinuousDeployment
+    tag: PullRequest.{BranchName}
+    increment: Inherit
+    tag-number-pattern: '[/-](?<number>\d+)'
+    regex: ^(pull|pull\-requests|pr)[/-]
+    source-branches:
+    - develop
+    - main
+    - release
+    - v2_develop
+    - v2_release
+    - feature
+    - support
+    - hotfix
+    pre-release-weight: 30000
+
+ignore:
+  sha: []
+
+
+# next-version: 2.0.0
+# mode: ContinuousDeployment
+# tag-prefix: '[vV]'
+# continuous-delivery-fallback-tag: 'pre'
+# branches:
+#   # v1_develop:
+#   #   mode: ContinuousDeployment
+#   #   tag: pre
+#   #   regex: ^v1_develop?[/-]
+#   #   is-release-branch: false
+#   #   source-branches:
+#   #   - v1
+#   # v1:
+#   #   tag: rc
+#   #   increment: Patch
+#   #   regex: ^v2?[/-]
+#   #   is-release-branch: false
+#   #   source-branches: []
+#   #   is-mainline: true
+
+#   v2_develop:
+#     mode: ContinuousDeployment
+#     tag: pre
+#     regex: ^v2_develop?[/-]
+#     is-release-branch: true
+#     tracks-release-branches: true
+#     is-source-branch-for: ['v2']
+#     source-branches: []
+#   v2:
+#     mode: ContinuousDeployment
+#     is-release-branch: false
+#     tag: alpha
+#     increment: Patch
+#     regex: ^v2?[/-]
+#     source-branches: ['v2_develop']
+
+#   # feature:
+#   #   tag: useBranchName
+#   #   regex: ^features?[/-]
+#   #   source-branches:
+#   #   - v1
+#   #   - v1_develop
+#   #   - v2
+#   #   - v2_develop
+ 
+#   pull-request:
+#     tag: PullRequest.{BranchName}
+#     increment: Inherit
+# ignore:
+#   sha: []
+# merge-message-formats: {}

+ 1 - 1
UnitTests/Application/SynchronizatonContextTests.cs

@@ -4,7 +4,7 @@ namespace Terminal.Gui.ApplicationTests;
 
 public class SyncrhonizationContextTests
 {
-    [Fact]
+    [Fact(Skip = "Causes ubuntu to crash in github action.")]
     public void SynchronizationContext_CreateCopy ()
     {
         Application.Init ();

+ 0 - 4
UnitTests/Input/KeyTests.cs

@@ -61,7 +61,6 @@ public class KeyTests
     [InlineData ((KeyCode)'英', '英')]
     [InlineData ((KeyCode)'{', '{')]
     [InlineData ((KeyCode)'\'', '\'')]
-    [InlineData ((KeyCode)'\r', '\r')]
     [InlineData ((KeyCode)'ó', 'ó')]
     [InlineData ((KeyCode)'ó' | KeyCode.ShiftMask, 'ó')]
     [InlineData ((KeyCode)'Ó', 'Ó')]
@@ -111,9 +110,6 @@ public class KeyTests
     [InlineData ('!', (KeyCode)'!')]
     [InlineData ('\r', KeyCode.Enter)]
     [InlineData ('\t', KeyCode.Tab)]
-#pragma warning disable xUnit1025 // InlineData should be unique within the Theory it belongs to
-    [InlineData ('\r', (KeyCode)13)]
-#pragma warning restore xUnit1025 // InlineData should be unique within the Theory it belongs to
     [InlineData ('\n', (KeyCode)10)]
     [InlineData ('ó', (KeyCode)'ó')]
     [InlineData ('Ó', (KeyCode)'Ó')]

+ 1 - 2
UnitTests/View/MouseTests.cs

@@ -1,5 +1,4 @@
-using Terminal.Gui.ViewsTests;
-using Xunit.Abstractions;
+using Xunit.Abstractions;
 
 namespace Terminal.Gui.ViewTests;
 

+ 1 - 1
UnitTests/View/NavigationTests.cs

@@ -1534,7 +1534,7 @@ public class NavigationTests (ITestOutputHelper output)
         r.Dispose ();
     }
 
-    [Fact]
+    [Fact (Skip="Causes crash on Ubuntu in Github Action. Bogus test anyway.")]
     public void WindowDispose_CanFocusProblem ()
     {
         // Arrange

+ 41 - 42
UnitTests/Views/ShortcutTests.cs

@@ -27,7 +27,7 @@ public class ShortcutTests
     [InlineData ("C", "H", KeyCode.Null, 6)]
     [InlineData ("", "H", KeyCode.K, 8)]
     [InlineData ("C", "H", KeyCode.K, 9)]
-    public void NaturalSize (string command, string help, Key key, int expectedWidth)
+    public void NaturalSize (string command, string help, KeyCode key, int expectedWidth)
     {
         var shortcut = new Shortcut
         {
@@ -115,7 +115,7 @@ public class ShortcutTests
     [Theory]
     [InlineData (KeyCode.Null, "")]
     [InlineData (KeyCode.F1, "F1")]
-    public void KeyView_Text_Tracks_Key (Key key, string expected)
+    public void KeyView_Text_Tracks_Key (KeyCode key, string expected)
     {
         var shortcut = new Shortcut
         {
@@ -316,6 +316,7 @@ public class ShortcutTests
     }
 
     [Theory]
+
     //  0123456789
     // " C  0  A "
     [InlineData (-1, 0)]
@@ -332,7 +333,8 @@ public class ShortcutTests
     [AutoInitShutdown]
     public void MouseClick_Fires_Accept (int x, int expectedAccept)
     {
-        Toplevel current = new Toplevel ();
+        var current = new Toplevel ();
+
         var shortcut = new Shortcut
         {
             Key = Key.A,
@@ -343,14 +345,15 @@ public class ShortcutTests
 
         Application.Begin (current);
 
-        int accepted = 0;
+        var accepted = 0;
         shortcut.Accept += (s, e) => accepted++;
 
-        Application.OnMouseEvent (new MouseEvent ()
-        {
-            Position = new Point (x, 0),
-            Flags = MouseFlags.Button1Clicked,
-        });
+        Application.OnMouseEvent (
+                                  new()
+                                  {
+                                      Position = new (x, 0),
+                                      Flags = MouseFlags.Button1Clicked
+                                  });
 
         Assert.Equal (expectedAccept, accepted);
 
@@ -358,6 +361,7 @@ public class ShortcutTests
     }
 
     [Theory]
+
     //  0123456789
     // " C  0  A "
     [InlineData (-1, 0, 0)]
@@ -374,37 +378,37 @@ public class ShortcutTests
     [AutoInitShutdown]
     public void MouseClick_Button_CommandView_Fires_Accept (int x, int expectedAccept, int expectedButtonAccept)
     {
-        Toplevel current = new Toplevel ();
+        var current = new Toplevel ();
+
         var shortcut = new Shortcut
         {
             Key = Key.A,
-            Text = "0",
+            Text = "0"
         };
-        shortcut.CommandView = new Button ()
+
+        shortcut.CommandView = new Button
         {
             Title = "C",
             NoDecorations = true,
-            NoPadding = true,
+            NoPadding = true
         };
-        int buttonAccepted = 0;
-        shortcut.CommandView.Accept += (s, e) =>
-                                       {
-                                           buttonAccepted++;
-                                       };
+        var buttonAccepted = 0;
+        shortcut.CommandView.Accept += (s, e) => { buttonAccepted++; };
         current.Add (shortcut);
 
         Application.Begin (current);
 
-        int accepted = 0;
+        var accepted = 0;
         shortcut.Accept += (s, e) => accepted++;
 
         //Assert.True (shortcut.HasFocus);
 
-        Application.OnMouseEvent (new MouseEvent ()
-        {
-            Position = new Point (x, 0),
-            Flags = MouseFlags.Button1Clicked,
-        });
+        Application.OnMouseEvent (
+                                  new()
+                                  {
+                                      Position = new (x, 0),
+                                      Flags = MouseFlags.Button1Clicked
+                                  });
 
         Assert.Equal (expectedAccept, accepted);
         Assert.Equal (expectedButtonAccept, buttonAccepted);
@@ -419,7 +423,6 @@ public class ShortcutTests
     [InlineData (true, KeyCode.Enter, 1)]
     [InlineData (true, KeyCode.Space, 0)]
     [InlineData (true, KeyCode.F1, 0)]
-
     [InlineData (false, KeyCode.A, 1)]
     [InlineData (false, KeyCode.C, 1)]
     [InlineData (false, KeyCode.C | KeyCode.AltMask, 1)]
@@ -429,7 +432,8 @@ public class ShortcutTests
     [AutoInitShutdown]
     public void KeyDown_Invokes_Accept (bool canFocus, KeyCode key, int expectedAccept)
     {
-        Toplevel current = new Toplevel ();
+        var current = new Toplevel ();
+
         var shortcut = new Shortcut
         {
             Key = Key.A,
@@ -442,7 +446,7 @@ public class ShortcutTests
         Application.Begin (current);
         Assert.Equal (canFocus, shortcut.HasFocus);
 
-        int accepted = 0;
+        var accepted = 0;
         shortcut.Accept += (s, e) => accepted++;
 
         Application.OnKeyDown (key);
@@ -450,10 +454,8 @@ public class ShortcutTests
         Assert.Equal (expectedAccept, accepted);
 
         current.Dispose ();
-
     }
 
-
     [Theory]
     [InlineData (KeyCode.A, 1)]
     [InlineData (KeyCode.C, 1)]
@@ -464,19 +466,20 @@ public class ShortcutTests
     [AutoInitShutdown]
     public void KeyDown_App_Scope_Invokes_Accept (KeyCode key, int expectedAccept)
     {
-        Toplevel current = new Toplevel ();
+        var current = new Toplevel ();
+
         var shortcut = new Shortcut
         {
             Key = Key.A,
             KeyBindingScope = KeyBindingScope.Application,
             Text = "0",
-            Title = "_C",
+            Title = "_C"
         };
         current.Add (shortcut);
 
         Application.Begin (current);
 
-        int accepted = 0;
+        var accepted = 0;
         shortcut.Accept += (s, e) => accepted++;
 
         Application.OnKeyDown (key);
@@ -486,7 +489,6 @@ public class ShortcutTests
         current.Dispose ();
     }
 
-
     [Theory]
     [InlineData (true, KeyCode.A, 1)]
     [InlineData (true, KeyCode.C, 1)]
@@ -494,7 +496,6 @@ public class ShortcutTests
     [InlineData (true, KeyCode.Enter, 1)]
     [InlineData (true, KeyCode.Space, 0)]
     [InlineData (true, KeyCode.F1, 0)]
-
     [InlineData (false, KeyCode.A, 1)]
     [InlineData (false, KeyCode.C, 1)]
     [InlineData (false, KeyCode.C | KeyCode.AltMask, 1)]
@@ -504,7 +505,8 @@ public class ShortcutTests
     [AutoInitShutdown]
     public void KeyDown_Invokes_Action (bool canFocus, KeyCode key, int expectedAction)
     {
-        Toplevel current = new Toplevel ();
+        var current = new Toplevel ();
+
         var shortcut = new Shortcut
         {
             Key = Key.A,
@@ -517,7 +519,7 @@ public class ShortcutTests
         Application.Begin (current);
         Assert.Equal (canFocus, shortcut.HasFocus);
 
-        int action = 0;
+        var action = 0;
         shortcut.Action += () => action++;
 
         Application.OnKeyDown (key);
@@ -525,7 +527,6 @@ public class ShortcutTests
         Assert.Equal (expectedAction, action);
 
         current.Dispose ();
-
     }
 
     [Theory]
@@ -535,7 +536,6 @@ public class ShortcutTests
     [InlineData (true, KeyCode.Enter, 1)]
     [InlineData (true, KeyCode.Space, 0)]
     [InlineData (true, KeyCode.F1, 0)]
-
     [InlineData (false, KeyCode.A, 1)]
     [InlineData (false, KeyCode.C, 1)]
     [InlineData (false, KeyCode.C | KeyCode.AltMask, 1)]
@@ -545,7 +545,8 @@ public class ShortcutTests
     [AutoInitShutdown]
     public void KeyDown_App_Scope_Invokes_Action (bool canFocus, KeyCode key, int expectedAction)
     {
-        Toplevel current = new Toplevel ();
+        var current = new Toplevel ();
+
         var shortcut = new Shortcut
         {
             Key = Key.A,
@@ -559,7 +560,7 @@ public class ShortcutTests
         Application.Begin (current);
         Assert.Equal (canFocus, shortcut.HasFocus);
 
-        int action = 0;
+        var action = 0;
         shortcut.Action += () => action++;
 
         Application.OnKeyDown (key);
@@ -567,7 +568,5 @@ public class ShortcutTests
         Assert.Equal (expectedAction, action);
 
         current.Dispose ();
-
     }
-
 }

+ 0 - 13
UnitTests/Views/StatusBarTests.cs

@@ -81,19 +81,6 @@ public class StatusBarTests (ITestOutputHelper output)
     //    top.Dispose ();
     //}
 
-    [Fact]
-    [AutoInitShutdown]
-    public void Redraw_Output ()
-    {
-    }
-
-    [Fact]
-    [AutoInitShutdown]
-    public void Redraw_Output_CTRLQ ()
-    {
-
-    }
-
     [Fact]
     [AutoInitShutdown]
     public void Run_Action_With_Key_And_Mouse ()