-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 simple gui test #3399
Add simple gui test #3399
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 to me! Interesting way. What if I execute it locally, will it be visble or headless as well?
Please mark it with GUI Test category
And please have a look at the errors, you need a BasePanel |
I think, it does not need any XServer running etc? Thus, I lean towards not including it in our existing GUI tests, but eitehr keep it in the main testing block or create a new category javafxguitests. |
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.
LGTM. Also using +
for the minr versions is OK for me. With the hope, that the testfx-guys really use semantic versioning ^^.
public void start(Stage stage) throws Exception { | ||
area = new CodeArea(); | ||
area.appendText("some example\n text to go here\n across a couple of \n lines...."); | ||
sourceTab = new SourceTab(new BibDatabaseContext(), new LatexFieldFormatterPreferences()); |
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.
The Argument CountingUndoManager is missing in the signature of this test. I have tried to add it by simply adding new CountingUndoManager()
, but then the test fails. Can you have a look at it?
It now compiles. However, I need to use the preferences in the test and thus had to add an exception to the architecture tests. Since this is often a critical area of discussion, I would like to have another reviewers' ok before merging. Thanks. |
@@ -71,7 +73,7 @@ private static String getSourceString(BibEntry entry, BibDatabaseMode type, Late | |||
private CodeArea createSourceEditor() { | |||
CodeArea codeArea = new CodeArea(); | |||
codeArea.setWrapText(true); | |||
codeArea.lookup(".styled-text-area").setStyle("-fx-font-size: " + Globals.prefs.getFontSizeFX() + "pt;"); | |||
codeArea.lookup(".styled-text-area").setStyle("-fx-font-size: " + preferences.getFontSizeFX() + "pt;"); |
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.
Why not pass the font size directly as int parameter? Would also work for test
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.
That would work but there are 2 other accesses to the preferences. Thus 3 new constructor arguments just to get rid of the preference class seems a bit too much for me.
As before, I need this PR to continue working on the javafx migration of the maintable. Thus I merge this now but, of course, implement further feedback on how to improve the code. (For some reason the build on travis does not started for the merge commit...but it was green before..so hopefully the build still passes). |
This PR adds a simple GUI test for the source editor, which I used to track down the index of out bounds exception. It uses TestFX, which seems to be a good framework for javafx gui tests. For example, it is possible to run the unit tests in a headless method - thus allowing it to run on travis. For me, the biggest advantage is that you can isolate different parts of the system (i.e. only add the source tab) and ignore the rest of the application. Thus you can write "unit tests for ui".
Disclaimer: I will not invest any more work in these gui tests. But since some of you were quite in favor of having a gui test suite, I thought I share with you what I have so far.
gradle localizationUpdate
?