Browse Source

Made TextFormatter.Draw require driver.

Tig 4 weeks ago
parent
commit
7e13393a07

+ 2 - 2
Examples/UICatalog/Scenarios/CombiningMarks.cs

@@ -58,9 +58,9 @@ public class CombiningMarks : Scenario
             top.Move (0, ++i);
             top.Move (0, ++i);
             top.AddStr ("From now on we are using TextFormatter");
             top.AddStr ("From now on we are using TextFormatter");
             TextFormatter tf = new () { Text = "[e\u0301\u0301\u0328]<- \"[e\\u0301\\u0301\\u0328]\" using TextFormatter." };
             TextFormatter tf = new () { Text = "[e\u0301\u0301\u0328]<- \"[e\\u0301\\u0301\\u0328]\" using TextFormatter." };
-            tf.Draw (new (0, ++i, tf.Text.Length, 1), top.GetAttributeForRole (VisualRole.Normal), top.GetAttributeForRole (VisualRole.Normal));
+            tf.Draw (driver: Application.Driver, screen: new (0, ++i, tf.Text.Length, 1), normalColor: top.GetAttributeForRole (VisualRole.Normal), hotColor: top.GetAttributeForRole (VisualRole.Normal));
             tf.Text = "[e\u0328\u0301]<- \"[e\\u0328\\u0301]\" using TextFormatter.";
             tf.Text = "[e\u0328\u0301]<- \"[e\\u0328\\u0301]\" using TextFormatter.";
-            tf.Draw (new (0, ++i, tf.Text.Length, 1), top.GetAttributeForRole (VisualRole.Normal), top.GetAttributeForRole (VisualRole.Normal));
+            tf.Draw (driver: Application.Driver, screen: new (0, ++i, tf.Text.Length, 1), normalColor: top.GetAttributeForRole (VisualRole.Normal), hotColor: top.GetAttributeForRole (VisualRole.Normal));
             i++;
             i++;
             top.Move (0, ++i);
             top.Move (0, ++i);
             top.AddStr ("From now on we are using Surrogate pairs with combining diacritics");
             top.AddStr ("From now on we are using Surrogate pairs with combining diacritics");

+ 3 - 4
Terminal.Gui/Drawing/Ruler.cs

@@ -20,11 +20,12 @@ internal class Ruler
     private string _vTemplate { get; } = "-123456789";
     private string _vTemplate { get; } = "-123456789";
 
 
     /// <summary>Draws the <see cref="Ruler"/>.</summary>
     /// <summary>Draws the <see cref="Ruler"/>.</summary>
+    /// <param name="driver">Optional Driver. If not provided, driver will be used.</param>
     /// <param name="location">The location to start drawing the ruler, in screen-relative coordinates.</param>
     /// <param name="location">The location to start drawing the ruler, in screen-relative coordinates.</param>
     /// <param name="start">The start value of the ruler.</param>
     /// <param name="start">The start value of the ruler.</param>
