Styling: use TestUtils.setup() in unit tests;

This commit is contained in:
Karl Tauber
2021-07-05 21:58:48 +02:00
parent 9cfd4d27e9
commit 4a8207f367
2 changed files with 25 additions and 32 deletions

View File

@@ -25,9 +25,9 @@ import java.util.Map;
import java.util.function.Consumer;
import javax.swing.*;
import javax.swing.table.JTableHeader;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import com.formdev.flatlaf.FlatLightLaf;
import com.formdev.flatlaf.icons.*;
/**
@@ -37,7 +37,12 @@ public class TestFlatStyling
{
@BeforeAll
static void setup() {
FlatLightLaf.setup();
TestUtils.setup( false );
}
@AfterAll
static void cleanup() {
TestUtils.cleanup();
}
@Test

View File

@@ -29,6 +29,8 @@ import javax.swing.UIManager;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.basic.BasicTextFieldUI;
import javax.swing.text.JTextComponent;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
/**
@@ -36,58 +38,44 @@ import org.junit.jupiter.api.Test;
*/
public class TestFlatTextComponents
{
@BeforeAll
static void setup() {
TestUtils.setup( false );
}
@AfterAll
static void cleanup() {
TestUtils.cleanup();
}
@Test
void editorPane_updateBackground() {
textComponent_updateBackground( "EditorPane", () -> {
JEditorPane c = new JEditorPane();
c.setUI( new FlatEditorPaneUI() );
return c;
} );
textComponent_updateBackground( "EditorPane", JEditorPane::new );
}
@Test
void formattedTextField_updateBackground() {
textComponent_updateBackground( "FormattedTextField", () -> {
JFormattedTextField c = new JFormattedTextField();
c.setUI( new FlatFormattedTextFieldUI() );
return c;
} );
textComponent_updateBackground( "FormattedTextField", JFormattedTextField::new );
}
@Test
void passwordField_updateBackground() {
textComponent_updateBackground( "PasswordField", () -> {
JPasswordField c = new JPasswordField();
c.setUI( new FlatPasswordFieldUI() );
return c;
} );
textComponent_updateBackground( "PasswordField", JPasswordField::new );
}
@Test
void textArea_updateBackground() {
textComponent_updateBackground( "TextArea", () -> {
JTextArea c = new JTextArea();
c.setUI( new FlatTextAreaUI() );
return c;
} );
textComponent_updateBackground( "TextArea", JTextArea::new );
}
@Test
void textField_updateBackground() {
textComponent_updateBackground( "TextField", () -> {
JTextField c = new JTextField();
c.setUI( new FlatTextFieldUI() );
return c;
} );
textComponent_updateBackground( "TextField", JTextField::new );
}
@Test
void textPane_updateBackground() {
textComponent_updateBackground( "TextPane", () -> {
JTextPane c = new JTextPane();
c.setUI( new FlatTextPaneUI() );
return c;
} );
textComponent_updateBackground( "TextPane", JTextPane::new );
}
@Test