Testing: introduced client property to exclude components in FlatTestFrame.updateComponentsRecur()

This commit is contained in:
Karl Tauber
2022-09-11 14:17:55 +02:00
parent bcd7a7e3dd
commit cbd80252ed
13 changed files with 41 additions and 2 deletions

View File

@@ -556,6 +556,7 @@ public class FlatComponents2Test
//======== panel1 ========
{
panel1.putClientProperty("FlatLaf.internal.testing.ignore", true);
panel1.setLayout(new MigLayout(
"ltr,insets 0,hidemode 3",
// columns
@@ -598,6 +599,7 @@ public class FlatComponents2Test
//======== panel3 ========
{
panel3.putClientProperty("FlatLaf.internal.testing.ignore", true);
panel3.setLayout(new MigLayout(
"insets 0,hidemode 3",
// columns
@@ -634,6 +636,7 @@ public class FlatComponents2Test
//======== panel2 ========
{
panel2.putClientProperty("FlatLaf.internal.testing.ignore", true);
panel2.setLayout(new MigLayout(
"insets 0,hidemode 3",
// columns
@@ -766,6 +769,7 @@ public class FlatComponents2Test
//======== panel5 ========
{
panel5.setBorder(new TitledBorder("General Control"));
panel5.putClientProperty("FlatLaf.internal.testing.ignore", true);
panel5.setLayout(new MigLayout(
"hidemode 3",
// columns
@@ -785,6 +789,7 @@ public class FlatComponents2Test
//======== treeOptionsPanel ========
{
treeOptionsPanel.setBorder(new TitledBorder("JTree Control"));
treeOptionsPanel.putClientProperty("FlatLaf.internal.testing.ignore", true);
treeOptionsPanel.setLayout(new MigLayout(
"hidemode 3",
// columns
@@ -832,6 +837,7 @@ public class FlatComponents2Test
//======== tableOptionsPanel ========
{
tableOptionsPanel.setBorder(new TitledBorder("JTable Control"));
tableOptionsPanel.putClientProperty("FlatLaf.internal.testing.ignore", true);
tableOptionsPanel.setLayout(new MigLayout(
"hidemode 3",
// columns

View File

@@ -37,6 +37,7 @@ new FormModel {
"$layoutConstraints": "ltr,insets 0,hidemode 3"
} ) {
name: "panel1"
"$client.FlatLaf.internal.testing.ignore": true
add( new FormComponent( "javax.swing.JLabel" ) {
name: "listLabel"
"text": "JList:"
@@ -97,6 +98,7 @@ new FormModel {
"$rowConstraints": "[][grow][][]"
} ) {
name: "panel3"
"$client.FlatLaf.internal.testing.ignore": true
add( new FormComponent( "javax.swing.JLabel" ) {
name: "tableLabel"
"text": "JTable:"
@@ -147,6 +149,7 @@ new FormModel {
"$rowConstraints": "[][grow][][]"
} ) {
name: "panel2"
"$client.FlatLaf.internal.testing.ignore": true
add( new FormComponent( "javax.swing.JLabel" ) {
name: "treeLabel"
"text": "JTree:"
@@ -301,6 +304,7 @@ new FormModel {
} ) {
name: "panel5"
"border": new javax.swing.border.TitledBorder( "General Control" )
"$client.FlatLaf.internal.testing.ignore": true
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "dndCheckBox"
"text": "enable drag and drop"
@@ -322,6 +326,7 @@ new FormModel {
} ) {
name: "treeOptionsPanel"
"border": new javax.swing.border.TitledBorder( "JTree Control" )
"$client.FlatLaf.internal.testing.ignore": true
add( new FormComponent( "javax.swing.JLabel" ) {
name: "treeRendererLabel"
"text": "Renderer:"
@@ -387,6 +392,7 @@ new FormModel {
} ) {
name: "tableOptionsPanel"
"border": new javax.swing.border.TitledBorder( "JTable Control" )
"$client.FlatLaf.internal.testing.ignore": true
add( new FormComponent( "javax.swing.JLabel" ) {
name: "autoResizeModeLabel"
"text": "Auto resize mode:"

View File

@@ -1219,6 +1219,7 @@ public class FlatComponentsTest
//======== panel5 ========
{
panel5.setBorder(new TitledBorder("Control"));
panel5.putClientProperty("FlatLaf.internal.testing.ignore", true);
panel5.setLayout(new MigLayout(
"ltr,insets dialog,hidemode 3",
// columns
@@ -1343,6 +1344,7 @@ public class FlatComponentsTest
//======== panel8 ========
{
panel8.putClientProperty("FlatLaf.internal.testing.ignore", true);
panel8.setLayout(new MigLayout(
"ltr,insets 0,hidemode 3",
// columns

View File

@@ -121,7 +121,7 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button13"
"icon": &SwingIcon0 new com.jformdesigner.model.SwingIcon( 2, "Tree.closedIcon" )
"icon": new com.jformdesigner.model.SwingIcon( 2, "Tree.closedIcon" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 1 2 1"
} )
@@ -272,7 +272,7 @@ new FormModel {
} )
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatToggleButton" ) {
name: "toggleButton22"
"icon": &SwingIcon0 new com.jformdesigner.model.SwingIcon( 2, "Tree.closedIcon" )
"icon": new com.jformdesigner.model.SwingIcon( 2, "Tree.closedIcon" )
"selected": true
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType borderless
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -998,6 +998,7 @@ new FormModel {
} ) {
name: "panel5"
"border": new javax.swing.border.TitledBorder( "Control" )
"$client.FlatLaf.internal.testing.ignore": true
add( new FormComponent( "com.formdev.flatlaf.testing.FlatTestEnumComboBox" ) {
name: "buttonTypeComboBox"
auxiliary() {
@@ -1190,6 +1191,7 @@ new FormModel {
"$layoutConstraints": "ltr,insets 0,hidemode 3"
} ) {
name: "panel8"
"$client.FlatLaf.internal.testing.ignore": true
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$columnConstraints": "[]"
"$rowConstraints": "[]0[]0[]0[]"

View File

@@ -617,6 +617,7 @@ public class FlatContainerTest
//======== tabbedPaneControlPanel ========
{
tabbedPaneControlPanel.setOpaque(false);
tabbedPaneControlPanel.putClientProperty("FlatLaf.internal.testing.ignore", true);
tabbedPaneControlPanel.setLayout(new MigLayout(
"insets 0,hidemode 3",
// columns

View File

@@ -136,6 +136,7 @@ new FormModel {
} ) {
name: "tabbedPaneControlPanel"
"opaque": false
"$client.FlatLaf.internal.testing.ignore": true
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "tabScrollCheckBox"
"text": "Use scroll layout"

View File

@@ -869,31 +869,37 @@ public class FlatMenusTest
//---- popupMenuLabel ----
popupMenuLabel.setText("JPopupMenu:");
popupMenuLabel.putClientProperty("FlatLaf.internal.testing.ignore", true);
add(popupMenuLabel, "cell 0 2");
//---- showPopupMenuButton ----
showPopupMenuButton.setText("show JPopupMenu");
showPopupMenuButton.putClientProperty("FlatLaf.internal.testing.ignore", true);
showPopupMenuButton.addActionListener(e -> showPopupMenuButton(e));
add(showPopupMenuButton, "cell 1 2");
//---- showScrollingPopupMenuButton ----
showScrollingPopupMenuButton.setText("show scrolling JPopupMenu");
showScrollingPopupMenuButton.putClientProperty("FlatLaf.internal.testing.ignore", true);
showScrollingPopupMenuButton.addActionListener(e -> showScrollingPopupMenu(e));
add(showScrollingPopupMenuButton, "cell 2 2");
//---- armedCheckBox ----
armedCheckBox.setText("armed");
armedCheckBox.setMnemonic('A');
armedCheckBox.putClientProperty("FlatLaf.internal.testing.ignore", true);
armedCheckBox.addActionListener(e -> armedChanged());
add(armedCheckBox, "cell 0 3");
//---- underlineCheckBox ----
underlineCheckBox.setText("underline menu selection");
underlineCheckBox.putClientProperty("FlatLaf.internal.testing.ignore", true);
underlineCheckBox.addActionListener(e -> underlineChanged());
add(underlineCheckBox, "cell 0 4 2 1");
//---- popupMenubackgroundCheckBox ----
popupMenubackgroundCheckBox.setText("yellow popup menu background");
popupMenubackgroundCheckBox.putClientProperty("FlatLaf.internal.testing.ignore", true);
popupMenubackgroundCheckBox.addActionListener(e -> popupMenubackgroundChanged());
add(popupMenubackgroundCheckBox, "cell 0 5 2 1");

View File

@@ -639,12 +639,14 @@ new FormModel {
add( new FormComponent( "javax.swing.JLabel" ) {
name: "popupMenuLabel"
"text": "JPopupMenu:"
"$client.FlatLaf.internal.testing.ignore": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2"
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "showPopupMenuButton"
"text": "show JPopupMenu"
"$client.FlatLaf.internal.testing.ignore": true
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showPopupMenuButton", true ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2"
@@ -652,6 +654,7 @@ new FormModel {
add( new FormComponent( "javax.swing.JButton" ) {
name: "showScrollingPopupMenuButton"
"text": "show scrolling JPopupMenu"
"$client.FlatLaf.internal.testing.ignore": true
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -663,6 +666,7 @@ new FormModel {
name: "armedCheckBox"
"text": "armed"
"mnemonic": 65
"$client.FlatLaf.internal.testing.ignore": true
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -673,6 +677,7 @@ new FormModel {
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "underlineCheckBox"
"text": "underline menu selection"
"$client.FlatLaf.internal.testing.ignore": true
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -683,6 +688,7 @@ new FormModel {
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "popupMenubackgroundCheckBox"
"text": "yellow popup menu background"
"$client.FlatLaf.internal.testing.ignore": true
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}

View File

@@ -240,11 +240,13 @@ public class FlatMnemonicsTest
//---- alwaysShowMnemonicsCheckBox ----
alwaysShowMnemonicsCheckBox.setText("Always show mnemonics");
alwaysShowMnemonicsCheckBox.setMnemonic('M');
alwaysShowMnemonicsCheckBox.putClientProperty("FlatLaf.internal.testing.ignore", true);
alwaysShowMnemonicsCheckBox.addActionListener(e -> alwaysShowMnemonicsChanged());
add(alwaysShowMnemonicsCheckBox, "cell 0 7 2 1,alignx left,growx 0");
//---- button2 ----
button2.setText("Open Dialog");
button2.putClientProperty("FlatLaf.internal.testing.ignore", true);
button2.addActionListener(e -> openDialog());
add(button2, "cell 2 7,alignx left,growx 0");

View File

@@ -134,6 +134,7 @@ new FormModel {
name: "alwaysShowMnemonicsCheckBox"
"text": "Always show mnemonics"
"mnemonic": 77
"$client.FlatLaf.internal.testing.ignore": true
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -144,6 +145,7 @@ new FormModel {
add( new FormComponent( "javax.swing.JButton" ) {
name: "button2"
"text": "Open Dialog"
"$client.FlatLaf.internal.testing.ignore": true
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "openDialog", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 7,alignx left,growx 0"

View File

@@ -633,6 +633,9 @@ public class FlatTestFrame
public static void updateComponentsRecur( Container container, BiConsumer<Component, String> action ) {
for( Component c : container.getComponents() ) {
if( c instanceof JComponent && Boolean.TRUE.equals( ((JComponent)c).getClientProperty( "FlatLaf.internal.testing.ignore" ) ) )
continue;
if( c instanceof JPanel ) {
updateComponentsRecur( (Container) c, action );
continue;

View File

@@ -309,6 +309,7 @@ public class FlatTextComponentsTest
//======== panel1 ========
{
panel1.setBorder(new TitledBorder("Control"));
panel1.putClientProperty("FlatLaf.internal.testing.ignore", true);
panel1.setLayout(new MigLayout(
"hidemode 3",
// columns

View File

@@ -80,6 +80,7 @@ new FormModel {
} ) {
name: "panel1"
"border": new javax.swing.border.TitledBorder( "Control" )
"$client.FlatLaf.internal.testing.ignore": true
add( new FormComponent( "javax.swing.JButton" ) {
name: "button1"
"text": "change text"