Skip to content
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

v1-MouseClick should be invoked only once on a mouse click. #3318

Closed
BDisp opened this issue Mar 13, 2024 · 0 comments · Fixed by #3320
Closed

v1-MouseClick should be invoked only once on a mouse click. #3318

BDisp opened this issue Mar 13, 2024 · 0 comments · Fixed by #3320
Labels
bug v1 For Issues & PRs targetting v1.x

Comments

@BDisp
Copy link
Collaborator

BDisp commented Mar 13, 2024

This unit test fails because it returns 3 clicks (1 for button pressed, 1 for button released and 1 for button click). As the event suggest this event is for to be used on a click event and not for any mouse event.

		[Fact]
		public void OnMouseClick_Is_Only_Fired_Once ()
		{
			var mouseClicks = 0;
			var view = new View ();
			view.MouseClick += (_) => mouseClicks++;

			view.OnMouseEvent (new MouseEvent () { Flags = MouseFlags.Button1Pressed });
			view.OnMouseEvent (new MouseEvent () { Flags = MouseFlags.Button1Released });
			view.OnMouseEvent (new MouseEvent () { Flags = MouseFlags.Button1Clicked });

			Assert.Equal (1, mouseClicks);
		}
BDisp added a commit to BDisp/Terminal.Gui that referenced this issue Mar 13, 2024
@tig tig added bug v1 For Issues & PRs targetting v1.x labels Mar 14, 2024
@tig tig closed this as completed in #3320 Mar 16, 2024
tig added a commit that referenced this issue Mar 16, 2024
Fixes #3318. v1-MouseClick should be invoked only once on a mouse click.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug v1 For Issues & PRs targetting v1.x
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants