RadioMenuItemIconCustom.java

1
package com.jsql.view.swing.panel.util;
2
3
import javax.swing.*;
4
import javax.swing.plaf.UIResource;
5
import javax.swing.plaf.metal.MetalLookAndFeel;
6
import java.awt.*;
7
import java.io.Serializable;
8
9
public class RadioMenuItemIconCustom implements Icon, UIResource, Serializable {
10
    
11
    public void paintOceanIcon(Component c, Graphics g, int x, int y) {
12
13
        // Fix #95383, NullPointerException on c.getModel()
14 1 1. paintOceanIcon : negated conditional → NO_COVERAGE
        if (c == null) {
15
            return;
16
        }
17
18
        ButtonModel model = ((AbstractButton) c).getModel();
19
        boolean isSelected = model.isSelected();
20
        boolean isEnabled = model.isEnabled();
21
        boolean isPressed = model.isPressed();
22
        boolean isArmed = model.isArmed();
23
24 1 1. paintOceanIcon : removed call to java/awt/Graphics::translate → NO_COVERAGE
        g.translate(x, y);
25
26 1 1. paintOceanIcon : negated conditional → NO_COVERAGE
        if (isEnabled) {
27
            
28 2 1. paintOceanIcon : negated conditional → NO_COVERAGE
2. paintOceanIcon : negated conditional → NO_COVERAGE
            if (isPressed || isArmed) {
29 1 1. paintOceanIcon : removed call to java/awt/Graphics::setColor → NO_COVERAGE
                g.setColor(MetalLookAndFeel.getPrimaryControl());
30
            } else {
31 1 1. paintOceanIcon : removed call to java/awt/Graphics::setColor → NO_COVERAGE
                g.setColor(MetalLookAndFeel.getControlHighlight());
32
            }
33
            
34 1 1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE
            g.drawLine(2, 9, 7, 9);
35 1 1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE
            g.drawLine(9, 2, 9, 7);
36 1 1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE
            g.drawLine(8, 8, 8, 8);
37
38 2 1. paintOceanIcon : negated conditional → NO_COVERAGE
2. paintOceanIcon : negated conditional → NO_COVERAGE
            if (isPressed || isArmed) {
39 1 1. paintOceanIcon : removed call to java/awt/Graphics::setColor → NO_COVERAGE
                g.setColor(MetalLookAndFeel.getControlInfo());
40
            } else {
41 1 1. paintOceanIcon : removed call to java/awt/Graphics::setColor → NO_COVERAGE
                g.setColor(MetalLookAndFeel.getControlDarkShadow());
42
            }
43
        } else {
44 1 1. paintOceanIcon : removed call to java/awt/Graphics::setColor → NO_COVERAGE
            g.setColor( MetalLookAndFeel.getMenuDisabledForeground() );
45
        }
46
47 1 1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE
        g.drawLine(2, 0, 6, 0);
48 1 1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE
        g.drawLine(2, 8, 6, 8);
49 1 1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE
        g.drawLine(0, 2, 0, 6);
50 1 1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE
        g.drawLine(8, 2, 8, 6);
51 1 1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE
        g.drawLine(1, 1, 1, 1);
52 1 1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE
        g.drawLine(7, 1, 7, 1);
53 1 1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE
        g.drawLine(1, 7, 1, 7);
54 1 1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE
        g.drawLine(7, 7, 7, 7);
55
56 1 1. paintOceanIcon : negated conditional → NO_COVERAGE
        if (isSelected) {
57 1 1. paintOceanIcon : removed call to com/jsql/view/swing/panel/util/RadioMenuItemIconCustom::drawSelected → NO_COVERAGE
            this.drawSelected(c, g, model, isEnabled, isArmed);
58
        }
59
60 3 1. paintOceanIcon : removed call to java/awt/Graphics::translate → NO_COVERAGE
2. paintOceanIcon : removed negation → NO_COVERAGE
3. paintOceanIcon : removed negation → NO_COVERAGE
        g.translate(-x, -y);
61
    }
62
63
    private void drawSelected(Component c, Graphics g, ButtonModel model, boolean isEnabled, boolean isArmed) {
64
        
65 1 1. drawSelected : negated conditional → NO_COVERAGE
        if (isEnabled) {
66 2 1. drawSelected : negated conditional → NO_COVERAGE
2. drawSelected : negated conditional → NO_COVERAGE
            if (
67
                isArmed
68 1 1. drawSelected : negated conditional → NO_COVERAGE
                || (c instanceof JMenu && model.isSelected())
69
            ) {
70 1 1. drawSelected : removed call to java/awt/Graphics::setColor → NO_COVERAGE
                g.setColor(MetalLookAndFeel.getMenuSelectedForeground());
71
            } else {
72 1 1. drawSelected : removed call to java/awt/Graphics::setColor → NO_COVERAGE
                g.setColor(MetalLookAndFeel.getControlInfo());
73
            }
74
        } else {
75 1 1. drawSelected : removed call to java/awt/Graphics::setColor → NO_COVERAGE
            g.setColor(MetalLookAndFeel.getMenuDisabledForeground());
76
        }
77
        
78 1 1. drawSelected : removed call to java/awt/Graphics::drawLine → NO_COVERAGE
        g.drawLine(3, 2, 5, 2);
79 1 1. drawSelected : removed call to java/awt/Graphics::drawLine → NO_COVERAGE
        g.drawLine(2, 3, 6, 3);
80 1 1. drawSelected : removed call to java/awt/Graphics::drawLine → NO_COVERAGE
        g.drawLine(2, 4, 6, 4);
81 1 1. drawSelected : removed call to java/awt/Graphics::drawLine → NO_COVERAGE
        g.drawLine(2, 5, 6, 5);
82 1 1. drawSelected : removed call to java/awt/Graphics::drawLine → NO_COVERAGE
        g.drawLine(3, 6, 5, 6);
83
    }
84
85
    @Override
86
    public void paintIcon(Component c, Graphics g, int x, int y) {
87 1 1. paintIcon : removed call to com/jsql/view/swing/panel/util/RadioMenuItemIconCustom::paintOceanIcon → NO_COVERAGE
        this.paintOceanIcon(c, g, x, y);
88
    }
89
90
    @Override
91
    public int getIconWidth() {
92 1 1. getIconWidth : replaced int return with 0 for com/jsql/view/swing/panel/util/RadioMenuItemIconCustom::getIconWidth → NO_COVERAGE
        return new Dimension(10, 10).width;
93
    }
94
95
    @Override
96
    public int getIconHeight() {
97 1 1. getIconHeight : replaced int return with 0 for com/jsql/view/swing/panel/util/RadioMenuItemIconCustom::getIconHeight → NO_COVERAGE
        return new Dimension(10, 10).height;
98
    }
99
}