-    /// <param name="driver">Optional Driver. If not provided, driver will be used.</param>
-    public void Draw (Point location, int start = 0, IDriver? driver = null)
+    public void Draw (IDriver? driver, Point location, int start = 0)
     {
     {
+        ArgumentNullException.ThrowIfNull (driver);
         if (start < 0)
         if (start < 0)
         {
         {
             throw new ArgumentException ("start must be greater than or equal to 0");
             throw new ArgumentException ("start must be greater than or equal to 0");
@@ -35,8 +36,6 @@ internal class Ruler
             return;
             return;
         }
         }
 
 
-        driver ??= Application.Driver;
-
         if (Orientation == Orientation.Horizontal)
         if (Orientation == Orientation.Horizontal)
         {
         {
             string hrule =
             string hrule =

+ 7 - 5
Terminal.Gui/Drawing/Thickness.cs

@@ -91,6 +91,8 @@ public record struct Thickness
     /// <returns>The inner rectangle remaining to be drawn.</returns>
     /// <returns>The inner rectangle remaining to be drawn.</returns>
     public Rectangle Draw (IDriver? driver, Rectangle rect, ViewDiagnosticFlags diagnosticFlags = ViewDiagnosticFlags.Off, string? label = null)
     public Rectangle Draw (IDriver? driver, Rectangle rect, ViewDiagnosticFlags diagnosticFlags = ViewDiagnosticFlags.Off, string? label = null)
     {
     {
+        ArgumentNullException.ThrowIfNull (driver);
+
         if (rect.Size.Width < 1 || rect.Size.Height < 1)
         if (rect.Size.Width < 1 || rect.Size.Height < 1)
         {
         {
             return Rectangle.Empty;
             return Rectangle.Empty;
@@ -162,7 +164,7 @@ public record struct Thickness
 
 
             if (Top > 0)
             if (Top > 0)
             {
             {
-                hRuler.Draw (rect.Location, driver: driver);
+                hRuler.Draw (driver: driver, location: rect.Location);
             }
             }
 
 
             //Left
             //Left
@@ -170,19 +172,19 @@ public record struct Thickness
 
 
             if (Left > 0)
             if (Left > 0)
             {
             {
-                vRuler.Draw (rect.Location with { Y = rect.Y + 1 }, 1, driver);
+                vRuler.Draw (driver, rect.Location with { Y = rect.Y + 1 }, 1);
             }
             }
 
 
             // Bottom
             // Bottom
             if (Bottom > 0)
             if (Bottom > 0)
             {
             {
-                hRuler.Draw (rect.Location with { Y = rect.Y + rect.Height - 1 }, driver: driver);
+                hRuler.Draw (driver: driver, location: rect.Location with { Y = rect.Y + rect.Height - 1 });
             }
             }
 
 
             // Right
             // Right
             if (Right > 0)
             if (Right > 0)
             {
             {
-                vRuler.Draw (new (rect.X + rect.Width - 1, rect.Y + 1), 1, driver);
+                vRuler.Draw (driver, new (rect.X + rect.Width - 1, rect.Y + 1), 1);
             }
             }
         }
         }
 
 
@@ -202,7 +204,7 @@ public record struct Thickness
 
 
             if (driver?.CurrentAttribute is { })
             if (driver?.CurrentAttribute is { })
             {
             {
-                tf.Draw (rect, driver!.CurrentAttribute, driver!.CurrentAttribute, rect, driver);
+                tf.Draw (driver, rect, driver!.CurrentAttribute, driver!.CurrentAttribute, rect);
             }
             }
         }
         }
 
 

+ 5 - 3
Terminal.Gui/Text/TextFormatter.cs

@@ -51,20 +51,22 @@ public class TextFormatter
     ///     Causes the text to be formatted (references <see cref="GetLines"/>). Sets <see cref="NeedsFormat"/> to
     ///     Causes the text to be formatted (references <see cref="GetLines"/>). Sets <see cref="NeedsFormat"/> to
     ///     <c>false</c>.
     ///     <c>false</c>.
     /// </remarks>
     /// </remarks>
+    /// <param name="driver">The console driver currently used by the application.</param>
     /// <param name="screen">Specifies the screen-relative location and maximum size for drawing the text.</param>
     /// <param name="screen">Specifies the screen-relative location and maximum size for drawing the text.</param>
     /// <param name="normalColor">The color to use for all text except the hotkey</param>
     /// <param name="normalColor">The color to use for all text except the hotkey</param>
     /// <param name="hotColor">The color to use to draw the hotkey</param>
     /// <param name="hotColor">The color to use to draw the hotkey</param>
     /// <param name="maximum">Specifies the screen-relative location and maximum container size.</param>
     /// <param name="maximum">Specifies the screen-relative location and maximum container size.</param>
-    /// <param name="driver">The console driver currently used by the application.</param>
     /// <exception cref="ArgumentOutOfRangeException"></exception>
     /// <exception cref="ArgumentOutOfRangeException"></exception>
     public void Draw (
     public void Draw (
+        IDriver? driver,
         Rectangle screen,
         Rectangle screen,
         Attribute normalColor,
         Attribute normalColor,
         Attribute hotColor,
         Attribute hotColor,
-        Rectangle maximum = default,
-        IDriver? driver = null
+        Rectangle maximum = default
     )
     )
     {
     {
+        ArgumentNullException.ThrowIfNull (driver);
+
         // With this check, we protect against subclasses with overrides of Text (like Button)
         // With this check, we protect against subclasses with overrides of Text (like Button)
         if (string.IsNullOrEmpty (Text))
         if (string.IsNullOrEmpty (Text))
         {
         {

+ 1 - 1
Terminal.Gui/ViewBase/Adornment/Adornment.cs

@@ -88,7 +88,7 @@ public class Adornment : View, IDesignable
     protected override IApplication? GetApp () => Parent?.App;
     protected override IApplication? GetApp () => Parent?.App;
 
 
     /// <inheritdoc />
     /// <inheritdoc />
-    protected override IDriver? GetDriver () => Parent?.Driver;
+    protected override IDriver? GetDriver () => Parent?.Driver ?? base.GetDriver();
 
 
     // If a scheme is explicitly set, use that. Otherwise, use the scheme of the parent view.
     // If a scheme is explicitly set, use that. Otherwise, use the scheme of the parent view.
     private Scheme? _scheme;
     private Scheme? _scheme;

+ 6 - 14
Terminal.Gui/ViewBase/Adornment/Border.cs

@@ -322,11 +322,7 @@ public partial class Border : Adornment
         {
         {
             Rectangle titleRect = new (borderBounds.X + 2, titleY, maxTitleWidth, 1);
             Rectangle titleRect = new (borderBounds.X + 2, titleY, maxTitleWidth, 1);
 
 
-            Parent.TitleTextFormatter.Draw (
-                                            titleRect,
-                                            GetAttributeForRole (Parent.HasFocus ? VisualRole.Focus : VisualRole.Normal),
-                                            GetAttributeForRole (Parent.HasFocus ? VisualRole.HotFocus : VisualRole.HotNormal),
-                                            driver: Driver);
+            Parent.TitleTextFormatter.Draw (driver: Driver, screen: titleRect, normalColor: GetAttributeForRole (Parent.HasFocus ? VisualRole.Focus : VisualRole.Normal), hotColor: GetAttributeForRole (Parent.HasFocus ? VisualRole.HotFocus : VisualRole.HotNormal));
             Parent?.LineCanvas.Exclude (new (titleRect));
             Parent?.LineCanvas.Exclude (new (titleRect));
         }
         }
 
 
@@ -500,17 +496,13 @@ public partial class Border : Adornment
 
 
                 if (drawTop)
                 if (drawTop)
                 {
                 {
-                    hruler.Draw (new (screenBounds.X, screenBounds.Y), driver: Driver);
+                    hruler.Draw (driver: Driver, location: new (screenBounds.X, screenBounds.Y));
                 }
                 }
 
 
                 // Redraw title 
                 // Redraw title 
                 if (drawTop && maxTitleWidth > 0 && Settings.FastHasFlags (BorderSettings.Title))
                 if (drawTop && maxTitleWidth > 0 && Settings.FastHasFlags (BorderSettings.Title))
                 {
                 {
-                    Parent!.TitleTextFormatter.Draw (
-                                                     new (borderBounds.X + 2, titleY, maxTitleWidth, 1),
-                                                     Parent.HasFocus ? Parent.GetAttributeForRole (VisualRole.Focus) : Parent.GetAttributeForRole (VisualRole.Normal),
-                                                     Parent.HasFocus ? Parent.GetAttributeForRole (VisualRole.Focus) : Parent.GetAttributeForRole (VisualRole.Normal),
-                                                     driver: Driver);
+                    Parent!.TitleTextFormatter.Draw (driver: Driver, screen: new (borderBounds.X + 2, titleY, maxTitleWidth, 1), normalColor: Parent.HasFocus ? Parent.GetAttributeForRole (VisualRole.Focus) : Parent.GetAttributeForRole (VisualRole.Normal), hotColor: Parent.HasFocus ? Parent.GetAttributeForRole (VisualRole.Focus) : Parent.GetAttributeForRole (VisualRole.Normal));
                 }
                 }
 
 
                 //Left
                 //Left
@@ -518,19 +510,19 @@ public partial class Border : Adornment
 
 
                 if (drawLeft)
                 if (drawLeft)
                 {
                 {
-                    vruler.Draw (new (screenBounds.X, screenBounds.Y + 1), 1, driver: Driver);
+                    vruler.Draw (driver: Driver, location: new (screenBounds.X, screenBounds.Y + 1), start: 1);
                 }
                 }
 
 
                 // Bottom
                 // Bottom
                 if (drawBottom)
                 if (drawBottom)
                 {
                 {
-                    hruler.Draw (new (screenBounds.X, screenBounds.Y + screenBounds.Height - 1), driver: Driver);
+                    hruler.Draw (driver: Driver, location: new (screenBounds.X, screenBounds.Y + screenBounds.Height - 1));
                 }
                 }
 
 
                 // Right
                 // Right
                 if (drawRight)
                 if (drawRight)
                 {
                 {
-                    vruler.Draw (new (screenBounds.X + screenBounds.Width - 1, screenBounds.Y + 1), 1, driver: Driver);
+                    vruler.Draw (driver: Driver, location: new (screenBounds.X + screenBounds.Width - 1, screenBounds.Y + 1), start: 1);
                 }
                 }
             }
             }
 
 

+ 2 - 3
Terminal.Gui/ViewBase/View.Drawing.cs

@@ -446,12 +446,11 @@ public partial class View // Drawing APIs
         context?.AddDrawnRegion (textRegion);
         context?.AddDrawnRegion (textRegion);
 
 
         TextFormatter?.Draw (
         TextFormatter?.Draw (
+                             Driver,
                              drawRect,
                              drawRect,
                              HasFocus ? GetAttributeForRole (VisualRole.Focus) : GetAttributeForRole (VisualRole.Normal),
                              HasFocus ? GetAttributeForRole (VisualRole.Focus) : GetAttributeForRole (VisualRole.Normal),
                              HasFocus ? GetAttributeForRole (VisualRole.HotFocus) : GetAttributeForRole (VisualRole.HotNormal),
                              HasFocus ? GetAttributeForRole (VisualRole.HotFocus) : GetAttributeForRole (VisualRole.HotNormal),
-                             Rectangle.Empty,
-                             Driver
-                            );
+                             Rectangle.Empty);
 
 
         // We assume that the text has been drawn over the entire area; ensure that the subviews are redrawn.
         // We assume that the text has been drawn over the entire area; ensure that the subviews are redrawn.
         SetSubViewNeedsDraw ();
         SetSubViewNeedsDraw ();

+ 5 - 6
Terminal.Gui/Views/Menuv1/Menu.cs

@@ -967,12 +967,11 @@ internal sealed class Menu : View
 
 
                     // The -3 is left/right border + one space (not sure what for)
                     // The -3 is left/right border + one space (not sure what for)
                     tf.Draw (
                     tf.Draw (
-                             ViewportToScreen (new Rectangle (1, i, Frame.Width - 3, 1)),
-                             i == _currentChild ? GetAttributeForRole (VisualRole.Focus) : GetAttributeForRole (VisualRole.Normal),
-                             i == _currentChild ? GetAttributeForRole (VisualRole.HotFocus) : GetAttributeForRole (VisualRole.HotNormal),
-                             SuperView?.ViewportToScreen (SuperView.Viewport) ?? Rectangle.Empty,
-                             driver: Driver
-                            );
+                             driver: Driver,
+                             screen: ViewportToScreen (new Rectangle (1, i, Frame.Width - 3, 1)),
+                             normalColor: i == _currentChild ? GetAttributeForRole (VisualRole.Focus) : GetAttributeForRole (VisualRole.Normal),
+                             hotColor: i == _currentChild ? GetAttributeForRole (VisualRole.HotFocus) : GetAttributeForRole (VisualRole.HotNormal),
+                             maximum: SuperView?.ViewportToScreen (SuperView.Viewport) ?? Rectangle.Empty);
                 }
                 }
                 else
                 else
                 {
                 {

+ 5 - 6
Terminal.Gui/Views/ProgressBar.cs

@@ -186,12 +186,11 @@ public class ProgressBar : View, IDesignable
             }
             }
 
 
             tf.Draw (
             tf.Draw (
-                     ViewportToScreen (Viewport),
-                     attr,
-                     GetAttributeForRole (VisualRole.Normal),
-                     SuperView?.ViewportToScreen (SuperView.Viewport) ?? default (Rectangle),
-                     driver: Driver
-                    );
+                     driver: Driver,
+                     screen: ViewportToScreen (Viewport),
+                     normalColor: attr,
+                     hotColor: GetAttributeForRole (VisualRole.Normal),
+                     maximum: SuperView?.ViewportToScreen (SuperView.Viewport) ?? default (Rectangle));
         }
         }
 
 
         return true;
         return true;

+ 1 - 5
Terminal.Gui/Views/TextInput/TextField.cs

@@ -1731,11 +1731,7 @@ public class TextField : View, IDesignable
                                              GetAttributeForRole (VisualRole.Editable).Style | TextStyle.Underline);
                                              GetAttributeForRole (VisualRole.Editable).Style | TextStyle.Underline);
 
 
         // Use TitleTextFormatter to render the caption with hotkey support
         // Use TitleTextFormatter to render the caption with hotkey support
