-
Notifications
You must be signed in to change notification settings - Fork 717
Fixes #4172 Timeout revamp and remove continuous mouse #4173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…(old implementation of WantContinuousButtonPressed)
…on firing twice immediately as mouse is pressed down.
Downloading logs, it appears the failure on macos here is in
|
…znind-logarithmic-timeout
@tznind - This breaks See Compare this to v2_develop: I have merged this into #4126, and it wasn't too challenging, but then I noticed this. |
Ok cool, I guess just need to wire that 'held down' effect into the event handler for IMouseHeldDown. Something like setting it to true at start and false at end. |
Should be fixed now in a938fc1 |
@tznind please change the unit test [Theory]
[InlineData ("v2win", typeof (ConsoleDriverFacade<WindowsConsole.InputRecord>))]
[InlineData ("v2net", typeof (ConsoleDriverFacade<ConsoleKeyInfo>))]
[InlineData ("FakeDriver", typeof (FakeDriver))]
[InlineData ("NetDriver", typeof (NetDriver))]
[InlineData ("WindowsDriver", typeof (WindowsDriver))]
[InlineData ("CursesDriver", typeof (CursesDriver))]
public void Run_T_Call_Init_ForceDriver_Should_Pick_Correct_Driver (string driverName, Type expectedType)
{
Assert.True (ConsoleDriver.RunningUnitTests);
var result = false;
Task.Run (() =>
{
while (!Application.Initialized)
{
Task.Delay (300).Wait ();
}
}).ContinueWith (
(t, _) =>
{
// no longer loading
Assert.True (Application.Initialized);
Application.Invoke (() =>
{
result = true;
Application.RequestStop ();
});
},
TaskScheduler.FromCurrentSynchronizationContext ());
Application.ForceDriver = driverName;
Application.Run<TestToplevel> ();
Assert.NotNull (Application.Driver);
Assert.Equal (expectedType, Application.Driver?.GetType ());
Assert.NotNull (Application.Top);
Assert.False (Application.Top!.Running);
Application.Top!.Dispose ();
Shutdown ();
Assert.True (result);
} |
Code still seems to fail in CI, maybe :
|
Try this. It's needed to avoid that another driver is passing by using private readonly object _forceDriverLock = new ();
[Theory]
[InlineData ("v2win", typeof (ConsoleDriverFacade<WindowsConsole.InputRecord>))]
[InlineData ("v2net", typeof (ConsoleDriverFacade<ConsoleKeyInfo>))]
[InlineData ("FakeDriver", typeof (FakeDriver))]
[InlineData ("NetDriver", typeof (NetDriver))]
[InlineData ("WindowsDriver", typeof (WindowsDriver))]
[InlineData ("CursesDriver", typeof (CursesDriver))]
public void Run_T_Call_Init_ForceDriver_Should_Pick_Correct_Driver (string driverName, Type expectedType)
{
Assert.True (ConsoleDriver.RunningUnitTests);
var result = false;
lock (_forceDriverLock)
{
Task.Run (() =>
{
while (!Application.Initialized)
{
Task.Delay (300).Wait ();
}
})
.ContinueWith (
(t, _) =>
{
// no longer loading
Assert.True (Application.Initialized);
Application.Invoke (() =>
{
result = true;
Application.RequestStop ();
});
},
TaskScheduler.FromCurrentSynchronizationContext ());
}
Application.ForceDriver = driverName;
Application.Run<TestToplevel> ();
Assert.NotNull (Application.Driver);
Assert.Equal (expectedType, Application.Driver?.GetType ());
Assert.NotNull (Application.Top);
Assert.False (Application.Top!.Running);
Application.Top!.Dispose ();
Shutdown ();
Assert.True (result);
} |
Did you already seen these warnings on all projects?
|
I think the key might be this 28787e8 Without Idle anymore we apparently introduce possibility that even with Timespan.Zero the timeout doesn't show as immediately executing. |
Great. This latest change you made fix really it. It seems that if it's zero it may wait until the next timeout. Good catch. |
@tznind I just submitted another PR to this PR with some code cleanup and API doc improvements. |
Code cleanup and better API docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic work!
This is super set of #4172 and #4123 it adds also the smooth timeout class
Fixes
v2win/v2net
-WantContinuousButtonPressed
does not repeat. #4101Proposed Changes/Todos
Pull Request checklist:
CTRL-K-D
to automatically reformat your files before committing.dotnet test
before commit///
style comments)