Mutations

14

1.1
Location : paintOceanIcon
Killed by : none
negated conditional → NO_COVERAGE

24

1.1
Location : paintOceanIcon
Killed by : none
removed call to java/awt/Graphics::translate → NO_COVERAGE

26

1.1
Location : paintOceanIcon
Killed by : none
negated conditional → NO_COVERAGE

28

1.1
Location : paintOceanIcon
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : paintOceanIcon
Killed by : none
negated conditional → NO_COVERAGE

29

1.1
Location : paintOceanIcon
Killed by : none
removed call to java/awt/Graphics::setColor → NO_COVERAGE

31

1.1
Location : paintOceanIcon
Killed by : none
removed call to java/awt/Graphics::setColor → NO_COVERAGE

34

1.1
Location : paintOceanIcon
Killed by : none
removed call to java/awt/Graphics::drawLine → NO_COVERAGE

35

1.1
Location : paintOceanIcon
Killed by : none
removed call to java/awt/Graphics::drawLine → NO_COVERAGE

36

1.1
Location : paintOceanIcon
Killed by : none
removed call to java/awt/Graphics::drawLine → NO_COVERAGE

38

1.1
Location : paintOceanIcon
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : paintOceanIcon
Killed by : none
negated conditional → NO_COVERAGE

39