-        TitleTextFormatter.Draw (
-                                 ViewportToScreen (new Rectangle (0, 0, Viewport.Width, 1)),
-                                 captionAttribute,
-                                 hotKeyAttribute,
-                                 driver: Driver);
+        TitleTextFormatter.Draw (driver: Driver, screen: ViewportToScreen (new Rectangle (0, 0, Viewport.Width, 1)), normalColor: captionAttribute, hotColor: hotKeyAttribute);
     }
     }
 
 
     private void SetClipboard (IEnumerable<Rune> text)
     private void SetClipboard (IEnumerable<Rune> text)

+ 7 - 3
Tests/UnitTests/Views/GraphViewTests.cs

@@ -44,7 +44,7 @@ internal class FakeVAxis : VerticalAxis
 
 
 #endregion
 #endregion
 
 
-public class GraphViewTests
+public class GraphViewTests : FakeDriverBase
 {
 {
     /// <summary>
     /// <summary>
     ///     A cell size of 0 would result in mapping all graph space into the same cell of the console.  Since
     ///     A cell size of 0 would result in mapping all graph space into the same cell of the console.  Since
@@ -74,7 +74,10 @@ public class GraphViewTests
     /// <returns></returns>
     /// <returns></returns>
     public static GraphView GetGraph ()
     public static GraphView GetGraph ()
     {
     {
-        var gv = new GraphView ();
+        var gv = new GraphView ()
+        {
+            Driver = Application.Driver ?? CreateFakeDriver ()
+        };
         gv.BeginInit ();
         gv.BeginInit ();
         gv.EndInit ();
         gv.EndInit ();
 
 
@@ -677,12 +680,13 @@ public class MultiBarSeriesTests
     }
     }
 }
 }
 
 
