aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/de/hysky/skyblocker/utils/waypoint/ProfileAwareWaypointTest.java
blob: 9dc5b2b90a4a778e1dcdeeb4c920387ce86a2063 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package de.hysky.skyblocker.utils.waypoint;

import net.minecraft.util.math.BlockPos;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class ProfileAwareWaypointTest {
    @Test
    void testShouldRender() {
        ProfileAwareWaypoint waypoint = new ProfileAwareWaypoint(BlockPos.ORIGIN, null, null, null);
        waypoint.setFound("profile");
        Assertions.assertTrue(waypoint.shouldRender());
        waypoint.setFound("");
        Assertions.assertFalse(waypoint.shouldRender());
        waypoint.setMissing();
        Assertions.assertTrue(waypoint.shouldRender());
    }

    @Test
    void testGetColorComponents() {
        ProfileAwareWaypoint waypoint = new ProfileAwareWaypoint(BlockPos.ORIGIN, null, new float[]{0f, 0.5f, 1f}, new float[]{1f, 0.5f, 0f});
        waypoint.setFound("profile");
        float[] colorComponents = waypoint.getColorComponents();
        Assertions.assertEquals(0f, colorComponents[0]);
        Assertions.assertEquals(0.5f, colorComponents[1]);
        Assertions.assertEquals(1f, colorComponents[2]);
        waypoint.setFound("");
        colorComponents = waypoint.getColorComponents();
        Assertions.assertEquals(1f, colorComponents[0]);
        Assertions.assertEquals(0.5f, colorComponents[1]);
        Assertions.assertEquals(0f, colorComponents[2]);
        waypoint.setMissing();
        colorComponents = waypoint.getColorComponents();
        Assertions.assertEquals(0f, colorComponents[0]);
        Assertions.assertEquals(0.5f, colorComponents[1]);
        Assertions.assertEquals(1f, colorComponents[2]);
    }
}