1.1
Location : paintOceanIcon
Killed by : none
removed call to java/awt/Graphics::setColor → NO_COVERAGE

41

1.1
Location : paintOceanIcon
Killed by : none
removed call to java/awt/Graphics::setColor → NO_COVERAGE

44

1.1
Location : paintOceanIcon
Killed by : none
removed call to java/awt/Graphics::setColor → NO_COVERAGE

47

1.1
Location : paintOceanIcon
Killed by : none
removed call to java/awt/Graphics::drawLine → NO_COVERAGE

48

1.1
Location : paintOceanIcon
Killed by : none
removed call to java/awt/Graphics::drawLine → NO_COVERAGE

49

1.1
Location : paintOceanIcon
Killed by : none
removed call to java/awt/Graphics::drawLine → NO_COVERAGE

50

1.1
Location : paintOceanIcon
Killed by : none
removed call to java/awt/Graphics::drawLine → NO_COVERAGE

51

1.1
Location : paintOceanIcon
Killed by : none
removed call to java/awt/Graphics::drawLine → NO_COVERAGE

52

1.1
Location : paintOceanIcon
Killed by : none
removed call to java/awt/Graphics::drawLine → NO_COVERAGE

53

1.1
Location : paintOceanIcon
Killed by : none
removed call to java/awt/Graphics::drawLine → NO_COVERAGE

54

1.1
Location : paintOceanIcon
Killed by : none
removed call to java/awt/Graphics::drawLine → NO_COVERAGE

56

1.1
Location : paintOceanIcon
Killed by : none
negated conditional → NO_COVERAGE

57

1.1
Location : paintOceanIcon
Killed by : none
removed call to com/jsql/view/swing/panel/util/RadioMenuItemIconCustom::drawSelected → NO_COVERAGE

60

1.1
Location : paintOceanIcon
Killed by : none
removed call to java/awt/Graphics::translate → NO_COVERAGE

2.2
Location : paintOceanIcon
Killed by : none
removed negation → NO_COVERAGE

3.3
Location : paintOceanIcon
Killed by : none
removed negation → NO_COVERAGE

65

1.1
Location : drawSelected
Killed by : none
negated conditional → NO_COVERAGE

66

1.1
Location : drawSelected
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : drawSelected
Killed by : none
negated conditional → NO_COVERAGE

68

1.1
Location : drawSelected
Killed by : none
negated conditional → NO_COVERAGE

70

1.1
Location : drawSelected
Killed by : none
removed call to java/awt/Graphics::setColor → NO_COVERAGE

72

1.1
Location : drawSelected
Killed by : none
removed call to java/awt/Graphics::setColor → NO_COVERAGE

75

1.1
Location : drawSelected
Killed by : none
removed call to java/awt/Graphics::setColor → NO_COVERAGE

78

1.1
Location : drawSelected
Killed by : none
removed call to java/awt/Graphics::drawLine → NO_COVERAGE

79

1.1
Location : drawSelected
Killed by : none
removed call to java/awt/Graphics::drawLine → NO_COVERAGE

80

1.1
Location : drawSelected
Killed by : none
removed call to java/awt/Graphics::drawLine → NO_COVERAGE

81

1.1
Location : drawSelected
Killed by : none
removed call to java/awt/Graphics::drawLine → NO_COVERAGE

82

1.1
Location : drawSelected
Killed by : none
removed call to java/awt/Graphics::drawLine → NO_COVERAGE

87

1.1
Location : paintIcon
Killed by : none
removed call to com/jsql/view/swing/panel/util/RadioMenuItemIconCustom::paintOceanIcon → NO_COVERAGE

92

1.1
Location : getIconWidth
Killed by : none
replaced int return with 0 for com/jsql/view/swing/panel/util/RadioMenuItemIconCustom::getIconWidth → NO_COVERAGE

97

1.1
Location : getIconHeight
Killed by : none
replaced int return with 0 for com/jsql/view/swing/panel/util/RadioMenuItemIconCustom::getIconHeight → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.16.1