-public class BarSeriesTests
+public class BarSeriesTests : FakeDriverBase
 {
 {
     [Fact]
     [Fact]
     public void TestOneLongOneShortHorizontalBars_WithOffset ()
     public void TestOneLongOneShortHorizontalBars_WithOffset ()
     {
     {
         GraphView graph = GetGraph (out FakeBarSeries barSeries, out FakeHAxis axisX, out FakeVAxis axisY);
         GraphView graph = GetGraph (out FakeBarSeries barSeries, out FakeHAxis axisX, out FakeVAxis axisY);
+        graph.Driver = CreateFakeDriver ();
         graph.Draw ();
         graph.Draw ();
 
 
         // no bars
         // no bars

+ 9 - 6
Tests/UnitTests/Views/LabelTests.cs

@@ -1,5 +1,4 @@
-using UnitTests;
-using Xunit.Abstractions;
+using Xunit.Abstractions;
 
 
 namespace UnitTests.ViewsTests;
 namespace UnitTests.ViewsTests;
 
 
@@ -112,9 +111,9 @@ public class LabelTests (ITestOutputHelper output)
 
 
         AutoInitShutdownAttribute.RunIteration ();
         AutoInitShutdownAttribute.RunIteration ();
 
 
-        tf1.Draw (new (new (0, 1), tfSize), label.GetAttributeForRole (VisualRole.Normal), label.GetAttributeForRole (VisualRole.HotNormal));
+        tf1.Draw (driver: Application.Driver, screen: new (new (0, 1), tfSize), normalColor: label.GetAttributeForRole (VisualRole.Normal), hotColor: label.GetAttributeForRole (VisualRole.HotNormal));
 
 
-        tf2.Draw (new (new (0, 2), tfSize), label.GetAttributeForRole (VisualRole.Normal), label.GetAttributeForRole (VisualRole.HotNormal));
+        tf2.Draw (driver: Application.Driver, screen: new (new (0, 2), tfSize), normalColor: label.GetAttributeForRole (VisualRole.Normal), hotColor: label.GetAttributeForRole (VisualRole.HotNormal));
 
 
         DriverAssert.AssertDriverContentsWithFrameAre (
         DriverAssert.AssertDriverContentsWithFrameAre (
                                                        @"
                                                        @"
@@ -135,10 +134,12 @@ This TextFormatter (tf2) with fill will be cleared on rewritten.       ",
         label.Draw ();
         label.Draw ();
 
 
         tf1.Text = "This TextFormatter (tf1) is rewritten.";
         tf1.Text = "This TextFormatter (tf1) is rewritten.";
-        tf1.Draw (new (new (0, 1), tfSize), label.GetAttributeForRole (VisualRole.Normal), label.GetAttributeForRole (VisualRole.HotNormal));
+
+        tf1.Draw (driver: Application.Driver, screen: new (new (0, 1), tfSize), normalColor: label.GetAttributeForRole (VisualRole.Normal), hotColor: label.GetAttributeForRole (VisualRole.HotNormal));
 
 
         tf2.Text = "This TextFormatter (tf2) is rewritten.";
         tf2.Text = "This TextFormatter (tf2) is rewritten.";
-        tf2.Draw (new (new (0, 2), tfSize), label.GetAttributeForRole (VisualRole.Normal), label.GetAttributeForRole (VisualRole.HotNormal));
+
+        tf2.Draw (driver: Application.Driver, screen: new (new (0, 2), tfSize), normalColor: label.GetAttributeForRole (VisualRole.Normal), hotColor: label.GetAttributeForRole (VisualRole.HotNormal));
 
 
         DriverAssert.AssertDriverContentsWithFrameAre (
         DriverAssert.AssertDriverContentsWithFrameAre (
                                                        @"
                                                        @"
@@ -703,6 +704,7 @@ e
         var label = new Label
         var label = new Label
         {
         {
             Text = "This should be the last line.",
             Text = "This should be the last line.",
+
             //Width = Dim.Fill (),
             //Width = Dim.Fill (),
             X = 0, // keep unit test focused; don't use Center here
             X = 0, // keep unit test focused; don't use Center here
             Y = Pos.AnchorEnd (1)
             Y = Pos.AnchorEnd (1)
@@ -749,6 +751,7 @@ e
         var label = new Label
         var label = new Label
         {
         {
             Text = "This should be the last line.",
             Text = "This should be the last line.",
+
             //Width = Dim.Fill (),
             //Width = Dim.Fill (),
             X = 0,
             X = 0,
             Y = Pos.Bottom (win)
             Y = Pos.Bottom (win)

+ 7 - 7
Tests/UnitTestsParallelizable/Drawing/RulerTests.cs

@@ -54,7 +54,7 @@ public class RulerTests (ITestOutputHelper output) : FakeDriverBase
         IDriver driver = CreateFakeDriver ();
         IDriver driver = CreateFakeDriver ();
 
 
         var r = new Ruler ();
         var r = new Ruler ();
-        r.Draw (Point.Empty, driver: driver);
+        r.Draw (driver: driver, location: Point.Empty);
         DriverAssert.AssertDriverContentsWithFrameAre (@"", output, driver);
         DriverAssert.AssertDriverContentsWithFrameAre (@"", output, driver);
     }
     }
 
 
@@ -69,7 +69,7 @@ public class RulerTests (ITestOutputHelper output) : FakeDriverBase
         Assert.Equal (Orientation.Horizontal, r.Orientation);
         Assert.Equal (Orientation.Horizontal, r.Orientation);
 
 
         r.Length = len;
         r.Length = len;
-        r.Draw (Point.Empty, driver: driver);
+        r.Draw (driver: driver, location: Point.Empty);
 
 
         DriverAssert.AssertDriverContentsWithFrameAre (
         DriverAssert.AssertDriverContentsWithFrameAre (
                                                        @"
                                                        @"
@@ -79,7 +79,7 @@ public class RulerTests (ITestOutputHelper output) : FakeDriverBase
                                                       );
                                                       );
 
 
         // Postive offset
         // Postive offset
-        r.Draw (new (1, 1), driver: driver);
+        r.Draw (driver: driver, location: new (1, 1));
 
 
         DriverAssert.AssertDriverContentsAre (
         DriverAssert.AssertDriverContentsAre (
                                               @"
                                               @"
@@ -91,7 +91,7 @@ public class RulerTests (ITestOutputHelper output) : FakeDriverBase
                                              );
                                              );
 
 
         // Negative offset
         // Negative offset
-        r.Draw (new (-1, 3), driver: driver);
+        r.Draw (driver: driver, location: new (-1, 3));
 
 
         DriverAssert.AssertDriverContentsAre (
         DriverAssert.AssertDriverContentsAre (
                                               @"
                                               @"
@@ -114,7 +114,7 @@ public class RulerTests (ITestOutputHelper output) : FakeDriverBase
         var r = new Ruler ();
         var r = new Ruler ();
         r.Orientation = Orientation.Vertical;
         r.Orientation = Orientation.Vertical;
         r.Length = len;
         r.Length = len;
-        r.Draw (Point.Empty, driver: driver);
+        r.Draw (driver: driver, location: Point.Empty);
 
 
         DriverAssert.AssertDriverContentsWithFrameAre (
         DriverAssert.AssertDriverContentsWithFrameAre (
                                                        @"
                                                        @"
@@ -137,7 +137,7 @@ public class RulerTests (ITestOutputHelper output) : FakeDriverBase
                                                        driver
                                                        driver
                                                       );
                                                       );
 
 
-        r.Draw (new (1, 1), driver: driver);
+        r.Draw (driver: driver, location: new (1, 1));
 
 
         DriverAssert.AssertDriverContentsWithFrameAre (
         DriverAssert.AssertDriverContentsWithFrameAre (
                                                        @"
                                                        @"
@@ -162,7 +162,7 @@ public class RulerTests (ITestOutputHelper output) : FakeDriverBase
                                                       );
                                                       );
 
 
         // Negative offset
         // Negative offset
-        r.Draw (new (2, -1), driver: driver);
+        r.Draw (driver: driver, location: new (2, -1));
 
 
         DriverAssert.AssertDriverContentsWithFrameAre (
         DriverAssert.AssertDriverContentsWithFrameAre (
                                                        @"
                                                        @"

+ 14 - 22
Tests/UnitTestsParallelizable/Text/TextFormatterDrawTests.cs

@@ -36,7 +36,7 @@ public class TextFormatterDrawTests (ITestOutputHelper output) : FakeDriverBase
 
 
         tf.ConstrainToWidth = width;
         tf.ConstrainToWidth = width;
         tf.ConstrainToHeight = height;
         tf.ConstrainToHeight = height;
-        tf.Draw (new (0, 0, width, height), Attribute.Default, Attribute.Default, driver: driver);
+        tf.Draw (driver: driver, screen: new (0, 0, width, height), normalColor: Attribute.Default, hotColor: Attribute.Default);
 
 
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
     }
     }
@@ -65,7 +65,7 @@ public class TextFormatterDrawTests (ITestOutputHelper output) : FakeDriverBase
 
 
         tf.ConstrainToWidth = width;
         tf.ConstrainToWidth = width;
         tf.ConstrainToHeight = height;
         tf.ConstrainToHeight = height;
-        tf.Draw (new (0, 0, width, height), Attribute.Default, Attribute.Default, driver: driver);
+        tf.Draw (driver: driver, screen: new (0, 0, width, height), normalColor: Attribute.Default, hotColor: Attribute.Default);
 
 
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
     }
     }
@@ -105,7 +105,7 @@ public class TextFormatterDrawTests (ITestOutputHelper output) : FakeDriverBase
         tf.ConstrainToWidth = width;
         tf.ConstrainToWidth = width;
         tf.ConstrainToHeight = height;
         tf.ConstrainToHeight = height;
 
 
-        tf.Draw (new (Point.Empty, new (width, height)), Attribute.Default, Attribute.Default, driver: driver);
+        tf.Draw (driver: driver, screen: new (Point.Empty, new (width, height)), normalColor: Attribute.Default, hotColor: Attribute.Default);
         Rectangle rect = DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
         Rectangle rect = DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
         Assert.Equal (expectedY, rect.Y);
         Assert.Equal (expectedY, rect.Y);
     }
     }
@@ -134,7 +134,7 @@ public class TextFormatterDrawTests (ITestOutputHelper output) : FakeDriverBase
 
 
         tf.ConstrainToWidth = width;
         tf.ConstrainToWidth = width;
         tf.ConstrainToHeight = height;
         tf.ConstrainToHeight = height;
-        tf.Draw (new (0, 0, width, height), Attribute.Default, Attribute.Default, driver: driver);
+        tf.Draw (driver: driver, screen: new (0, 0, width, height), normalColor: Attribute.Default, hotColor: Attribute.Default);
 
 
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
     }
     }
@@ -163,7 +163,7 @@ public class TextFormatterDrawTests (ITestOutputHelper output) : FakeDriverBase
 
 
         tf.ConstrainToWidth = width;
         tf.ConstrainToWidth = width;
         tf.ConstrainToHeight = height;
         tf.ConstrainToHeight = height;
-        tf.Draw (new (0, 0, width, height), Attribute.Default, Attribute.Default, driver: driver);
+        tf.Draw (driver: driver, screen: new (0, 0, width, height), normalColor: Attribute.Default, hotColor: Attribute.Default);
 
 
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
     }
     }
@@ -217,7 +217,7 @@ s")]
 
 
         tf.ConstrainToWidth = width;
         tf.ConstrainToWidth = width;
         tf.ConstrainToHeight = height;
         tf.ConstrainToHeight = height;
-        tf.Draw (new (0, 0, 20, 20), Attribute.Default, Attribute.Default, driver: driver);
+        tf.Draw (driver: driver, screen: new (0, 0, 20, 20), normalColor: Attribute.Default, hotColor: Attribute.Default);
 
 
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
     }
     }
@@ -267,7 +267,7 @@ s")]
 
 
         tf.ConstrainToWidth = width;
         tf.ConstrainToWidth = width;
         tf.ConstrainToHeight = height;
         tf.ConstrainToHeight = height;
-        tf.Draw (new (0, 0, 5, height), Attribute.Default, Attribute.Default, driver: driver);
+        tf.Draw (driver: driver, screen: new (0, 0, 5, height), normalColor: Attribute.Default, hotColor: Attribute.Default);
 
 
         Rectangle rect = DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
         Rectangle rect = DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
         Assert.Equal (expectedY, rect.Y);
         Assert.Equal (expectedY, rect.Y);
@@ -328,7 +328,7 @@ B  ")]
 
 
         tf.ConstrainToWidth = 5;
         tf.ConstrainToWidth = 5;
         tf.ConstrainToHeight = height;
         tf.ConstrainToHeight = height;
-        tf.Draw (new (0, 0, 5, height), Attribute.Default, Attribute.Default, driver: driver);
+        tf.Draw (driver: driver, screen: new (0, 0, 5, height), normalColor: Attribute.Default, hotColor: Attribute.Default);
 
 
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
     }
     }
@@ -346,11 +346,7 @@ B  ")]
         };
         };
         var tf = new TextFormatter { ConstrainToSize = new (14, 3), Text = "Test\nTest long\nTest long long\n", MultiLine = true };
         var tf = new TextFormatter { ConstrainToSize = new (14, 3), Text = "Test\nTest long\nTest long long\n", MultiLine = true };
 
 
-        tf.Draw (
-                 new (1, 1, 19, 3),
-                 attrs [1],
-                 attrs [2],
-                 driver: driver);
+        tf.Draw (driver: driver, screen: new (1, 1, 19, 3), normalColor: attrs [1], hotColor: attrs [2]);
 
 
         Assert.False (tf.FillRemaining);
         Assert.False (tf.FillRemaining);
 
 
@@ -375,11 +371,7 @@ B  ")]
 
 
         tf.FillRemaining = true;
         tf.FillRemaining = true;
 
 
-        tf.Draw (
-                 new (1, 1, 19, 3),
-                 attrs [1],
-                 attrs [2],
-                 driver: driver);
+        tf.Draw (driver: driver, screen: new (1, 1, 19, 3), normalColor: attrs [1], hotColor: attrs [2]);
 
 
         DriverAssert.AssertDriverAttributesAre (
         DriverAssert.AssertDriverAttributesAre (
                                                 @"
                                                 @"
@@ -422,7 +414,7 @@ Nice       Work")]
             MultiLine = true
             MultiLine = true
         };
         };
 
 
