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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -134,6 +134,7 @@ new FormModel {
name: "alwaysShowMnemonicsCheckBox" name: "alwaysShowMnemonicsCheckBox"
"text": "Always show mnemonics" "text": "Always show mnemonics"
"mnemonic": 77 "mnemonic": 77
"$client.FlatLaf.internal.testing.ignore": true
auxiliary() { auxiliary() {
"JavaCodeGenerator.variableLocal": false "JavaCodeGenerator.variableLocal": false
} }
@@ -144,6 +145,7 @@ new FormModel {
add( new FormComponent( "javax.swing.JButton" ) { add( new FormComponent( "javax.swing.JButton" ) {
name: "button2" name: "button2"
"text": "Open Dialog" "text": "Open Dialog"
"$client.FlatLaf.internal.testing.ignore": true
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "openDialog", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "openDialog", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 7,alignx left,growx 0" "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 ) { public static void updateComponentsRecur( Container container, BiConsumer<Component, String> action ) {
for( Component c : container.getComponents() ) { for( Component c : container.getComponents() ) {
if( c instanceof JComponent && Boolean.TRUE.equals( ((JComponent)c).getClientProperty( "FlatLaf.internal.testing.ignore" ) ) )
continue;
if( c instanceof JPanel ) { if( c instanceof JPanel ) {
updateComponentsRecur( (Container) c, action ); updateComponentsRecur( (Container) c, action );
continue; continue;

View File

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

View File

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