-
Notifications
You must be signed in to change notification settings - Fork 31
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
Add UI elements for textual filtering of tests #1166
Conversation
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.
Looks good. I'm suggesting one change in the textbox element for consistency within the set of ui elements.
/// - show a PlaceHoder text if there's no text input | ||
/// - Invoke the SelectionChanged event as soon as no further input is made within a short period of time. | ||
/// </summary> | ||
public class TextBoxElement : ISelection |
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.
ISelection seems like an odd interface to use here, since there are no choices from which to select. Do we need an IChanged interface? Also, why not inherit from ToolStripElement, the base class for such elements?
I think I opted the
I'll prepare a commit for this one. I also thought again about inheriting the class from ToolStripElement: that'll work of course now. However I plan to reuse this |
…in class TextBoxElement
This commit adds a new interface IChanged and use this interface instead of ISelection in class TextBoxElement. |
Regarding this idea...
I first created the UI Elements to encapsulate various kinds of controls under the NUnit V2 GUI. For TestCentric, I wanted to use more modern UI components that had been introduced into Windows. The Windows Forms One side issue... in Windows Forms, there is a third hierarchy based on I think it's best to keep this structure of two hierarchies using some common functional interfaces, which are not connected with UI appearance at all. For example, UPDATE I was initially confused because you had referred to your filterTextBox as a Control. I see now that it's a ToolStripItem and is on the other side of the hierarchy split from what I first thought. Windows ToolStripTextBox is, of course a specialized ToolStripControlHost, containing a textbox. I think we should be careful about keeping the split between elements that represent ToolStripItems and those that represent Controls, but it's possible to do what you suggest by moving some of the specialized functiondown into the control itself. Let's not do it till it's needed however. :-) |
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.
This looks good to me. Suggestions are optional, just let me know what you do.
/// - show a PlaceHoder text if there's no text input | ||
/// - Invoke the Changed event as soon as no further input is made within a short period of time. | ||
/// </summary> | ||
public class TextBoxElement : IChanged |
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.
public class TextBoxElement : IChanged | |
public class ToolStripTextBoxElement : ToolStripElement, IChanged |
ToolStripElement already implements many of the basic properties. Suggested name change is consistent with our naming of other tool strip elements.
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.
Ok, you've convinced me 👍 !
I will rename this class to ToolStripTextBoxElement and derive it from base class ToolStripElement.
TextBox.Focus(); | ||
} | ||
} | ||
} |
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.
Is the timeout strictly necessary? I'm fairly accustomed to controls that do nothing until I tab away or otherwise change focus.
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.
This 'timeout' feature is definitely just a gimmick and not absolutely necessary.
When I was working with the text filters, I found it helpful that the results were displayed quickly without additional key stroke. And that I can continue typing immediately if I wasn't satisfied with the result. That's why I had the idea of introducing this timer. Of course, this is not a brand new idea, but some other programs use this in their search as well. So from my point of view it's beneficial for the user and I prefer to keept this feature. But of course we can remove it, if users are annoying by this feature...
Thanks for the explanation of the two derivation hierarchies: |
…m base class ToolStripElement
This PR contributes to issue #1161 by adding a Textbox in the Filter ToolStrip to enable the textual filtering of tests.
![](https://private-user-images.githubusercontent.com/59574371/397247849-57a96c10-60de-4944-9235-2f5f03aa4477.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NzczMTcsIm5iZiI6MTczOTU3NzAxNywicGF0aCI6Ii81OTU3NDM3MS8zOTcyNDc4NDktNTdhOTZjMTAtNjBkZS00OTQ0LTkyMzUtMmY1ZjAzYWE0NDc3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE0VDIzNTAxN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBmOGNjYTk5NDZlMzg2NDk5YjBiNzBmNDRkOWI5ZTgxY2VlY2U3YjcwODRhNzcwYTI0YTFhYTExYmNjYjRjMjEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.3JeL19DOem7cA4YCEp725QYMQ-ktPTRPMaJvKezApUg)
Here's a screenshot:
Here's a list of the functionality:
Not included:
Technical view:
The main contribution of this commit are the two new UI classes
StretchToolStripTextBox
andTextBoxElement
.The class
StretchToolStripTextBox
is only required to stretch the TextBox in the ToolStrip over the complete width. Without this implementation the TextBox width will remain fixed (for example 200 pixel). I'm glad that I found this solution in the microsoft documentation.The class
TextBoxElement
handles the TextBox input. It implements the ISelection interface so that the presenter class don't depent on any UI elements, but just use the ISelection.SelectedItem and ISelection.SelectionChanged event.