-        tf.Draw (new (0, 0, width, height), Attribute.Default, Attribute.Default, driver: driver);
+        tf.Draw (driver: driver, screen: new (0, 0, width, height), normalColor: Attribute.Default, hotColor: Attribute.Default);
 
 
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
     }
     }
@@ -448,7 +440,7 @@ Nice       Work")]
         driver!.SetScreenSize (tfSize.Width, tfSize.Height);
         driver!.SetScreenSize (tfSize.Width, tfSize.Height);
 
 
         driver.FillRect (driver.Screen, (Rune)'*');
         driver.FillRect (driver.Screen, (Rune)'*');
-        tf.Draw (driver.Screen, Attribute.Default, Attribute.Default, driver: driver);
+        tf.Draw (driver: driver, screen: driver.Screen, normalColor: Attribute.Default, hotColor: Attribute.Default);
 
 
         var expectedText = """
         var expectedText = """
                            UI Catalog: A comprehensive sample library and test app for
                            UI Catalog: A comprehensive sample library and test app for
@@ -575,7 +567,7 @@ Nice       Work")]
         Size size = tf.FormatAndGetSize ();
         Size size = tf.FormatAndGetSize ();
         Assert.Equal (new (expectedWidth, expectedHeight), size);
         Assert.Equal (new (expectedWidth, expectedHeight), size);
 
 
-        tf.Draw (new (0, 0, width, height), Attribute.Default, Attribute.Default, driver: driver);
+        tf.Draw (driver: driver, screen: new (0, 0, width, height), normalColor: Attribute.Default, hotColor: Attribute.Default);
 
 
         DriverAssert.AssertDriverContentsWithFrameAre (expectedDraw, output, driver);
         DriverAssert.AssertDriverContentsWithFrameAre (expectedDraw, output, driver);
     }
     }
@@ -660,7 +652,7 @@ Nice       Work")]
         Size size = tf.FormatAndGetSize ();
         Size size = tf.FormatAndGetSize ();
         Assert.Equal (new (expectedWidth, expectedHeight), size);
         Assert.Equal (new (expectedWidth, expectedHeight), size);
 
 
-        tf.Draw (new (0, 0, width, height), Attribute.Default, Attribute.Default, driver: driver);
+        tf.Draw (driver: driver, screen: new (0, 0, width, height), normalColor: Attribute.Default, hotColor: Attribute.Default);
 
 
         DriverAssert.AssertDriverContentsWithFrameAre (expectedDraw, output, driver);
         DriverAssert.AssertDriverContentsWithFrameAre (expectedDraw, output, driver);
     }
     }

+ 1 - 1
Tests/UnitTestsParallelizable/Text/TextFormatterJustificationTests.cs

@@ -3423,7 +3423,7 @@ public class TextFormatterJustificationTests (ITestOutputHelper output) : FakeDr
         };
         };
 
 
         driver.FillRect (new (0, 0, 7, 7), (Rune)'*');
         driver.FillRect (new (0, 0, 7, 7), (Rune)'*');
-        tf.Draw (new (0, 0, 7, 7), Attribute.Default, Attribute.Default, driver: driver);
+        tf.Draw (driver: driver, screen: new (0, 0, 7, 7), normalColor: Attribute.Default, hotColor: Attribute.Default);
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
     }
     }
 }
 }

+ 14 - 17
Tests/UnitTestsParallelizable/Text/TextFormatterTests.cs

@@ -1142,6 +1142,7 @@ public class TextFormatterTests (ITestOutputHelper output) : FakeDriverBase
     [Fact]
     [Fact]
     public void NeedsFormat_Sets ()
     public void NeedsFormat_Sets ()
     {
     {
+        IDriver driver = CreateFakeDriver ();
         var testText = "test";
         var testText = "test";
         var testBounds = new Rectangle (0, 0, 100, 1);
         var testBounds = new Rectangle (0, 0, 100, 1);
         var tf = new TextFormatter ();
         var tf = new TextFormatter ();
@@ -1151,7 +1152,7 @@ public class TextFormatterTests (ITestOutputHelper output) : FakeDriverBase
         Assert.NotEmpty (tf.GetLines ());
         Assert.NotEmpty (tf.GetLines ());
         Assert.False (tf.NeedsFormat); // get_Lines causes a Format
         Assert.False (tf.NeedsFormat); // get_Lines causes a Format
         Assert.Equal (testText, tf.Text);
         Assert.Equal (testText, tf.Text);
-        tf.Draw (testBounds, new (), new ());
+        tf.Draw (driver: driver, screen: testBounds, normalColor: new (), hotColor: new ());
         Assert.False (tf.NeedsFormat);
         Assert.False (tf.NeedsFormat);
 
 
         tf.ConstrainToSize = new (1, 1);
         tf.ConstrainToSize = new (1, 1);
@@ -2987,7 +2988,7 @@ public class TextFormatterTests (ITestOutputHelper output) : FakeDriverBase
             ConstrainToHeight = 1
             ConstrainToHeight = 1
         };
         };
 
 
-        tf.Draw (new Rectangle (0, 0, width, 1), Attribute.Default, Attribute.Default, default, driver);
+        tf.Draw (driver, new Rectangle (0, 0, width, 1), Attribute.Default, Attribute.Default, default);
 
 
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
     }
     }
@@ -3016,7 +3017,7 @@ public class TextFormatterTests (ITestOutputHelper output) : FakeDriverBase
             ConstrainToHeight = 1
             ConstrainToHeight = 1
         };
         };
 
 
-        tf.Draw (new Rectangle (0, 0, width, 1), Attribute.Default, Attribute.Default, default, driver);
+        tf.Draw (driver, new Rectangle (0, 0, width, 1), Attribute.Default, Attribute.Default, default);
 
 
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
     }
     }
