FSchumacher commented on a change in pull request #696:
URL: https://github.com/apache/jmeter/pull/696#discussion_r793001407
##########
File path:
src/core/src/test/java/org/apache/jmeter/gui/util/JSyntaxTextAreaTest.java
##########
@@ -41,7 +45,37 @@ public void testSetLanguage() {
textArea.setLanguage(null);
assertEquals(SyntaxConstants.SYNTAX_STYLE_NONE,
textArea.getSyntaxEditingStyle());
} catch (HeadlessException he) {
- // Does not work in headless mode
+ // Does not work in headless mode, which depends on value of
java.awt.headless property
+ // and the OS (e.g. might work on MacOS and not on Linux due to
missing X11).
+ System.out.println("WARNING for
JSyntaxTextAreaTest.testSetLanguage test: does not work in headless mode");
+ }
+ }
+
+ @Test
+ public void testHeadless() {
+ String key = "java.awt.headless";
+ String initialValue = System.getProperty(key);
+ try {
+ System.setProperty(key, "true");
+ // getInstance returns anonymous class with some overridden methods
+ // to avoid errors due to 'java.awt.headless=true'
+ JSyntaxTextArea textArea = JSyntaxTextArea.getInstance(10,20);
+
+ String myText = "my text";
+ textArea.setText(myText);
Review comment:
Right, but why the call ` textArea.setCodeFoldingEnabled(true);`? It
seems that you want to test, that we get a special variant, that works in
headless mode. But in my eyes, you know, that it works in headless mode (or
could not check it anyway) and this test is about saving the text. One test
should assert one thing (at least new ones should :))
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]