Class FakeDriver
Implements a mock ConsoleDriver for unit testing
Inherited Members
Namespace: Terminal.Gui
Assembly: Terminal.Gui.dll
Syntax
public class FakeDriver : ConsoleDriver
Constructors
| Edit this page View SourceFakeDriver()
Declaration
public FakeDriver()
Fields
| Edit this page View SourceFakeBehaviors
Declaration
public static FakeDriver.Behaviors FakeBehaviors
Field Value
| Type | Description |
|---|---|
| FakeDriver.Behaviors |
Properties
| Edit this page View SourceClipboard
Get the operation system clipboard.
Declaration
public override IClipboard Clipboard { get; }
Property Value
| Type | Description |
|---|---|
| IClipboard |
Overrides
| Edit this page View SourceCols
The current number of columns in the terminal.
Declaration
public override int Cols { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
| Edit this page View SourceContents
Assists with testing, the format is rows, columns and 3 values on the last column: Rune, Attribute and Dirty Flag
Declaration
public override int[,,] Contents { get; }
Property Value
| Type | Description |
|---|---|
| int[,,] |
Overrides
| Edit this page View SourceEnableConsoleScrolling
If false (the default) the height of the Terminal.Gui application (Rows) tracks to the height of the visible console view when the console is resized. In this case scrolling in the console will be disabled and all Rows will remain visible.
If true then height of the Terminal.Gui application Rows only tracks the height of the visible console view when the console is made larger (the application will only grow in height, never shrink). In this case console scrolling is enabled and the contents (Rows high) will scroll as the console scrolls.
Declaration
[Obsolete("This API is deprecated", false)]
public override bool EnableConsoleScrolling { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
Remarks
NOTE: Changes to Windows Terminal prevents this functionality from working. It only really worked on Windows 'conhost' previously.
|
Edit this page
View Source
HeightAsBuffer
This API is deprecated and has no impact when enabled.
Declaration
[Obsolete("This API is deprecated", false)]
public override bool HeightAsBuffer { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
| Edit this page View SourceLeft
The current left in the terminal.
Declaration
public override int Left { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
| Edit this page View SourceRows
The current number of rows in the terminal.
Declaration
public override int Rows { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
| Edit this page View SourceTop
The current top in the terminal.
Declaration
public override int Top { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
Methods
| Edit this page View SourceAddRune(Rune)
Adds the specified rune to the display at the current cursor position.
Declaration
public override void AddRune(Rune rune)
Parameters
| Type | Name | Description |
|---|---|---|
| Rune | rune | Rune to add. |
Overrides
| Edit this page View SourceAddStr(ustring)
Adds the
str to the display at the cursor position.Declaration
public override void AddStr(ustring str)
Parameters
| Type | Name | Description |
|---|---|---|
| ustring | str | String. |
Overrides
| Edit this page View SourceCookMouse()
Enables the cooked event processing from the mouse driver. Not implemented by any driver: See Issue #2300.
Declaration
public override void CookMouse()
Overrides
| Edit this page View SourceEnd()
Ends the execution of the console driver.
Declaration
public override void End()
Overrides
| Edit this page View SourceEnsureCursorVisibility()
Ensure the cursor visibility
Declaration
public override bool EnsureCursorVisibility()
Returns
| Type | Description |
|---|---|
| bool | true upon success |
Overrides
| Edit this page View SourceFromVKPacketToKConsoleKeyInfo(ConsoleKeyInfo)
Declaration
public ConsoleKeyInfo FromVKPacketToKConsoleKeyInfo(ConsoleKeyInfo consoleKeyInfo)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsoleKeyInfo | consoleKeyInfo |
Returns
| Type | Description |
|---|---|
| ConsoleKeyInfo |
GetColors(int, out Color, out Color)
Gets the foreground and background colors based on the value.
Declaration
public override bool GetColors(int value, out Color foreground, out Color background)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | The value. |
| Color | foreground | The foreground. |
| Color | background | The background. |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
| Edit this page View SourceGetCursorVisibility(out CursorVisibility)
Retreive the cursor caret visibility
Declaration
public override bool GetCursorVisibility(out CursorVisibility visibility)
Parameters
| Type | Name | Description |
|---|---|---|
| CursorVisibility | visibility | The current CursorVisibility |
Returns
| Type | Description |
|---|---|
| bool | true upon success |
Overrides
| Edit this page View SourceInit(Action)
Initializes the driver
Declaration
public override void Init(Action terminalResized)
Parameters
| Type | Name | Description |
|---|---|---|
| Action | terminalResized | Method to invoke when the terminal is resized. |
Overrides
| Edit this page View SourceMakeAttribute(Color, Color)
Make the attribute for the foreground and background colors.
Declaration
public override Attribute MakeAttribute(Color fore, Color back)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | fore | Foreground. |
| Color | back | Background. |
Returns
| Type | Description |
|---|---|
| Attribute |
Overrides
| Edit this page View SourceMakeColor(Color, Color)
Make the Colors for the ColorScheme.
Declaration
public override Attribute MakeColor(Color foreground, Color background)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | foreground | The foreground color. |
| Color | background | The background color. |
Returns
| Type | Description |
|---|---|
| Attribute | The attribute for the foreground and background colors. |
Overrides
| Edit this page View SourceMove(int, int)
Moves the cursor to the specified column and row.
Declaration
public override void Move(int col, int row)
Parameters
| Type | Name | Description |
|---|---|---|
| int | col | Column to move the cursor to. |
| int | row | Row to move the cursor to. |
Overrides
| Edit this page View SourcePrepareToRun(MainLoop, Action<KeyEvent>, Action<KeyEvent>, Action<KeyEvent>, Action<MouseEvent>)
Prepare the driver and set the key and mouse events handlers.
Declaration
public override void PrepareToRun(MainLoop mainLoop, Action<KeyEvent> keyHandler, Action<KeyEvent> keyDownHandler, Action<KeyEvent> keyUpHandler, Action<MouseEvent> mouseHandler)
Parameters
| Type | Name | Description |
|---|---|---|
| MainLoop | mainLoop | The main loop. |
| Action<KeyEvent> | keyHandler | The handler for ProcessKey |
| Action<KeyEvent> | keyDownHandler | The handler for key down events |
| Action<KeyEvent> | keyUpHandler | The handler for key up events |
| Action<MouseEvent> | mouseHandler | The handler for mouse events |
Overrides
| Edit this page View SourceRefresh()
Updates the screen to reflect all the changes that have been done to the display buffer
Declaration
public override void Refresh()
Overrides
| Edit this page View SourceResizeScreen()
Resizes the clip area when the screen is resized.
Declaration
public override void ResizeScreen()
Overrides
| Edit this page View SourceSendKeys(char, ConsoleKey, bool, bool, bool)
Allows sending keys without typing on a keyboard.
Declaration
public override void SendKeys(char keyChar, ConsoleKey key, bool shift, bool alt, bool control)
Parameters
| Type | Name | Description |
|---|---|---|
| char | keyChar | The character key. |
| ConsoleKey | key | The key. |
| bool | shift | If shift key is sending. |
| bool | alt | If alt key is sending. |
| bool | control | If control key is sending. |
Overrides
| Edit this page View SourceSetAttribute(Attribute)
Selects the specified attribute as the attribute to use for future calls to AddRune and AddString.
Declaration
public override void SetAttribute(Attribute c)
Parameters
| Type | Name | Description |
|---|---|---|
| Attribute | c | C. |
Overrides
Remarks
Implementations should call
|
Edit this page
View Source
base.SetAttribute(c).SetBufferSize(int, int)
Declaration
public void SetBufferSize(int width, int height)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | |
| int | height |
SetColors(ConsoleColor, ConsoleColor)
Set Colors from limit sets of colors. Not implemented by any driver: See Issue #2300.
Declaration
public override void SetColors(ConsoleColor foreground, ConsoleColor background)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsoleColor | foreground | Foreground. |
| ConsoleColor | background | Background. |
Overrides
| Edit this page View SourceSetColors(short, short)
Advanced uses - set colors to any pre-set pairs, you would need to init_color
that independently with the R, G, B values. Not implemented by any driver: See Issue #2300.
Declaration
public override void SetColors(short foregroundColorId, short backgroundColorId)
Parameters
| Type | Name | Description |
|---|---|---|
| short | foregroundColorId | Foreground color identifier. |
| short | backgroundColorId | Background color identifier. |
Overrides
| Edit this page View SourceSetCursorVisibility(CursorVisibility)
Change the cursor caret visibility
Declaration
public override bool SetCursorVisibility(CursorVisibility visibility)
Parameters
| Type | Name | Description |
|---|---|---|
| CursorVisibility | visibility | The wished CursorVisibility |
Returns
| Type | Description |
|---|---|
| bool | true upon success |
Overrides
| Edit this page View SourceSetWindowPosition(int, int)
Declaration
public void SetWindowPosition(int left, int top)
Parameters
| Type | Name | Description |
|---|---|---|
| int | left | |
| int | top |
SetWindowSize(int, int)
Declaration
public void SetWindowSize(int width, int height)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | |
| int | height |
StartReportingMouseMoves()
Start of mouse moves.
Declaration
public override void StartReportingMouseMoves()
Overrides
| Edit this page View SourceStopReportingMouseMoves()
Stop reporting mouses moves.
Declaration
public override void StopReportingMouseMoves()
Overrides
| Edit this page View SourceSuspend()
Suspend the application, typically needs to save the state, suspend the app and upon return, reset the console driver.
Declaration
public override void Suspend()
Overrides
| Edit this page View SourceUncookMouse()
Disables the cooked event processing from the mouse driver.
At startup, it is assumed mouse events are cooked. Not implemented by any driver: See Issue #2300.
Declaration
public override void UncookMouse()
Overrides
| Edit this page View SourceUpdateCursor()
Updates the location of the cursor position
Declaration
public override void UpdateCursor()
Overrides
| Edit this page View SourceUpdateOffScreen()
Reset and recreate the contents and the driver buffer.
Declaration
public override void UpdateOffScreen()
Overrides
| Edit this page View SourceUpdateScreen()
Redraws the physical screen with the contents that have been queued up via any of the printing commands.
Declaration
public override void UpdateScreen()