@@ -3042,7 +3043,7 @@ public class TextFormatterTests (ITestOutputHelper output) : FakeDriverBase
             ConstrainToHeight = 1
             ConstrainToHeight = 1
         };
         };
 
 
-        tf.Draw (new Rectangle (0, 0, width, 1), Attribute.Default, Attribute.Default, default, driver);
+        tf.Draw (driver, new Rectangle (0, 0, width, 1), Attribute.Default, Attribute.Default, default);
 
 
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
     }
     }
@@ -3068,7 +3069,7 @@ public class TextFormatterTests (ITestOutputHelper output) : FakeDriverBase
             ConstrainToHeight = 1
             ConstrainToHeight = 1
         };
         };
 
 
-        tf.Draw (new Rectangle (0, 0, width, 1), Attribute.Default, Attribute.Default, default, driver);
+        tf.Draw (driver, new Rectangle (0, 0, width, 1), Attribute.Default, Attribute.Default, default);
 
 
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
         DriverAssert.AssertDriverContentsWithFrameAre (expectedText, output, driver);
     }
     }
@@ -3100,12 +3101,11 @@ ssb
         tf.ConstrainToSize = new (width, height);
         tf.ConstrainToSize = new (width, height);
 
 
         tf.Draw (
         tf.Draw (
+                 driver,
                  new (0, 0, width, height),
                  new (0, 0, width, height),
                  new (ColorName16.White, ColorName16.Black),
                  new (ColorName16.White, ColorName16.Black),
                  new (ColorName16.Blue, ColorName16.Black),
                  new (ColorName16.Blue, ColorName16.Black),
-                 default (Rectangle),
-                 driver
-                );
+                 default (Rectangle));
         DriverAssert.AssertDriverContentsWithFrameAre (expected, output, driver);
         DriverAssert.AssertDriverContentsWithFrameAre (expected, output, driver);
 
 
         driver.End ();
         driver.End ();
@@ -3139,12 +3139,11 @@ ssb
         Assert.True (tf.WordWrap);
         Assert.True (tf.WordWrap);
 
 
         tf.Draw (
         tf.Draw (
+                 driver,
                  new (0, 0, width, height),
                  new (0, 0, width, height),
                  new (ColorName16.White, ColorName16.Black),
                  new (ColorName16.White, ColorName16.Black),
                  new (ColorName16.Blue, ColorName16.Black),
                  new (ColorName16.Blue, ColorName16.Black),
-                 default (Rectangle),
-                 driver
-                );
+                 default (Rectangle));
         DriverAssert.AssertDriverContentsWithFrameAre (expected, output, driver);
         DriverAssert.AssertDriverContentsWithFrameAre (expected, output, driver);
 
 
         driver.End ();
         driver.End ();
@@ -3178,12 +3177,11 @@ ssb
         Assert.False (tf.PreserveTrailingSpaces);
         Assert.False (tf.PreserveTrailingSpaces);
 
 
         tf.Draw (
         tf.Draw (
+                 driver,
                  new (0, 0, width, height),
                  new (0, 0, width, height),
                  new (ColorName16.White, ColorName16.Black),
                  new (ColorName16.White, ColorName16.Black),
                  new (ColorName16.Blue, ColorName16.Black),
                  new (ColorName16.Blue, ColorName16.Black),
-                 default (Rectangle),
-                 driver
-                );
+                 default (Rectangle));
         DriverAssert.AssertDriverContentsWithFrameAre (expected, output, driver);
         DriverAssert.AssertDriverContentsWithFrameAre (expected, output, driver);
 
 
         driver.End ();
         driver.End ();
@@ -3217,12 +3215,11 @@ ssb
         Assert.False (tf.PreserveTrailingSpaces);
         Assert.False (tf.PreserveTrailingSpaces);
 
 
         tf.Draw (
         tf.Draw (
+                 driver,
                  new (0, 0, width, height),
                  new (0, 0, width, height),
                  new (ColorName16.White, ColorName16.Black),
                  new (ColorName16.White, ColorName16.Black),
                  new (ColorName16.Blue, ColorName16.Black),
                  new (ColorName16.Blue, ColorName16.Black),
-                 default (Rectangle),
-                 driver
-                );
+                 default (Rectangle));
         DriverAssert.AssertDriverContentsWithFrameAre (expected, output, driver);
         DriverAssert.AssertDriverContentsWithFrameAre (expected, output, driver);
 
 
         driver.End ();
         driver.End ();

+ 9 - 7
Tests/UnitTestsParallelizable/View/Draw/NeedsDrawTests.cs

@@ -1,8 +1,10 @@
 #nullable enable
 #nullable enable
+using UnitTests;
+
 namespace UnitTests_Parallelizable.ViewTests;
 namespace UnitTests_Parallelizable.ViewTests;
 
 
 [Trait ("Category", "Output")]
 [Trait ("Category", "Output")]
