Changing from AssertDriverContentsWithPosAre to AssertDriverContentsWithFrameAre to return a Rect.

This commit is contained in:
BDisp
2022-03-11 00:33:22 +00:00
parent 484e98998a
commit d9f52fc2f2
4 changed files with 364 additions and 305 deletions

View File

@@ -512,8 +512,8 @@ Edit
└──────┘
";
var pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (0, 1), pos);
var pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (0, 1, 8, 4), pos);
}
[Fact, AutoInitShutdown]
@@ -541,8 +541,8 @@ Edit
──────┘
";
var pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (0, 0), pos);
var pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (0, 0, 7, 4), pos);
menu.CloseAllMenus ();
menu.Frame = new Rect (-1, -2, menu.Frame.Width, menu.Frame.Height);
@@ -555,8 +555,8 @@ Edit
──────┘
";
pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (1, 0), pos);
pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (1, 0, 7, 3), pos);
menu.CloseAllMenus ();
menu.Frame = new Rect (0, 0, menu.Frame.Width, menu.Frame.Height);
@@ -566,13 +566,13 @@ Edit
expected = @"
┌──────
│ One
│ Two
│ One
│ Two
└──────
";
pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (0, 1), pos);
pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (0, 1, 7, 4), pos);
menu.CloseAllMenus ();
menu.Frame = new Rect (0, 0, menu.Frame.Width, menu.Frame.Height);
@@ -582,12 +582,12 @@ Edit
expected = @"
┌──────
│ One
│ Two
│ One
│ Two
";
pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (0, 1), pos);
pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (0, 1, 7, 3), pos);
}
[Fact, AutoInitShutdown]
@@ -614,8 +614,8 @@ Edit
Numbers
";
var pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
var pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 9, 1), pos);
Assert.True (menu.ProcessHotKey (new KeyEvent (Key.F9, null)));
Application.Top.Redraw (Application.Top.Bounds);
@@ -628,8 +628,8 @@ Edit
└────────┘
";
pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 10, 6), pos);
Assert.True (Application.Top.Subviews [1].ProcessKey (new KeyEvent (Key.CursorDown, null)));
Application.Top.Redraw (Application.Top.Bounds);
@@ -643,8 +643,8 @@ Edit
└─────────────┘
";
pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 25, 7), pos);
Assert.True (Application.Top.Subviews [2].ProcessKey (new KeyEvent (Key.CursorLeft, null)));
Application.Top.Redraw (Application.Top.Bounds);
@@ -657,8 +657,8 @@ Edit
└────────┘
";
pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 10, 6), pos);
Assert.True (Application.Top.Subviews [1].ProcessKey (new KeyEvent (Key.Esc, null)));
Application.Top.Redraw (Application.Top.Bounds);
@@ -666,8 +666,8 @@ Edit
Numbers
";
pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 9, 1), pos);
}
[Fact, AutoInitShutdown]
@@ -694,8 +694,8 @@ Edit
Numbers
";
var pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
var pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 9, 1), pos);
Assert.True (menu.MouseEvent (new MouseEvent () {
X = 1,
@@ -713,8 +713,8 @@ Edit
└────────┘
";
pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 10, 6), pos);
Assert.False (menu.MouseEvent (new MouseEvent () {
X = 1,
@@ -733,8 +733,8 @@ Edit
└─────────────┘
";
pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 25, 7), pos);
Assert.False (menu.MouseEvent (new MouseEvent () {
X = 1,
@@ -752,8 +752,8 @@ Edit
└────────┘
";
pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 10, 6), pos);
Assert.False (menu.MouseEvent (new MouseEvent () {
X = 70,
@@ -766,8 +766,8 @@ Edit
Numbers
";
pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 9, 1), pos);
}
[Fact, AutoInitShutdown]
@@ -796,8 +796,8 @@ Edit
Numbers
";
var pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
var pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 9, 1), pos);
Assert.True (menu.ProcessHotKey (new KeyEvent (Key.F9, null)));
Application.Top.Redraw (Application.Top.Bounds);
@@ -810,8 +810,8 @@ Edit
└────────┘
";
pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 10, 6), pos);
Assert.True (Application.Top.Subviews [1].ProcessKey (new KeyEvent (Key.CursorDown, null)));
Assert.True (Application.Top.Subviews [1].ProcessKey (new KeyEvent (Key.Enter, null)));
@@ -826,8 +826,8 @@ Edit
└─────────────┘
";
pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 15, 7), pos);
Assert.True (Application.Top.Subviews [2].ProcessKey (new KeyEvent (Key.Enter, null)));
Application.Top.Redraw (Application.Top.Bounds);
@@ -840,8 +840,8 @@ Edit
└────────┘
";
pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 10, 6), pos);
Assert.True (Application.Top.Subviews [1].ProcessKey (new KeyEvent (Key.Esc, null)));
Application.Top.Redraw (Application.Top.Bounds);
@@ -849,8 +849,8 @@ Edit
Numbers
";
pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 9, 1), pos);
}
[Fact, AutoInitShutdown]
@@ -879,8 +879,8 @@ Edit
Numbers
";
var pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
var pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 9, 1), pos);
Assert.True (menu.MouseEvent (new MouseEvent () {
X = 1,
@@ -898,8 +898,8 @@ Edit
└────────┘
";
pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 10, 6), pos);
Assert.False (menu.MouseEvent (new MouseEvent () {
X = 1,
@@ -918,8 +918,8 @@ Edit
└─────────────┘
";
pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 15, 7), pos);
Assert.False (menu.MouseEvent (new MouseEvent () {
X = 1,
@@ -937,8 +937,8 @@ Edit
└────────┘
";
pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 10, 6), pos);
Assert.False (menu.MouseEvent (new MouseEvent () {
X = 70,
@@ -951,12 +951,12 @@ Edit
Numbers
";
pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 9, 1), pos);
}
[Fact, AutoInitShutdown]
public void HotKey_MenuBar_OnKeyDown_OnKeyUp_ProcessKey ()
public void HotKey_MenuBar_OnKeyDown_OnKeyUp_ProcessHotKey_ProcessKey ()
{
var newAction = false;
var copyAction = false;
@@ -983,16 +983,22 @@ Edit
File Edit
";
var pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
var pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 13, 1), pos);
Assert.True (menu.ProcessKey (new (Key.N, null)));
Application.MainLoop.MainIteration ();
Assert.True (newAction);
Assert.False (menu.OnKeyDown (new (Key.AltMask, new KeyModifiers () { Alt = true })));
Assert.True (menu.OnKeyUp (new (Key.AltMask, new KeyModifiers () { Alt = true })));
Assert.True (menu.ProcessHotKey (new (Key.AltMask, new KeyModifiers () { Alt = true })));
Assert.True (menu.IsMenuOpen);
Application.Top.Redraw (Application.Top.Bounds);
expected = @"
File Edit
";
pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 13, 1), pos);
Assert.True (menu.ProcessKey (new (Key.CursorRight, null)));
Assert.True (menu.ProcessKey (new (Key.C, null)));
@@ -1030,8 +1036,8 @@ Edit
└───────┘
";
var pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
var pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 13, 4), pos);
Assert.True (Application.Top.Subviews [1].ProcessKey (new (Key.N, null)));
Application.MainLoop.MainIteration ();
@@ -1047,8 +1053,8 @@ Edit
└────────┘
";
pos = GraphViewTests.AssertDriverContentsWithPosAre (expected, output);
Assert.Equal (new Point (2, 0), pos);
pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
Assert.Equal (new Rect (2, 0, 17, 4), pos);
Assert.True (Application.Top.Subviews [1].ProcessKey (new (Key.C, null)));
Application.MainLoop.MainIteration ();