BorderRoundBlu.java

1
package com.jsql.view.swing.ui;
2
3
import com.jsql.util.LogLevelUtil;
4
import org.apache.logging.log4j.LogManager;
5
import org.apache.logging.log4j.Logger;
6
7
import javax.swing.border.AbstractBorder;
8
import java.awt.*;
9
import java.awt.geom.Area;
10
import java.awt.geom.Rectangle2D;
11
import java.awt.geom.RoundRectangle2D;
12
13
public class BorderRoundBlu extends AbstractBorder {
14
    
15
    /**
16
     * Log4j logger sent to view.
17
     */
18
    private static final Logger LOGGER = LogManager.getRootLogger();
19
    
20
    @Override
21
    public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
22
        
23
        Graphics2D g2 = (Graphics2D)g.create();
24 1 1. paintBorder : removed call to java/awt/Graphics2D::setRenderingHint → NO_COVERAGE
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
25
        var r = 5;
26
        
27 2 1. paintBorder : Replaced float subtraction with addition → NO_COVERAGE
2. paintBorder : Replaced float subtraction with addition → NO_COVERAGE
        RoundRectangle2D round = new RoundRectangle2D.Float(x, y, width-1f, height-1f, r, r);
28
        Container parent = c.getParent();
29
        
30 1 1. paintBorder : negated conditional → NO_COVERAGE
        if (parent!=null) {
31
            
32 1 1. paintBorder : removed call to java/awt/Graphics2D::setColor → NO_COVERAGE
            g2.setColor(parent.getBackground());
33
            var corner = new Area(new Rectangle2D.Float(x, y, width, height));
34 1 1. paintBorder : removed call to java/awt/geom/Area::subtract → NO_COVERAGE
            corner.subtract(new Area(round));
35
            
36
            // Fix #42304: NoClassDefFoundError on fill()
37
            // Fix #42289: UnsatisfiedLinkError on fill()
38
            try {
39 1 1. paintBorder : removed call to java/awt/Graphics2D::fill → NO_COVERAGE
                g2.fill(corner);
40
            } catch (NoClassDefFoundError | UnsatisfiedLinkError e) {
41
                LOGGER.log(LogLevelUtil.CONSOLE_JAVA, e, e);
42
            }
43
        }
44
        
45 1 1. paintBorder : removed call to java/awt/Graphics2D::setColor → NO_COVERAGE
        g2.setColor(Color.GRAY);
46
        
47
        // Fix #55411: NoClassDefFoundError on draw()
48
        try {
49 1 1. paintBorder : removed call to java/awt/Graphics2D::draw → NO_COVERAGE
            g2.draw(round);
50
        } catch (NoClassDefFoundError e) {
51
            LOGGER.log(LogLevelUtil.CONSOLE_JAVA, e, e);
52
        }
53
            
54 1 1. paintBorder : removed call to java/awt/Graphics2D::dispose → NO_COVERAGE
        g2.dispose();
55
    }
56
    
57
    @Override
58
    public Insets getBorderInsets(Component c) {
59 1 1. getBorderInsets : replaced return value with null for com/jsql/view/swing/ui/BorderRoundBlu::getBorderInsets → NO_COVERAGE
        return new Insets(4, 8, 4, 8);
60
    }
61
    
62
    @Override
63
    public Insets getBorderInsets(Component c, Insets insets) {
64
        
65
        insets.left = insets.right = 8;
66
        insets.top = insets.bottom = 4;
67
        
68 1 1. getBorderInsets : replaced return value with null for com/jsql/view/swing/ui/BorderRoundBlu::getBorderInsets → NO_COVERAGE
        return insets;
69
    }
70
}

Mutations

24

1.1
Location : paintBorder
Killed by : none
removed call to java/awt/Graphics2D::setRenderingHint → NO_COVERAGE

27

1.1
Location : paintBorder
Killed by : none
Replaced float subtraction with addition → NO_COVERAGE

2.2
Location : paintBorder
Killed by : none
Replaced float subtraction with addition → NO_COVERAGE

30

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

32

1.1
Location : paintBorder
Killed by : none
removed call to java/awt/Graphics2D::setColor → NO_COVERAGE

34

1.1
Location : paintBorder
Killed by : none
removed call to java/awt/geom/Area::subtract → NO_COVERAGE

39

1.1
Location : paintBorder
Killed by : none
removed call to java/awt/Graphics2D::fill → NO_COVERAGE

45

1.1
Location : paintBorder
Killed by : none
removed call to java/awt/Graphics2D::setColor → NO_COVERAGE

49

1.1
Location : paintBorder
Killed by : none
removed call to java/awt/Graphics2D::draw → NO_COVERAGE

54

1.1
Location : paintBorder
Killed by : none
removed call to java/awt/Graphics2D::dispose → NO_COVERAGE

59

1.1
Location : getBorderInsets
Killed by : none
replaced return value with null for com/jsql/view/swing/ui/BorderRoundBlu::getBorderInsets → NO_COVERAGE

68

1.1
Location : getBorderInsets
Killed by : none
replaced return value with null for com/jsql/view/swing/ui/BorderRoundBlu::getBorderInsets → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.16.1