-public class NeedsDrawTests
+public class NeedsDrawTests : FakeDriverBase
 {
 {
     [Fact]
     [Fact]
     public void NeedsDraw_False_If_Width_Height_Zero ()
     public void NeedsDraw_False_If_Width_Height_Zero ()
@@ -18,7 +20,7 @@ public class NeedsDrawTests
     [Fact]
     [Fact]
     public void NeedsDraw_True_Initially_If_Width_Height_Not_Zero ()
     public void NeedsDraw_True_Initially_If_Width_Height_Not_Zero ()
     {
     {
-        View superView = new () { Width = 1, Height = 1 };
+        View superView = new () { Driver = CreateFakeDriver (), Width = 1, Height = 1 };
         View view1 = new () { Width = 1, Height = 1 };
         View view1 = new () { Width = 1, Height = 1 };
         View view2 = new () { Width = 1, Height = 1 };
         View view2 = new () { Width = 1, Height = 1 };
 
 
@@ -54,7 +56,7 @@ public class NeedsDrawTests
         var view = new View { Width = 2, Height = 2 };
         var view = new View { Width = 2, Height = 2 };
         Assert.True (view.NeedsDraw);
         Assert.True (view.NeedsDraw);
 
 
-        view = new() { Width = 2, Height = 2, BorderStyle = LineStyle.Single };
+        view = new () { Width = 2, Height = 2, BorderStyle = LineStyle.Single };
         Assert.True (view.NeedsDraw);
         Assert.True (view.NeedsDraw);
     }
     }
 
 
@@ -90,7 +92,7 @@ public class NeedsDrawTests
         view.EndInit ();
         view.EndInit ();
         Assert.True (view.NeedsDraw);
         Assert.True (view.NeedsDraw);
 
 
-        view = new() { Width = 2, Height = 2, BorderStyle = LineStyle.Single };
+        view = new () { Width = 2, Height = 2, BorderStyle = LineStyle.Single };
         view.BeginInit ();
         view.BeginInit ();
         view.NeedsDraw = false;
         view.NeedsDraw = false;
         view.EndInit ();
         view.EndInit ();
@@ -100,7 +102,7 @@ public class NeedsDrawTests
     [Fact]
     [Fact]
     public void NeedsDraw_After_SetLayoutNeeded_And_Layout ()
     public void NeedsDraw_After_SetLayoutNeeded_And_Layout ()
     {
     {
-        var view = new View { Width = 2, Height = 2 };
+        var view = new View { Driver = CreateFakeDriver (), Width = 2, Height = 2 };
         Assert.True (view.NeedsDraw);
         Assert.True (view.NeedsDraw);
         Assert.False (view.NeedsLayout);
         Assert.False (view.NeedsLayout);
 
 
@@ -120,7 +122,7 @@ public class NeedsDrawTests
     [Fact]
     [Fact]
     public void NeedsDraw_False_After_SetRelativeLayout_Absolute_Dims ()
     public void NeedsDraw_False_After_SetRelativeLayout_Absolute_Dims ()
     {
     {
-        var view = new View { Width = 2, Height = 2 };
+        var view = new View { Driver = CreateFakeDriver (), Width = 2, Height = 2 };
         Assert.True (view.NeedsDraw);
         Assert.True (view.NeedsDraw);
 
 
         view.Draw ();
         view.Draw ();
@@ -224,7 +226,7 @@ public class NeedsDrawTests
     [Fact]
     [Fact]
     public void NeedsDraw_False_After_Draw ()
     public void NeedsDraw_False_After_Draw ()
     {
     {
-        var view = new View { Width = 2, Height = 2, BorderStyle = LineStyle.Single };
+        var view = new View { Driver = CreateFakeDriver (), Width = 2, Height = 2, BorderStyle = LineStyle.Single };
         Assert.True (view.NeedsDraw);
         Assert.True (view.NeedsDraw);
 
 
         view.BeginInit ();
         view.BeginInit ();

+ 1 - 1
Tests/UnitTestsParallelizable/View/Draw/ViewDrawingFlowTests.cs

@@ -59,7 +59,7 @@ public class ViewDrawingFlowTests (ITestOutputHelper output) : FakeDriverBase
     [Fact]
     [Fact]
     public void SetNeedsDraw_WithRectangle_UpdatesNeedsDrawRect ()
     public void SetNeedsDraw_WithRectangle_UpdatesNeedsDrawRect ()
     {
     {
-        var view = new View { X = 0, Y = 0, Width = 20, Height = 20 };
+        var view = new View { Driver = CreateFakeDriver (), X = 0, Y = 0, Width = 20, Height = 20 };
         view.BeginInit ();
         view.BeginInit ();
         view.EndInit ();
         view.EndInit ();
         view.LayoutSubViews ();
         view.LayoutSubViews ();

+ 1 - 0
Tests/UnitTestsParallelizable/Views/AllViewsDrawTests.cs

@@ -21,6 +21,7 @@ public class AllViewsDrawTests (ITestOutputHelper output) : TestsAllViews
             return;
             return;
         }
         }
 
 
+        view.Driver = driver;
         output.WriteLine ($"Testing {viewType}");
         output.WriteLine ($"Testing {viewType}");
 
 
         if (view is IDesignable designable)
         if (view is IDesignable designable)

+ 7 - 5
Tests/UnitTestsParallelizable/Views/LineTests.cs

@@ -1,6 +1,8 @@
+using UnitTests;
+
 namespace UnitTests_Parallelizable.ViewsTests;
 namespace UnitTests_Parallelizable.ViewsTests;
 
 
-public class LineTests
+public class LineTests : FakeDriverBase
 {
 {
     [Fact]
     [Fact]
     public void Line_DefaultConstructor_Horizontal ()
     public void Line_DefaultConstructor_Horizontal ()
@@ -87,7 +89,7 @@ public class LineTests
     [Fact]
     [Fact]
     public void Line_DrawsCalled_Successfully ()
     public void Line_DrawsCalled_Successfully ()
     {
     {
-        var app = new Window ();
+        var app = new Window () { Driver = CreateFakeDriver () };
         var line = new Line { Y = 1, Width = 10 };
         var line = new Line { Y = 1, Width = 10 };
         app.Add (line);
         app.Add (line);
 
 
@@ -103,7 +105,7 @@ public class LineTests
     [Fact]
     [Fact]
     public void Line_WithBorder_DrawsSuccessfully ()
     public void Line_WithBorder_DrawsSuccessfully ()
     {
     {
-        var app = new Window { Width = 20, Height = 10, BorderStyle = LineStyle.Single };
+        var app = new Window { Driver = CreateFakeDriver (), Width = 20, Height = 10, BorderStyle = LineStyle.Single };
 
 
         // Add a line that intersects with the window border
         // Add a line that intersects with the window border
         var line = new Line { X = 5, Y = 0, Height = Dim.Fill (), Orientation = Orientation.Vertical };
         var line = new Line { X = 5, Y = 0, Height = Dim.Fill (), Orientation = Orientation.Vertical };
@@ -121,7 +123,7 @@ public class LineTests
     [Fact]
     [Fact]
     public void Line_MultipleIntersecting_DrawsSuccessfully ()
     public void Line_MultipleIntersecting_DrawsSuccessfully ()
     {
     {
-        var app = new Window { Width = 30, Height = 15 };
+        var app = new Window { Driver = CreateFakeDriver (), Width = 30, Height = 15 };
 
 
         // Create intersecting lines
         // Create intersecting lines
         var hLine = new Line { X = 5, Y = 5, Width = 15, Style = LineStyle.Single };
         var hLine = new Line { X = 5, Y = 5, Width = 15, Style = LineStyle.Single };
@@ -258,7 +260,7 @@ public class LineTests
 
 
         // Test: new Line { Height = 9, Orientation = Orientation.Vertical }
         // Test: new Line { Height = 9, Orientation = Orientation.Vertical }
         // Expected: Width=1, Height=9
         // Expected: Width=1, Height=9
-        line = new() { Height = 9, Orientation = Orientation.Vertical };
+        line = new () { Height = 9, Orientation = Orientation.Vertical };
 
 
         Assert.Equal (1, line.Width.GetAnchor (0));
         Assert.Equal (1, line.Width.GetAnchor (0));
         Assert.Equal (9, line.Height.GetAnchor (0));
         Assert.Equal (9, line.Height.GetAnchor (0));