MenuView.java

1
package g0803.bindingofshiba.view.menu;
2
3
import g0803.bindingofshiba.App;
4
import g0803.bindingofshiba.Constants;
5
import g0803.bindingofshiba.bundles.Bundle;
6
import g0803.bindingofshiba.events.IEventManager;
7
import g0803.bindingofshiba.gui.GUI;
8
import g0803.bindingofshiba.math.Vec2D;
9
import g0803.bindingofshiba.model.menu.Menu;
10
import g0803.bindingofshiba.model.menu.MenuOption;
11
import g0803.bindingofshiba.textures.ITexture;
12
import g0803.bindingofshiba.textures.TextTextureBuilder;
13
import g0803.bindingofshiba.view.View;
14
import java.awt.*;
15
16
public class MenuView extends View<Menu> {
17
18
    public MenuView(Menu model, IEventManager eventManager) {
19
        super(model, eventManager);
20
    }
21
22
    @Override
23
    public void draw(App app, GUI gui, Vec2D offset) {
24
        Bundle<Font> fonts = app.getFonts();
25
        Bundle<ITexture> textures = app.getTextures();
26
27 1 1. draw : removed call to g0803/bindingofshiba/gui/GUI::fill → NO_COVERAGE
        gui.fill(Color.darkGray);
28
29
        ITexture title =
30
                new TextTextureBuilder(fonts.get("text"))
31
                        .setText(getModel().getTitle())
32
                        .setColor(Color.lightGray)
33
                        .build();
34
35 1 1. draw : removed call to g0803/bindingofshiba/gui/GUI::blit → NO_COVERAGE
        gui.blit(
36 2 1. draw : Replaced integer division with multiplication → NO_COVERAGE
2. draw : Replaced integer subtraction with addition → NO_COVERAGE
                Constants.SCREEN_WIDTH / 2 - title.getWidth() / 2,
37
                Constants.SCREEN_HEIGHT / 2 - 15,
38
                title);
39
40
        int startY = Constants.SCREEN_HEIGHT / 2 + 5;
41
        for (MenuOption option : getModel().getOptions()) {
42
            TextTextureBuilder text =
43
                    new TextTextureBuilder(fonts.get("text"))
44
                            .setText(option.getText())
45
                            .setColor(Color.lightGray);
46
47 1 1. draw : negated conditional → NO_COVERAGE
            if (option == getModel().getSelectedOption()) text.setColor(Color.white);
48
49
            ITexture texture = text.build();
50
51 3 1. draw : Replaced integer division with multiplication → NO_COVERAGE
2. draw : Replaced integer subtraction with addition → NO_COVERAGE
3. draw : removed call to g0803/bindingofshiba/gui/GUI::blit → NO_COVERAGE
            gui.blit(Constants.SCREEN_WIDTH / 2 - texture.getWidth() / 2, startY, texture);
52 1 1. draw : Changed increment from 10 to -10 → NO_COVERAGE
            startY += 10;
53
        }
54
    }
55
}

Mutations

27

1.1
Location : draw
Killed by : none
removed call to g0803/bindingofshiba/gui/GUI::fill → NO_COVERAGE

35

1.1
Location : draw
Killed by : none
removed call to g0803/bindingofshiba/gui/GUI::blit → NO_COVERAGE

36

1.1
Location : draw
Killed by : none
Replaced integer division with multiplication → NO_COVERAGE

2.2
Location : draw
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

47

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

51

1.1
Location : draw
Killed by : none
Replaced integer division with multiplication → NO_COVERAGE

2.2
Location : draw
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

3.3
Location : draw
Killed by : none
removed call to g0803/bindingofshiba/gui/GUI::blit → NO_COVERAGE

52

1.1
Location : draw
Killed by : none
Changed increment from 10 to -10 → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.7.0