Search in sources :

Example 1 with BlockMeterClient

use of win.baruna.blockmeter.BlockMeterClient in project BlockMeter by ModProg.

the class ClientMeasureBoxTest method testIsCorner.

@ParameterizedTest
@JSONSource(classes = { ParseBlockPos.class, ParseBlockPos.class, ParseBlockPos.class, ParseBlockPos.class, ParseBlockPos.class, ParseBlockPos.class, ParseBlockPos.class, ParseBlockPos.class }, jsons = { "(0|0|0), (10|10|10), (0|0|10), (0|10|0), (0|10|10), (10|0|0), (10|0|10), (10|10|0)", "(-30|5|25), (-90|2|50), (-30|5|50), (-30|2|25), (-30|2|50), (-90|5|25), (-90|5|50), (-90|2|25)" })
void testIsCorner(BlockPos bp0, BlockPos bp1, BlockPos bp2, BlockPos bp3, BlockPos bp4, BlockPos bp5, BlockPos bp6, BlockPos bp7) {
    try (MockedStatic<BlockMeterClient> client = getBMC()) {
        final ClientMeasureBox box = ClientMeasureBox.getBox(bp0, OVERWORLD_ID);
        box.setBlockEnd(bp1);
        assertThat(box.isCorner(bp0));
        assertThat(box.isCorner(bp1));
        assertThat(box.isCorner(bp2));
        assertThat(box.isCorner(bp3));
        assertThat(box.isCorner(bp4));
        assertThat(box.isCorner(bp5));
        assertThat(box.isCorner(bp6));
        assertThat(box.isCorner(bp7));
    }
}
Also used : ClientMeasureBox(win.baruna.blockmeter.measurebox.ClientMeasureBox) BlockMeterClient(win.baruna.blockmeter.BlockMeterClient) JSONSource(de.modprog.blockmeter.util.JSONSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with BlockMeterClient

use of win.baruna.blockmeter.BlockMeterClient in project BlockMeter by ModProg.

the class ClientMeasureBoxTest method testFinished.

@Test
void testFinished() {
    try (MockedStatic<BlockMeterClient> client = getBMC()) {
        final ClientMeasureBox box = ClientMeasureBox.getBox(new BlockPos(0, 0, 0), OVERWORLD_ID);
        assertThat(box.isFinished()).isFalse();
        box.setFinished();
        assertThat(box.isFinished()).isTrue();
    }
}
Also used : ClientMeasureBox(win.baruna.blockmeter.measurebox.ClientMeasureBox) BlockPos(net.minecraft.util.math.BlockPos) ParseBlockPos(de.modprog.blockmeter.util.parser.ParseBlockPos) BlockMeterClient(win.baruna.blockmeter.BlockMeterClient) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 3 with BlockMeterClient

use of win.baruna.blockmeter.BlockMeterClient in project BlockMeter by ModProg.

the class ClientMeasureBoxTest method testSetBlockEnd.

@ParameterizedTest
@JSONSource(classes = { ParseBlockPos.class, ParseBlockPos.class }, jsons = { "(0|0|0), (0|0|0)", "(-10|0|10000), (-500|0|10200)" })
void testSetBlockEnd(final BlockPos bp0, final BlockPos bp1) {
    try (MockedStatic<BlockMeterClient> client = getBMC()) {
        final ClientMeasureBox box = ClientMeasureBox.getBox(bp0, OVERWORLD_ID);
        box.setBlockEnd(bp1);
        assertThat(box.getBlockStart()).isEqualTo(bp0);
        assertThat(box.getBlockEnd()).isEqualTo(bp1);
    }
}
Also used : ClientMeasureBox(win.baruna.blockmeter.measurebox.ClientMeasureBox) BlockMeterClient(win.baruna.blockmeter.BlockMeterClient) JSONSource(de.modprog.blockmeter.util.JSONSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 4 with BlockMeterClient

use of win.baruna.blockmeter.BlockMeterClient in project BlockMeter by ModProg.

the class ClientMeasureBoxTest method testSetColor.

@ParameterizedTest
@JSONSource(classes = { ParseDyeColor.class }, jsons = { "red", "black", "green", "blue" })
void testSetColor(final DyeColor color) {
    try (MockedStatic<BlockMeterClient> client = getBMC()) {
        final ClientMeasureBox box = ClientMeasureBox.getBox(new BlockPos(0, 0, 0), OVERWORLD_ID);
        box.setColor(color);
        assertThat(box.getColor()).isEqualTo(color);
    }
}
Also used : ClientMeasureBox(win.baruna.blockmeter.measurebox.ClientMeasureBox) BlockPos(net.minecraft.util.math.BlockPos) ParseBlockPos(de.modprog.blockmeter.util.parser.ParseBlockPos) BlockMeterClient(win.baruna.blockmeter.BlockMeterClient) JSONSource(de.modprog.blockmeter.util.JSONSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 5 with BlockMeterClient

use of win.baruna.blockmeter.BlockMeterClient in project BlockMeter by ModProg.

the class ClientMeasureBoxTest method testLoosenCorner.

@ParameterizedTest
@JSONSource(classes = { ParseBlockPos.class, ParseBlockPos.class, ParseBlockPos.class }, jsons = { "(0|1|2), (3|4|5), (0|4|2)" })
void testLoosenCorner(BlockPos bp0, BlockPos bp1, BlockPos newBp0) {
    try (MockedStatic<BlockMeterClient> client = getBMC()) {
        final ClientMeasureBox box = ClientMeasureBox.getBox(bp0, OVERWORLD_ID);
        box.setBlockEnd(bp1);
        box.setFinished();
        box.loosenCorner(newBp0);
        assertThat(box.isCorner(bp0)).isTrue();
        assertThat(box.isCorner(bp1)).isTrue();
        assertThat(box.getBlockEnd()).isEqualTo(newBp0);
        assertThat(box.isFinished()).isFalse();
    }
}
Also used : ClientMeasureBox(win.baruna.blockmeter.measurebox.ClientMeasureBox) BlockMeterClient(win.baruna.blockmeter.BlockMeterClient) JSONSource(de.modprog.blockmeter.util.JSONSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

BlockMeterClient (win.baruna.blockmeter.BlockMeterClient)8 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)7 ClientMeasureBox (win.baruna.blockmeter.measurebox.ClientMeasureBox)7 JSONSource (de.modprog.blockmeter.util.JSONSource)6 ParseBlockPos (de.modprog.blockmeter.util.parser.ParseBlockPos)3 BlockPos (net.minecraft.util.math.BlockPos)3 ModConfig (win.baruna.blockmeter.ModConfig)2 Test (org.junit.jupiter.api.Test)1