From e21f1580770d9ac3bb5837305d3a8a6531c066ca Mon Sep 17 00:00:00 2001 From: Tig Date: Fri, 23 Aug 2024 09:22:00 -0600 Subject: [PATCH] Fixes #3689. Release builds broken (#3690) * Initial commit * added #if DEBUG_IDISPOSABLE * Tweaked yml --- .github/workflows/dotnet-core.yml | 22 ++++++++++++++++++++-- UnitTests/Views/ColorPickerTests.cs | 5 ++++- UnitTests/Views/ToplevelTests.cs | 7 ++++--- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dotnet-core.yml b/.github/workflows/dotnet-core.yml index 5c30cd7cb..5779ed9da 100644 --- a/.github/workflows/dotnet-core.yml +++ b/.github/workflows/dotnet-core.yml @@ -11,7 +11,7 @@ on: - '**.md' jobs: - build_and_test: + build_and_test_debug: runs-on: ${{ matrix.os }} strategy: @@ -23,7 +23,7 @@ jobs: timeout-minutes: 10 steps: -# Build +# Build (Debug) - name: Checkout code uses: actions/checkout@v4 @@ -76,6 +76,24 @@ jobs: logs/ UnitTests/TestResults/ + + build_release: + # Ensure that RELEASE builds are not broken + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x + dotnet-quality: 'ga' + + - name: Build Release + run: dotnet build --configuration Release + + # Note: this step is currently not writing to the gist for some reason # - name: Create Test Coverage Badge # uses: simon-k/dotnet-code-coverage-badge@v1.0.0 diff --git a/UnitTests/Views/ColorPickerTests.cs b/UnitTests/Views/ColorPickerTests.cs index af0d2099a..e22cb3019 100644 --- a/UnitTests/Views/ColorPickerTests.cs +++ b/UnitTests/Views/ColorPickerTests.cs @@ -620,8 +620,9 @@ public class ColorPickerTests var hex = GetTextField (cp, ColorPickerPart.Hex); +#if DEBUG_IDISPOSABLE Assert.All (new View [] { b1, b2, b3, tf1, tf2, tf3,hex }, b => Assert.False (b.WasDisposed)); - +#endif cp.Style.ColorModel = ColorModel.RGB; cp.ApplyStyleChanges (); @@ -636,7 +637,9 @@ public class ColorPickerTests var hexAfter = GetTextField (cp, ColorPickerPart.Hex); // Old bars should be disposed +#if DEBUG_IDISPOSABLE Assert.All (new View [] { b1, b2, b3, tf1, tf2, tf3,hex }, b => Assert.True (b.WasDisposed)); +#endif Assert.NotSame (hex,hexAfter); Assert.NotSame (b1,b1After); diff --git a/UnitTests/Views/ToplevelTests.cs b/UnitTests/Views/ToplevelTests.cs index 047399abd..8b855799f 100644 --- a/UnitTests/Views/ToplevelTests.cs +++ b/UnitTests/Views/ToplevelTests.cs @@ -258,7 +258,7 @@ public partial class ToplevelTests (ITestOutputHelper output) top.Remove (top.StatusBar); Assert.Null (top.StatusBar); Assert.NotNull (statusBar); -#if true +#if DEBUG_IDISPOSABLE Assert.False (menuBar.WasDisposed); Assert.False (statusBar.WasDisposed); menuBar.Dispose (); @@ -407,7 +407,8 @@ public partial class ToplevelTests (ITestOutputHelper output) win.NewMouseEvent (new () { Position = new (6, 0), Flags = MouseFlags.Button1Pressed }); //Assert.Null (Toplevel._dragPosition); -#if true +#if DEBUG_IDISPOSABLE + Assert.False (top.MenuBar.WasDisposed); Assert.False (top.StatusBar.WasDisposed); #endif @@ -418,7 +419,7 @@ public partial class ToplevelTests (ITestOutputHelper output) Assert.Null (top.StatusBar); Assert.NotNull (menuBar); Assert.NotNull (statusBar); -#if true +#if DEBUG_IDISPOSABLE Assert.True (menuBar.WasDisposed); Assert.True (statusBar.WasDisposed); #endif