mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
unit test issue
This commit is contained in:
@@ -396,7 +396,7 @@ public partial class View // Drawing APIs
|
||||
}
|
||||
|
||||
Attribute disabled = new (cs.Disabled.Foreground, cs.Disabled.Background);
|
||||
if (Diagnostics.HasFlag (ViewDiagnosticFlags.Hover) && _Hover)
|
||||
if (Diagnostics.HasFlag (ViewDiagnosticFlags.Hover) && _hovering)
|
||||
{
|
||||
disabled = new (disabled.Foreground.GetDarkerColor (), disabled.Background.GetDarkerColor ());
|
||||
}
|
||||
@@ -406,7 +406,7 @@ public partial class View // Drawing APIs
|
||||
private Attribute GetColor (Attribute inputAttribute)
|
||||
{
|
||||
Attribute attr = inputAttribute;
|
||||
if (Diagnostics.HasFlag (ViewDiagnosticFlags.Hover) && _Hover)
|
||||
if (Diagnostics.HasFlag (ViewDiagnosticFlags.Hover) && _hovering)
|
||||
{
|
||||
attr = new (attr.Foreground.GetDarkerColor (), attr.Background.GetDarkerColor ());
|
||||
}
|
||||
|
||||
@@ -126,7 +126,8 @@ public partial class View // Mouse APIs
|
||||
|
||||
#region MouseEnterLeave
|
||||
|
||||
private bool _Hover;
|
||||
private bool _hovering;
|
||||
private ColorScheme? _savedNonHoverColorScheme;
|
||||
|
||||
/// <summary>
|
||||
/// INTERNAL Called by <see cref="Application.OnMouseEvent"/> when the mouse moves over the View's <see cref="Frame"/>.
|
||||
@@ -154,7 +155,7 @@ public partial class View // Mouse APIs
|
||||
|
||||
MouseEnter?.Invoke (this, eventArgs);
|
||||
|
||||
_Hover = !eventArgs.Cancel;
|
||||
_hovering = !eventArgs.Cancel;
|
||||
|
||||
if (eventArgs.Cancel)
|
||||
{
|
||||
@@ -166,9 +167,8 @@ public partial class View // Mouse APIs
|
||||
HighlightStyle copy = HighlightStyle;
|
||||
HighlightStyle hover = HighlightStyle.Hover;
|
||||
CancelEventArgs<HighlightStyle> args = new (ref copy, ref hover);
|
||||
RaiseHighlight (args);
|
||||
|
||||
if (args.Cancel)
|
||||
|
||||
if (RaiseHighlight (args) || args.Cancel)
|
||||
{
|
||||
return args.Cancel;
|
||||
}
|
||||
@@ -180,7 +180,7 @@ public partial class View // Mouse APIs
|
||||
cs = new ();
|
||||
}
|
||||
|
||||
_savedNonHighlightColorScheme = cs;
|
||||
_savedNonHoverColorScheme = cs;
|
||||
|
||||
ColorScheme = ColorScheme.GetHighlightColorScheme ();
|
||||
}
|
||||
@@ -260,7 +260,7 @@ public partial class View // Mouse APIs
|
||||
|
||||
MouseLeave?.Invoke (this, EventArgs.Empty);
|
||||
|
||||
_Hover = false;
|
||||
_hovering = false;
|
||||
|
||||
if ((HighlightStyle.HasFlag (HighlightStyle.Hover) || Diagnostics.HasFlag (ViewDiagnosticFlags.Hover)))
|
||||
{
|
||||
@@ -268,8 +268,11 @@ public partial class View // Mouse APIs
|
||||
HighlightStyle hover = HighlightStyle.None;
|
||||
RaiseHighlight (new (ref copy, ref hover));
|
||||
|
||||
ColorScheme = _savedNonHighlightColorScheme;
|
||||
_savedNonHighlightColorScheme = default;
|
||||
if (_savedNonHoverColorScheme is { })
|
||||
{
|
||||
ColorScheme = _savedNonHoverColorScheme;
|
||||
_savedNonHoverColorScheme = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,9 +450,6 @@ public partial class View // Mouse APIs
|
||||
/// </summary>
|
||||
public event EventHandler<CancelEventArgs<HighlightStyle>>? Highlight;
|
||||
|
||||
private ColorScheme _savedNonHighlightColorScheme;
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Enables the highlight for the view when the mouse is pressed. Called from OnMouseEvent.
|
||||
|
||||
@@ -77,7 +77,7 @@ public class Button : View, IDesignable
|
||||
ShadowStyle = DefaultShadow;
|
||||
HighlightStyle = DefaultHighlightStyle;
|
||||
}
|
||||
|
||||
|
||||
private bool _wantContinuousButtonPressed;
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -169,7 +169,7 @@ public class Button : View, IDesignable
|
||||
/// <inheritdoc/>
|
||||
protected override void UpdateTextFormatterText ()
|
||||
{
|
||||
base.UpdateTextFormatterText();
|
||||
base.UpdateTextFormatterText ();
|
||||
if (NoDecorations)
|
||||
{
|
||||
TextFormatter.Text = Text;
|
||||
|
||||
@@ -662,6 +662,12 @@ public class MenuBarTests (ITestOutputHelper output)
|
||||
{
|
||||
|
||||
((FakeDriver)Application.Driver).SetBufferSize (40, 15);
|
||||
// Override CM
|
||||
Window.DefaultBorderStyle = LineStyle.Single;
|
||||
Dialog.DefaultButtonAlignment = Alignment.Center;
|
||||
Dialog.DefaultBorderStyle = LineStyle.Single;
|
||||
Button.DefaultShadow = ShadowStyle.None;
|
||||
|
||||
|
||||
Assert.Equal (new (0, 0, 40, 15), Application.Driver?.Clip);
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (@"", output);
|
||||
|
||||
Reference in New Issue
Block a user