Styling: FlatMenuItemArrowIcon no longer extends FlatMenuArrowIcon because it does not paint anything and therefore should not inherit styling properties from FlatMenuArrowIcon

This commit is contained in:
Karl Tauber
2021-12-11 01:06:23 +01:00
parent 959b3e46fa
commit 6205e18c45
3 changed files with 4 additions and 31 deletions

View File

@@ -21,14 +21,16 @@ import java.awt.Graphics;
import java.awt.Graphics2D;
/**
* "arrow" icon for {@link javax.swing.JMenuItem}.
* "arrow" icon for {@link javax.swing.JMenuItem}, {@link javax.swing.JCheckBoxMenuItem}
* and {@link javax.swing.JRadioButtonMenuItem}.
*
* @author Karl Tauber
*/
public class FlatMenuItemArrowIcon
extends FlatMenuArrowIcon
extends FlatAbstractIcon
{
public FlatMenuItemArrowIcon() {
super( 6, 10, null );
}
@Override

View File

@@ -301,7 +301,6 @@ public class TestFlatStyleableInfo
Map<String, Class<?>> expected = new LinkedHashMap<>();
menuItem( expected );
menuItem_arrowIcon( expected );
assertMapEquals( expected, ui.getStyleableInfos( c ) );
}
@@ -314,7 +313,6 @@ public class TestFlatStyleableInfo
Map<String, Class<?>> expected = new LinkedHashMap<>();
menuItem( expected );
menuItem_checkIcon( expected );
menuItem_arrowIcon( expected );
assertMapEquals( expected, ui.getStyleableInfos( c ) );
}
@@ -327,7 +325,6 @@ public class TestFlatStyleableInfo
Map<String, Class<?>> expected = new LinkedHashMap<>();
menuItem( expected );
menuItem_checkIcon( expected );
menuItem_arrowIcon( expected );
assertMapEquals( expected, ui.getStyleableInfos( c ) );
}
@@ -1147,17 +1144,6 @@ public class TestFlatStyleableInfo
assertMapEquals( expected, icon.getStyleableInfos() );
}
@Test
void flatMenuItemArrowIcon() {
FlatMenuItemArrowIcon icon = new FlatMenuItemArrowIcon();
// FlatMenuItemArrowIcon extends FlatMenuArrowIcon
Map<String, Class<?>> expected = new LinkedHashMap<>();
flatMenuArrowIcon( expected );
assertMapEquals( expected, icon.getStyleableInfos() );
}
private void flatMenuArrowIcon( Map<String, Class<?>> expected ) {
expectedMap( expected,
"arrowType", String.class,

View File

@@ -455,7 +455,6 @@ public class TestFlatStyling
Consumer<String> applyStyle = style -> ui.applyStyle( style );
menuItem( applyStyle );
menuItem_arrowIcon( applyStyle );
}
@Test
@@ -466,7 +465,6 @@ public class TestFlatStyling
Consumer<String> applyStyle = style -> ui.applyStyle( style );
menuItem( applyStyle );
menuItem_checkIcon( applyStyle );
menuItem_arrowIcon( applyStyle );
}
@Test
@@ -477,7 +475,6 @@ public class TestFlatStyling
Consumer<String> applyStyle = style -> ui.applyStyle( style );
menuItem( applyStyle );
menuItem_checkIcon( applyStyle );
menuItem_arrowIcon( applyStyle );
}
private void menuItem( Consumer<String> applyStyle ) {
@@ -1366,18 +1363,6 @@ public class TestFlatStyling
void flatMenuArrowIcon() {
FlatMenuArrowIcon icon = new FlatMenuArrowIcon();
flatMenuArrowIcon( icon );
}
@Test
void flatMenuItemArrowIcon() {
FlatMenuItemArrowIcon icon = new FlatMenuItemArrowIcon();
// FlatMenuItemArrowIcon extends FlatMenuArrowIcon
flatMenuArrowIcon( icon );
}
private void flatMenuArrowIcon( FlatMenuArrowIcon icon ) {
icon.applyStyleProperty( "arrowType", "chevron" );
icon.applyStyleProperty( "arrowColor", Color.WHITE );
icon.applyStyleProperty( "disabledArrowColor", Color.WHITE );