本文整理汇总了C#中GuiWidget.OnMouseDown方法的典型用法代码示例。如果您正苦于以下问题:C# GuiWidget.OnMouseDown方法的具体用法?C# GuiWidget.OnMouseDown怎么用?C# GuiWidget.OnMouseDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuiWidget
的用法示例。
在下文中一共展示了GuiWidget.OnMouseDown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TextEditTextSelectionTests
public void TextEditTextSelectionTests()
{
GuiWidget container = new GuiWidget();
container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
TextEditWidget editField1 = new TextEditWidget("", 0, 0, pixelWidth: 51);
container.AddChild(editField1);
// select the conrol and type something in it
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0));
SendKey(Keys.A, 'a', container);
Assert.IsTrue(editField1.Text == "a", "It should have a in it.");
// select the begining again and type something else in it
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0));
SendKey(Keys.B, 'b', container);
Assert.IsTrue(editField1.Text == "ba", "It should have ba in it.");
// select the ba and delete them
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
container.OnMouseMove(new MouseEventArgs(MouseButtons.Left, 0, 15, 0, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 0, 15, 0, 0));
SendKey(Keys.Back, ' ', container);
Assert.IsTrue(editField1.Text == "", "It should have nothing in it.");
// select the other way
editField1.Text = "ab";
Assert.IsTrue(editField1.Text == "ab", "It should have ab in it.");
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 15, 0, 0));
container.OnMouseMove(new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0));
SendKey(Keys.Back, ' ', container);
Assert.IsTrue(editField1.Text == "", "It should have nothing in it.");
// select the other way but start far to the right
editField1.Text = "abc";
Assert.IsTrue(editField1.Text == "abc", "It should have abc in it.");
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 30, 0, 0));
container.OnMouseMove(new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0));
SendKey(Keys.Back, ' ', container);
Assert.IsTrue(editField1.Text == "", "It should have nothing in it.");
container.Close();
}
示例2: ValidateSimpleLeftClick
public void ValidateSimpleLeftClick()
{
GuiWidget container = new GuiWidget();
container.Name = "Container";
container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
Button button = new Button("Test", 100, 100);
button.Name = "button";
bool gotClick = false;
button.Click += (sender, e) => { gotClick = true; };
container.AddChild(button);
Assert.IsTrue(gotClick == false);
Assert.IsTrue(button.Focused == false);
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 10, 10, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 10, 10, 0));
Assert.IsTrue(gotClick == false);
Assert.IsTrue(button.Focused == false);
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 110, 110, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 10, 10, 0));
Assert.IsTrue(gotClick == false);
Assert.IsTrue(button.Focused == true, "Down click triggers focused.");
Assert.IsTrue(gotClick == false);
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 110, 110, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 110, 110, 0));
Assert.IsTrue(gotClick == true);
Assert.IsTrue(button.Focused == true);
gotClick = false;
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 10, 10, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 10, 10, 0));
Assert.IsTrue(gotClick == false);
Assert.IsTrue(button.Focused == false);
}
示例3: ListMenuTests
public void ListMenuTests()
{
string menuSelected = "";
GuiWidget container = new GuiWidget(400, 400);
TextWidget menueView = new TextWidget("Edit");
Menu listMenu = new Menu(menueView);
listMenu.OriginRelativeParent = new Vector2(10, 300);
MenuItem cutMenuItem = new MenuItem(new TextWidget("Cut"));
cutMenuItem.Selected += (sender, e) => { menuSelected = "Cut"; };
listMenu.MenuItems.Add(cutMenuItem);
MenuItem copyMenuItem = new MenuItem(new TextWidget("Copy"));
copyMenuItem.Selected += (sender, e) => { menuSelected = "Copy"; };
listMenu.MenuItems.Add(copyMenuItem);
MenuItem pastMenuItem = new MenuItem(new TextWidget("Paste"));
pastMenuItem.Selected += (sender, e) => { menuSelected = "Paste"; };
listMenu.MenuItems.Add(pastMenuItem);
container.AddChild(listMenu);
Assert.IsTrue(!listMenu.IsOpen);
// open the menu
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 11, 300, 0));
Assert.IsTrue(!listMenu.IsOpen);
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 11, 300, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(listMenu.IsOpen);
// all the menu itmes should be added to the open menu
Assert.IsTrue(cutMenuItem.Parent != null);
Assert.IsTrue(copyMenuItem.Parent != null);
Assert.IsTrue(pastMenuItem.Parent != null);
// click on menu again to close
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 11, 300, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(!listMenu.IsOpen);
// all the mune itmes should be removed from the closed menu
Assert.IsTrue(cutMenuItem.Parent == null);
Assert.IsTrue(copyMenuItem.Parent == null);
Assert.IsTrue(pastMenuItem.Parent == null);
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 11, 300, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(!listMenu.IsOpen);
// all the menu itmes should be removed from the closed menu
Assert.IsTrue(cutMenuItem.Parent == null);
Assert.IsTrue(copyMenuItem.Parent == null);
Assert.IsTrue(pastMenuItem.Parent == null);
// open the menu
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 11, 300, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(!listMenu.IsOpen);
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 11, 300, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(listMenu.IsOpen);
// all the menu itmes should be added to the open menu
Assert.IsTrue(cutMenuItem.Parent != null);
Assert.IsTrue(copyMenuItem.Parent != null);
Assert.IsTrue(pastMenuItem.Parent != null);
// click off menu to close
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 5, 299, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(!listMenu.IsOpen);
// all the mune itmes should be removed from the closed menu
Assert.IsTrue(cutMenuItem.Parent == null);
Assert.IsTrue(copyMenuItem.Parent == null);
Assert.IsTrue(pastMenuItem.Parent == null);
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 5, 299, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(!listMenu.IsOpen);
// open the menu again
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 11, 300, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(!listMenu.IsOpen);
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 11, 300, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(listMenu.IsOpen);
// select the first item
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 11, 290, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(listMenu.IsOpen);
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 11, 290, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(!listMenu.IsOpen);
Assert.IsTrue(menuSelected == "Cut");
// open the menu
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 11, 300, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(!listMenu.IsOpen);
//.........这里部分代码省略.........
示例4: DropDownListTests
public void DropDownListTests()
{
string menuSelected = "";
GuiWidget container = new GuiWidget(400, 400);
DropDownList listMenu = new DropDownList("- Select Something -", RGBA_Bytes.Black, RGBA_Bytes.Gray);
listMenu.OriginRelativeParent = new Vector2(10, 300);
MenuItem cutMenuItem = new MenuItem(new TextWidget("Cut"));
cutMenuItem.Selected += (sender, e) => { menuSelected = "Cut"; };
listMenu.MenuItems.Add(cutMenuItem);
MenuItem copyMenuItem = new MenuItem(new TextWidget("Copy"));
copyMenuItem.Selected += (sender, e) => { menuSelected = "Copy"; };
listMenu.MenuItems.Add(copyMenuItem);
MenuItem pastMenuItem = new MenuItem(new TextWidget("Paste"));
pastMenuItem.Selected += (sender, e) => { menuSelected = "Paste"; };
listMenu.MenuItems.Add(pastMenuItem);
container.AddChild(listMenu);
Assert.IsTrue(!listMenu.IsOpen);
// open the menu
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 11, 300, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(!listMenu.IsOpen);
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 11, 300, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(listMenu.IsOpen);
// click on menu again to close
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 11, 300, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 11, 300, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(!listMenu.IsOpen);
// open the menu
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 11, 300, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(!listMenu.IsOpen);
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 11, 300, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(listMenu.IsOpen);
// click off menu to close
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 5, 299, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 5, 299, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(!listMenu.IsOpen);
// open the menu
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 11, 300, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(!listMenu.IsOpen);
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 11, 300, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(listMenu.IsOpen);
// select the first item
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 11, 290, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(listMenu.IsOpen);
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 11, 290, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(!listMenu.IsOpen);
Assert.IsTrue(menuSelected == "Cut");
// open the menu
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 11, 300, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(!listMenu.IsOpen);
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 11, 300, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(listMenu.IsOpen);
// select the second item
menuSelected = "";
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 11, 275, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(listMenu.IsOpen);
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 11, 275, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(!listMenu.IsOpen);
Assert.IsTrue(menuSelected == "Copy");
// make sure click down then move off item does not select it.
menuSelected = "";
// open the menu
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 11, 300, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(!listMenu.IsOpen);
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 11, 300, 0));
UiThread.DoRunAllPending();
Assert.IsTrue(listMenu.IsOpen);
// click down on the first item
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 11, 290, 0));
UiThread.DoRunAllPending();
//.........这里部分代码省略.........
示例5: ScrollingToEndShowsEnd
public void ScrollingToEndShowsEnd()
{
GuiWidget container = new GuiWidget();
container.DoubleBuffer = true;
container.LocalBounds = new RectangleDouble(0, 0, 110, 30);
TextEditWidget editField1 = new TextEditWidget("This is a nice long text string", 0, 0, pixelWidth: 100);
container.AddChild(editField1);
TextWidget firstWordText = new TextWidget("This");
RectangleDouble bounds = firstWordText.LocalBounds;
bounds.Offset(bounds.Left, bounds.Bottom);
firstWordText.LocalBounds = bounds;
firstWordText.BackBuffer.NewGraphics2D().Clear(RGBA_Bytes.White);
firstWordText.OnDraw(firstWordText.BackBuffer.NewGraphics2D());
TextWidget lastWordText = new TextWidget("string");
bounds = lastWordText.LocalBounds;
bounds.Offset(bounds.Left, bounds.Bottom);
lastWordText.LocalBounds = bounds;
lastWordText.BackBuffer.NewGraphics2D().Clear(RGBA_Bytes.White);
lastWordText.OnDraw(lastWordText.BackBuffer.NewGraphics2D());
container.BackBuffer.NewGraphics2D().Clear(RGBA_Bytes.White);
container.BackgroundColor = RGBA_Bytes.White;
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 0, 1, 1, 0));
Assert.IsTrue(editField1.ContainsFocus == true);
container.OnDraw(container.BackBuffer.NewGraphics2D());
OutputImage(firstWordText.BackBuffer, "Control - Left.tga");
OutputImage(lastWordText.BackBuffer, "Control - Right.tga");
OutputImage(container.BackBuffer, "Test - Start.tga");
Vector2 bestPosition;
double bestLeastSquares;
container.BackBuffer.FindLeastSquaresMatch(firstWordText.BackBuffer, out bestPosition, out bestLeastSquares);
Assert.IsTrue(bestLeastSquares < 2000000);
container.BackBuffer.FindLeastSquaresMatch(lastWordText.BackBuffer, out bestPosition, out bestLeastSquares);
Assert.IsTrue(bestLeastSquares > 2000000);
SendKeyDown(Keys.End, container);
container.OnDraw(container.BackBuffer.NewGraphics2D());
OutputImage(container.BackBuffer, "Test - Scrolled.tga");
container.BackBuffer.FindLeastSquaresMatch(firstWordText.BackBuffer, out bestPosition, out bestLeastSquares);
Assert.IsTrue(bestLeastSquares > 2000000);
container.BackBuffer.FindLeastSquaresMatch(lastWordText.BackBuffer, out bestPosition, out bestLeastSquares);
Assert.IsTrue(bestLeastSquares < 2000000);
container.Close();
}
示例6: TextEditingSpecialKeysWork
public void TextEditingSpecialKeysWork()
{
{
GuiWidget container = new GuiWidget();
container.DoubleBuffer = true;
container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
TextEditWidget textEdit = new TextEditWidget("some starting text");
container.AddChild(textEdit);
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, textEdit.Height - 1, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, textEdit.Height - 1, 0));
Assert.IsTrue(textEdit.CharIndexToInsertBefore == 0);
Assert.IsTrue(textEdit.TopLeftOffset.y == 0);
Assert.IsTrue(textEdit.Text == "some starting text");
// this is to select some text
SendKey(Keys.Shift | Keys.Control | Keys.Right, ' ', container);
Assert.IsTrue(textEdit.Selection == "some ");
Assert.IsTrue(textEdit.Text == "some starting text");
// this is to prove that we don't loose the selection when pressing Control
SendKeyDown(Keys.Control, container);
Assert.IsTrue(textEdit.Selection == "some ");
Assert.IsTrue(textEdit.Text == "some starting text");
// this is to prove that we don't loose the selection when pressing Shift
SendKeyDown(Keys.Shift, container);
Assert.IsTrue(textEdit.Text == "some starting text");
Assert.IsTrue(textEdit.Selection == "some ");
SendKeyDown(Keys.Right, container);
Assert.IsTrue(textEdit.Selection == "");
SendKey(Keys.Shift | Keys.Control | Keys.Left, ' ', container);
Assert.IsTrue(textEdit.Selection == "some ");
SendKey(Keys.Delete, ' ', container);
Assert.IsTrue(textEdit.Text == "starting text");
SendKey(Keys.Shift | Keys.Control | Keys.Right, ' ', container);
Assert.IsTrue(textEdit.Selection == "starting ");
#if(!__ANDROID__)
// if this fails add
// GuiHalWidget.SetClipboardFunctions(System.Windows.Forms.Clipboard.GetText, System.Windows.Forms.Clipboard.SetText, System.Windows.Forms.Clipboard.ContainsText);
// before you call the unit tests
Clipboard.SetSystemClipboard(new WindowsFormsClipboard());
SendKey(Keys.Control | Keys.C, 'c', container);
Assert.IsTrue(textEdit.Selection == "starting ");
Assert.IsTrue(textEdit.Text == "starting text");
SendKeyDown(Keys.Right, container); // move to the right
SendKey(Keys.Control | Keys.V, 'v', container);
Assert.IsTrue(textEdit.Text == "starting starting text");
#endif
container.Close();
}
}
示例7: NumEditHandlesNonNumberChars
public void NumEditHandlesNonNumberChars()
{
{
GuiWidget container = new GuiWidget();
container.DoubleBuffer = true;
container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
NumberEdit numberEdit = new NumberEdit(0, 0, 0, 12, 200, 16, true, true);
container.AddChild(numberEdit);
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, numberEdit.Height - 1, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, numberEdit.Height - 1, 0));
Assert.IsTrue(numberEdit.CharIndexToInsertBefore == 0);
Assert.IsTrue(numberEdit.TopLeftOffset.y == 0);
// type a . (non numeric character)
SendKey(Keys.Back, ' ', container);
SendKey(Keys.Delete, ' ', container);
SendKey(Keys.OemMinus, '-', container);
Assert.IsTrue(numberEdit.Value == 0);
SendKey(Keys.OemPeriod, '.', container);
Assert.IsTrue(numberEdit.Value == 0);
SendKey(Keys.D0, '.', container);
Assert.IsTrue(numberEdit.Value == 0);
SendKey(Keys.A, 'A', container);
Assert.IsTrue(numberEdit.Value == 0);
container.Close();
}
}
示例8: MiltiLineTests
public void MiltiLineTests()
{
{
InternalTextEditWidget singleLine = new InternalTextEditWidget("test", 12, false, 0);
InternalTextEditWidget multiLine = new InternalTextEditWidget("test\ntest\ntest", 12, true, 0);
Assert.IsTrue(multiLine.Height >= singleLine.Height * 3);
}
// we get the typed results we expect
{
GuiWidget container = new GuiWidget();
container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
InternalTextEditWidget multiLine = new InternalTextEditWidget("\n\n\n\n", 12, true, 0);
container.AddChild(multiLine);
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
Assert.IsTrue(multiLine.ContainsFocus == true);
Assert.IsTrue(multiLine.SelectionIndexToStartBefore == 4);
Assert.IsTrue(multiLine.Text == "\n\n\n\n");
SendKey(Keys.A, 'a', container);
Assert.IsTrue(multiLine.Text == "\n\n\n\na");
SendKey(Keys.Up, ' ', container);
SendKey(Keys.A, 'a', container);
Assert.IsTrue(multiLine.Text == "\n\n\na\na");
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, multiLine.Height - 1, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, multiLine.Height - 1, 0));
Assert.IsTrue(multiLine.ContainsFocus == true);
Assert.IsTrue(multiLine.SelectionIndexToStartBefore == 0);
Assert.IsTrue(multiLine.Text == "\n\n\na\na");
SendKey(Keys.A, 'a', container);
Assert.IsTrue(multiLine.Text == "a\n\n\na\na");
SendKey(Keys.Down, ' ', container);
SendKey(Keys.A | Keys.Shift, 'A', container);
Assert.IsTrue(multiLine.Text == "a\nA\n\na\na");
container.Close();
}
// make sure the insert position is correct when homed
{
GuiWidget container = new GuiWidget();
container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
InternalTextEditWidget multiLine = new InternalTextEditWidget("line1\nline2\nline3", 12, true, 0);
container.AddChild(multiLine);
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 5, 1, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 5, 1, 0));
Assert.IsTrue(multiLine.ContainsFocus == true);
Assert.IsTrue(multiLine.InsertBarPosition.y == -32);
SendKey(Keys.Home, ' ', container);
Assert.IsTrue(multiLine.InsertBarPosition.y == -32);
Assert.IsTrue(multiLine.Text == "line1\nline2\nline3");
SendKey(Keys.A, 'a', container);
Assert.IsTrue(multiLine.Text == "line1\nline2\naline3");
SendKey(Keys.Back, ' ', container);
Assert.IsTrue(multiLine.Text == "line1\nline2\nline3");
Assert.IsTrue(multiLine.InsertBarPosition.y == -32);
container.Close();
}
// make sure the insert position is correct when move left to end of line
{
GuiWidget container = new GuiWidget();
container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
InternalTextEditWidget multiLine = new InternalTextEditWidget("xx", 12, true, 0);
container.AddChild(multiLine);
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
Assert.IsTrue(multiLine.ContainsFocus == true);
Assert.IsTrue(multiLine.CharIndexToInsertBefore == 0);
Assert.IsTrue(multiLine.InsertBarPosition.x == 0);
SendKey(Keys.Home, ' ', container);
Assert.IsTrue(multiLine.CharIndexToInsertBefore == 0);
Assert.IsTrue(multiLine.InsertBarPosition.x == 0);
SendKey(Keys.Right, ' ', container);
Assert.IsTrue(multiLine.CharIndexToInsertBefore == 1);
double leftOne = multiLine.InsertBarPosition.x;
SendKey(Keys.Right, ' ', container);
Assert.IsTrue(multiLine.CharIndexToInsertBefore == 2);
Assert.IsTrue(multiLine.InsertBarPosition.x == leftOne * 2);
container.Close();
}
// make sure the cursor is at the right hight when it is after a \n that is on the first line
{
GuiWidget container = new GuiWidget();
container.DoubleBuffer = true;
container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
InternalTextEditWidget multiLine = new InternalTextEditWidget("\n1\n\n3\n", 12, true, 0);
Assert.IsTrue(multiLine.LocalBounds.Height == 16 * 5);
container.AddChild(multiLine);
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, multiLine.Height - 1, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, multiLine.Height - 1, 0));
Assert.IsTrue(multiLine.CharIndexToInsertBefore == 0);
Assert.IsTrue(multiLine.InsertBarPosition.y == 0);
//.........这里部分代码省略.........
示例9: AddThenDeleteCausesNoVisualChange
public void AddThenDeleteCausesNoVisualChange()
{
GuiWidget container = new GuiWidget();
container.DoubleBuffer = true;
container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
TextEditWidget editField1 = new TextEditWidget("Test", 10, 10, pixelWidth: 50);
container.AddChild(editField1);
container.BackBuffer.NewGraphics2D().Clear(RGBA_Bytes.White);
container.OnDraw(container.BackBuffer.NewGraphics2D());
ImageBuffer beforeEditImage = new ImageBuffer(container.BackBuffer);
RectangleDouble beforeLocalBounds = editField1.LocalBounds;
Vector2 beforeOrigin = editField1.OriginRelativeParent;
OutputImage(beforeEditImage, "z text un-edited.tga");
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 10, 10, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 10, 10, 0));
Assert.IsTrue(editField1.ContainsFocus == true);
SendKey(Keys.B, 'b', container);
Assert.IsTrue(editField1.Text == "bTest", "It should have b a in it.");
RectangleDouble afterBLocalBounds = editField1.LocalBounds;
Assert.IsTrue(beforeLocalBounds.Bottom == afterBLocalBounds.Bottom && beforeLocalBounds.Top == afterBLocalBounds.Top);
SendKey(Keys.Back, ' ', container);
Assert.IsTrue(editField1.Text == "Test", "It should not have b a in it.");
RectangleDouble afterLocalBounds = editField1.LocalBounds;
Vector2 afterOrigin = editField1.OriginRelativeParent;
Assert.IsTrue(beforeLocalBounds == afterLocalBounds);
Assert.IsTrue(beforeOrigin == afterOrigin);
// click off it so the cursor is not in it.
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
Assert.IsTrue(editField1.Focused == false);
container.BackBuffer.NewGraphics2D().Clear(RGBA_Bytes.White);
container.OnDraw(container.BackBuffer.NewGraphics2D());
OutputImage(container.BackBuffer, "z text edited.tga");
Assert.IsTrue(container.BackBuffer == beforeEditImage);
}
示例10: TextEditGetsFocusTests
public void TextEditGetsFocusTests()
{
GuiWidget container = new GuiWidget();
container.Name = "container";
container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
TextEditWidget editField1 = new TextEditWidget("", 0, 0, pixelWidth: 160);
editField1.Name = "editField1";
container.AddChild(editField1);
TextEditWidget editField2 = new TextEditWidget("", 0, 20, pixelWidth: 160);
editField2.Name = "editField2";
container.AddChild(editField2);
// select no edit field
Assert.IsTrue(editField1.Text == "");
SendKey(Keys.D, 'a', container);
Assert.IsTrue(editField1.Text == "");
Assert.IsTrue(editField2.Text == "");
// select edit field 1
container.OnMouseMove(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0)); // we move into the widget to make sure we have seprated focus and enter events.
Assert.IsTrue(editField1.ContainsFocus == false);
Assert.IsTrue(editField1.Focused == false);
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
Assert.IsTrue(editField1.ContainsFocus == true);
Assert.IsTrue(editField1.Focused == false, "The internal text widget must be focused.");
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
Assert.IsTrue(editField1.ContainsFocus == true);
Assert.IsTrue(editField1.Focused == false);
SendKey(Keys.B, 'b', container);
Assert.IsTrue(editField1.Text == "b", "It should have b a in it.");
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 150, 1, 0));
Assert.IsTrue(editField1.ContainsFocus == true);
Assert.IsTrue(editField1.Focused == false, "The internal text widget must be focused.");
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 150, 1, 0));
Assert.IsTrue(editField1.ContainsFocus == true);
Assert.IsTrue(editField1.Focused == false);
SendKey(Keys.D, 'c', container);
Assert.IsTrue(editField1.Text == "bc", "It should have b a in it.");
// select edit field 2
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, 21, 0));
Assert.IsTrue(editField2.ContainsFocus == true);
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, 21, 0));
SendKey(Keys.D, 'd', container);
Assert.IsTrue(editField1.Text == "bc", "It should have a bc in it.");
Assert.IsTrue(editField2.Text == "d", "It should have d in it.");
container.Close();
}
示例11: TextChangedEventsTests
public void TextChangedEventsTests()
{
GuiWidget container = new GuiWidget();
container.Name = "container";
container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
TextEditWidget editField1 = new TextEditWidget("", 0, 0, pixelWidth: 20);
editField1.Name = "editField1";
Assert.IsTrue(editField1.BoundsRelativeToParent.Top < 40, "We make this assumption in the code below, so make sure it's true.");
bool textField1EditComplete = false;
editField1.EditComplete += (sender, e) => { textField1EditComplete = true; };
bool textField1LostFocus = false;
editField1.LostFocus += (sender, e) => { textField1LostFocus = true; };
bool textField1GotFocus = false;
editField1.GotFocus += (sender, e) => { textField1GotFocus = true; };
container.AddChild(editField1);
TextEditWidget editField2 = new TextEditWidget("", 0, 40, pixelWidth: 20);
editField2.Name = "editField2";
container.AddChild(editField2);
// mouse select on the control when it contains nothing
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 0, 1, 1, 0));
Assert.IsTrue(textField1GotFocus);
Assert.IsFalse(textField1EditComplete);
SendKey(Keys.B, 'b', container);
Assert.IsTrue(editField1.Text == "b");
Assert.IsFalse(textField1EditComplete, "We do not change with each keystroke.");
SendKey(Keys.Enter, '\n', container);
Assert.IsTrue(textField1EditComplete, "Enter must send a EditComplete if changed.");
textField1EditComplete = false;
SendKey(Keys.A, 'a', container);
Assert.IsTrue(editField1.Text == "ba");
Assert.IsFalse(textField1EditComplete, "We do not change with each keystroke.");
Assert.IsFalse(textField1LostFocus);
textField1GotFocus = false;
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, 41, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 0, 1, 1, 0));
SendKey(Keys.E, 'e', container);
Assert.IsTrue(textField1LostFocus);
Assert.IsTrue(textField1EditComplete, "Loosing focus should send a text changed.");
Assert.IsTrue(editField1.Text == "ba");
Assert.IsTrue(editField2.Text == "e");
textField1EditComplete = false;
textField1LostFocus = false;
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 0, 1, 1, 0));
Assert.IsFalse(textField1LostFocus);
Assert.IsFalse(textField1EditComplete);
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, 41, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 0, 1, 1, 0));
Assert.IsTrue(textField1LostFocus);
Assert.IsFalse(textField1EditComplete, "The text did not change even though we lost focus we should not call textChanged.");
container.Close();
}
示例12: MouseCapturedSpressesLeaveEvents
public void MouseCapturedSpressesLeaveEvents()
{
GuiWidget container = new GuiWidget();
container.Name = "continer";
container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
GuiWidget regionA = new GuiWidget();
regionA.Name = "regionA";
regionA.BoundsRelativeToParent = new RectangleDouble(10, 10, 190, 190);
container.AddChild(regionA);
int aGotEnter = 0;
int aGotLeave = 0;
int aGotEnterBounds = 0;
int aGotLeaveBounds = 0;
int aGotMove = 0;
int aGotUp = 0;
regionA.MouseEnter += (sender, e) => { if (regionA.UnderMouseState == UnderMouseState.NotUnderMouse) throw new Exception("It must be under the mouse."); aGotEnter++; };
regionA.MouseLeave += (sender, e) => { if (regionA.UnderMouseState == UnderMouseState.FirstUnderMouse) throw new Exception("It must not be under the mouse."); aGotLeave++; };
regionA.MouseEnterBounds += (sender, e) => { if (regionA.UnderMouseState == UnderMouseState.NotUnderMouse) throw new Exception("It must be under the mouse."); aGotEnterBounds++; };
regionA.MouseLeaveBounds += (sender, e) => { if (regionA.UnderMouseState != UnderMouseState.NotUnderMouse) throw new Exception("It must not be under the mouse."); aGotLeaveBounds++; };
regionA.MouseMove += (sender, e) => { aGotMove++; };
regionA.MouseUp += (sender, e) => { aGotUp++; };
// make sure we know we are entered and captued on a down event
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 15, 15, 0));
Assert.IsTrue(regionA.FirstWidgetUnderMouse == true);
Assert.IsTrue(regionA.MouseCaptured == true);
Assert.IsTrue(aGotEnter == 1);
Assert.IsTrue(aGotLeave == 0);
Assert.IsTrue(aGotEnterBounds == 1);
Assert.IsTrue(aGotLeaveBounds == 0);
Assert.IsTrue(aGotMove == 0);
// make sure we stay on top when internal moves occure
aGotEnter = aGotLeave = aGotEnterBounds = aGotLeaveBounds = aGotMove = 0;
container.OnMouseMove(new MouseEventArgs(MouseButtons.Left, 1, 16, 16, 0));
Assert.IsTrue(regionA.FirstWidgetUnderMouse == true);
Assert.IsTrue(regionA.MouseCaptured == true);
Assert.IsTrue(aGotEnter == 0);
Assert.IsTrue(aGotLeave == 0);
Assert.IsTrue(aGotEnterBounds == 0);
Assert.IsTrue(aGotLeaveBounds == 0);
Assert.IsTrue(aGotMove == 1);
// make sure we see leave events when captured
aGotUp = aGotEnter = aGotLeave = aGotEnterBounds = aGotLeaveBounds = aGotMove = 0;
container.OnMouseMove(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
Assert.IsTrue(container.FirstWidgetUnderMouse == false);
Assert.IsTrue(regionA.FirstWidgetUnderMouse == false);
Assert.IsTrue(regionA.MouseCaptured == true);
Assert.IsTrue(aGotEnter == 0);
Assert.IsTrue(aGotLeave == 1);
Assert.IsTrue(aGotEnterBounds == 0);
Assert.IsTrue(aGotLeaveBounds == 1);
Assert.IsTrue(aGotMove == 1);
// make sure we see enter events when captured
aGotUp = aGotEnter = aGotLeave = aGotEnterBounds = aGotLeaveBounds = aGotMove = 0;
container.OnMouseMove(new MouseEventArgs(MouseButtons.Left, 1, 15, 15, 0));
Assert.IsTrue(regionA.FirstWidgetUnderMouse == true);
Assert.IsTrue(regionA.MouseCaptured == true);
Assert.IsTrue(aGotEnter == 1);
Assert.IsTrue(aGotLeave == 0);
Assert.IsTrue(aGotEnterBounds == 1);
Assert.IsTrue(aGotLeaveBounds == 0);
Assert.IsTrue(aGotMove == 1);
// and we are not captured after mouseup above region
aGotUp = aGotEnter = aGotLeave = aGotEnterBounds = aGotLeaveBounds = aGotMove = 0;
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 15, 15, 0));
Assert.IsTrue(regionA.MouseCaptured == false);
Assert.IsTrue(aGotEnter == 0);
Assert.IsTrue(aGotLeave == 0);
Assert.IsTrue(aGotEnterBounds == 0);
Assert.IsTrue(aGotLeaveBounds == 0);
Assert.IsTrue(aGotMove == 0);
Assert.IsTrue(aGotUp == 1, "When we are captured we need to see mouse up messages.");
// make sure we are not captured after mouseup above off region
aGotUp = aGotEnter = aGotLeave = aGotEnterBounds = aGotLeaveBounds = aGotMove = 0;
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 15, 15, 0));
Assert.IsTrue(regionA.MouseCaptured == true);
Assert.IsTrue(aGotEnter == 0, "we are already in the button from the last move");
Assert.IsTrue(aGotLeave == 0);
Assert.IsTrue(aGotEnterBounds == 0, "we are already in the button from the last move");
Assert.IsTrue(aGotLeaveBounds == 0);
Assert.IsTrue(aGotMove == 0);
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
Assert.IsTrue(regionA.MouseCaptured == false);
Assert.IsTrue(aGotEnter == 0);
Assert.IsTrue(aGotLeave == 1, "During the mouse up we also happen to be off the widget. Need to get a mouse leave event.");
Assert.IsTrue(aGotEnterBounds == 0);
Assert.IsTrue(aGotLeaveBounds == 1, "During the mouse up we also happen to be off the widget. Need to get a mouse leave event.");
Assert.IsTrue(aGotMove == 0);
Assert.IsTrue(aGotUp == 1, "When we are captured we need to see mouse up messages.");
// when captured make sure we see move events even when they are not above us.
GuiWidget regionB = new GuiWidget();
regionB.Name = "regionB";
regionB.BoundsRelativeToParent = new RectangleDouble(20, 20, 180, 180);
//.........这里部分代码省略.........
示例13: ValidateOnlyTopWidgetGetsLeftClick
public void ValidateOnlyTopWidgetGetsLeftClick()
{
bool gotClick = false;
GuiWidget container = new GuiWidget();
container.Name = "container";
container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
Button button = new Button("Test", 100, 100);
button.Name = "button";
button.Click += (sender, e) => { gotClick = true; };
container.AddChild(button);
GuiWidget blockingWidegt = new GuiWidget();
blockingWidegt.Name = "blockingWidegt";
blockingWidegt.LocalBounds = new RectangleDouble(105, 105, 125, 125);
container.AddChild(blockingWidegt);
// the widget is not in the way
Assert.IsTrue(gotClick == false);
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 101, 101, 0));
Assert.IsTrue(container.MouseCaptured == false);
Assert.IsTrue(blockingWidegt.MouseCaptured == false);
Assert.IsTrue(container.ChildHasMouseCaptured == true);
Assert.IsTrue(blockingWidegt.ChildHasMouseCaptured == false);
Assert.IsTrue(button.MouseCaptured == true);
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 101, 101, 0));
Assert.IsTrue(container.MouseCaptured == false);
Assert.IsTrue(blockingWidegt.MouseCaptured == false);
Assert.IsTrue(button.MouseCaptured == false);
Assert.IsTrue(gotClick == true);
gotClick = false;
// the widget is in the way
Assert.IsTrue(gotClick == false);
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 110, 110, 0));
Assert.IsTrue(container.MouseCaptured == false);
Assert.IsTrue(blockingWidegt.MouseCaptured == true);
Assert.IsTrue(button.MouseCaptured == false);
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 110, 110, 0));
Assert.IsTrue(container.MouseCaptured == false);
Assert.IsTrue(blockingWidegt.MouseCaptured == false);
Assert.IsTrue(button.MouseCaptured == false);
Assert.IsTrue(gotClick == false);
}
示例14: ValidateOnlyTopWidgetGetsMouseUp
public void ValidateOnlyTopWidgetGetsMouseUp()
{
bool topGotMouseUp = false;
GuiWidget container = new GuiWidget();
container.Name = "container";
container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
GuiWidget topWidget = new GuiWidget();
topWidget.Name = "topWidget";
topWidget.LocalBounds = new RectangleDouble(100, 100, 150, 150);
topWidget.MouseUp += (sender, e) => { topGotMouseUp = true; };
container.AddChild(topWidget);
bool blockingGotMouseUp = false;
GuiWidget blockingWidegt = new GuiWidget();
blockingWidegt.Name = "blockingWidegt";
blockingWidegt.MouseUp += (sender, e) => { blockingGotMouseUp = true; };
blockingWidegt.LocalBounds = new RectangleDouble(105, 105, 125, 125);
container.AddChild(blockingWidegt);
// the widget is not in the way
Assert.IsTrue(topGotMouseUp == false);
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 101, 101, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 101, 101, 0));
Assert.IsTrue(blockingGotMouseUp == false);
Assert.IsTrue(topGotMouseUp == true);
topGotMouseUp = false;
// the widget is in the way
Assert.IsTrue(topGotMouseUp == false);
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 110, 110, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 110, 110, 0));
Assert.IsTrue(blockingGotMouseUp == true);
Assert.IsTrue(topGotMouseUp == false);
}
示例15: ValidateSimpleMouseUpDown
public void ValidateSimpleMouseUpDown()
{
GuiWidget container = new GuiWidget();
container.Name = "container";
int containerGotMouseUp = 0;
int containerGotMouseDown = 0;
int containerGotMouseDownInBounds = 0;
container.MouseUp += (sender, e) => { containerGotMouseUp++; };
container.MouseDown += (sender, e) => { containerGotMouseDown++; };
container.MouseDownInBounds += (sender, e) => { containerGotMouseDownInBounds++; };
container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
GuiWidget topWidget = new GuiWidget();
topWidget.Name = "topWidget";
topWidget.LocalBounds = new RectangleDouble(100, 100, 150, 150);
int topWidgetGotMouseUp = 0;
int topWidgetGotMouseDown = 0;
int topWidgetGotMouseDownInBounds = 0;
topWidget.MouseUp += (sender, e) => { topWidgetGotMouseUp++; };
topWidget.MouseDown += (sender, e) => { topWidgetGotMouseDown++; };
topWidget.MouseDownInBounds += (sender, e) => { topWidgetGotMouseDownInBounds++; };
container.AddChild(topWidget);
Assert.IsTrue(containerGotMouseUp == 0);
Assert.IsTrue(topWidgetGotMouseUp == 0);
// down outside everything
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, -10, -10, 0));
Assert.IsTrue(containerGotMouseUp == 0);
Assert.IsTrue(topWidgetGotMouseUp == 0);
Assert.IsTrue(containerGotMouseDown == 0);
Assert.IsTrue(topWidgetGotMouseDown == 0);
Assert.IsTrue(containerGotMouseDownInBounds == 0);
Assert.IsTrue(topWidgetGotMouseDownInBounds == 0);
topWidgetGotMouseUp = topWidgetGotMouseDown = topWidgetGotMouseDownInBounds = 0;
containerGotMouseDown = containerGotMouseUp = containerGotMouseDownInBounds = 0;
// up outside everything
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, -10, -10, 0));
Assert.IsTrue(containerGotMouseUp == 0);
Assert.IsTrue(topWidgetGotMouseUp == 0);
Assert.IsTrue(containerGotMouseDown == 0);
Assert.IsTrue(topWidgetGotMouseDown == 0);
Assert.IsTrue(containerGotMouseDownInBounds == 0);
Assert.IsTrue(topWidgetGotMouseDownInBounds == 0);
topWidgetGotMouseUp = topWidgetGotMouseDown = topWidgetGotMouseDownInBounds = 0;
containerGotMouseDown = containerGotMouseUp = containerGotMouseDownInBounds = 0;
// down on tontainer
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 10, 10, 0));
Assert.IsTrue(containerGotMouseUp == 0);
Assert.IsTrue(topWidgetGotMouseUp == 0);
Assert.IsTrue(containerGotMouseDown == 1);
Assert.IsTrue(topWidgetGotMouseDown == 0);
Assert.IsTrue(containerGotMouseDownInBounds == 1);
Assert.IsTrue(topWidgetGotMouseDownInBounds == 0);
topWidgetGotMouseUp = topWidgetGotMouseDown = topWidgetGotMouseDownInBounds = 0;
containerGotMouseDown = containerGotMouseUp = containerGotMouseDownInBounds = 0;
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 10, 10, 0));
Assert.IsTrue(containerGotMouseUp == 1);
Assert.IsTrue(topWidgetGotMouseUp == 0);
Assert.IsTrue(containerGotMouseDown == 0);
Assert.IsTrue(topWidgetGotMouseDown == 0);
Assert.IsTrue(containerGotMouseDownInBounds == 0);
Assert.IsTrue(topWidgetGotMouseDownInBounds == 0);
topWidgetGotMouseUp = topWidgetGotMouseDown = topWidgetGotMouseDownInBounds = 0;
containerGotMouseDown = containerGotMouseUp = containerGotMouseDownInBounds = 0;
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 110, 110, 0));
Assert.IsTrue(containerGotMouseUp == 0);
Assert.IsTrue(topWidgetGotMouseUp == 0);
Assert.IsTrue(containerGotMouseDown == 0);
Assert.IsTrue(topWidgetGotMouseDown == 1);
Assert.IsTrue(containerGotMouseDownInBounds == 1);
Assert.IsTrue(topWidgetGotMouseDownInBounds == 1);
topWidgetGotMouseUp = topWidgetGotMouseDown = topWidgetGotMouseDownInBounds = 0;
containerGotMouseDown = containerGotMouseUp = containerGotMouseDownInBounds = 0;
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 10, 10, 0));
Assert.IsTrue(containerGotMouseUp == 0);
Assert.IsTrue(topWidgetGotMouseUp == 1);
Assert.IsTrue(containerGotMouseDown == 0);
Assert.IsTrue(topWidgetGotMouseDown == 0);
Assert.IsTrue(containerGotMouseDownInBounds == 0);
Assert.IsTrue(topWidgetGotMouseDownInBounds == 0);
topWidgetGotMouseUp = topWidgetGotMouseDown = topWidgetGotMouseDownInBounds = 0;
containerGotMouseDown = containerGotMouseUp = containerGotMouseDownInBounds = 0;
container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 110, 110, 0));
container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 110, 110, 0));
Assert.IsTrue(containerGotMouseUp == 0);
Assert.IsTrue(topWidgetGotMouseUp == 1);
Assert.IsTrue(containerGotMouseDown == 0);
Assert.IsTrue(topWidgetGotMouseDown == 1);
Assert.IsTrue(containerGotMouseDownInBounds == 1);
Assert.IsTrue(topWidgetGotMouseDownInBounds == 1);
}