-
Notifications
You must be signed in to change notification settings - Fork 735
Closed
Copy link
Milestone
Description
In
I proved that any unit test that needs to render, even if it uses Views, can now be authored in UnitTests.Parallelizable. See UnitTests.Parallizable/Drawing.
Now we need to move some tests that require keyboard / mouse input into Application.
It should now be possible to do this:
var app = new ApplicationImpl();
app.Init(nul, "fake");
// Do anything you used to be able to in a Unit Test that used Application
// e.g.
app.RaiseNewKeyDownEvent (...);
app.RaiseNewMouseEvent (...);
app.LayoutAndDraw();
DriverAssert.AssertDriverContentsAre (expected, _output);
app.Shutdown(); // technically not needed because there's no static state!First step is to write a sample unit tests in the UnitTests.Parallelizable project. Try porting this one:
[Fact]
[AutoInitShutdown]
public void CaptionedTextField_DoesNotOverspillViewport_Unicode ()
{
string caption = "Mise" + char.ConvertFromUtf32 (int.Parse ("0301", NumberStyles.HexNumber)) + "rables";
Assert.Equal (11, caption.Length);
Assert.Equal (10, caption.EnumerateRunes ().Sum (c => c.GetColumns ()));
TextField tf = GetTextFieldsInView ();
tf.Title = caption;
Application.RaiseKeyDownEvent ('\t');
Assert.False (tf.HasFocus);
tf.Draw ();
DriverAssert.AssertDriverContentsAre ("Misérables", output);
Application.Top.Dispose ();
}Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
✅ Done