From fabe34fb2d168e54bddf7cfc23362de2f425dce9 Mon Sep 17 00:00:00 2001 From: BDisp Date: Tue, 19 Nov 2024 21:56:41 +0000 Subject: [PATCH] Fixes #3836. SetupFakeDriver sometimes causes failure in the unit test. --- UnitTests/TestHelpers.cs | 5 +++++ UnitTests/View/Adornment/PaddingTests.cs | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/UnitTests/TestHelpers.cs b/UnitTests/TestHelpers.cs index 1b841ee65..b8d3bb98d 100644 --- a/UnitTests/TestHelpers.cs +++ b/UnitTests/TestHelpers.cs @@ -197,6 +197,11 @@ public class SetupFakeDriverAttribute : BeforeAfterTestAttribute // Turn off diagnostic flags in case some test left them on View.Diagnostics = ViewDiagnosticFlags.Off; + if (Application.Driver is { }) + { + ((FakeDriver)Application.Driver).End (); + } + Application.Driver = null; base.After (methodUnderTest); } diff --git a/UnitTests/View/Adornment/PaddingTests.cs b/UnitTests/View/Adornment/PaddingTests.cs index a4defc997..0242bcc1d 100644 --- a/UnitTests/View/Adornment/PaddingTests.cs +++ b/UnitTests/View/Adornment/PaddingTests.cs @@ -33,7 +33,5 @@ PPP", output ); TestHelpers.AssertDriverAttributesAre ("0", output, null, view.GetNormalColor ()); - - ((FakeDriver)Application.Driver!).End (); } }