Skip to content

Commit

Permalink
updated humanWanderTask and started writing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
The-AhmadAA committed Sep 7, 2023
1 parent 8ab5f3a commit 5a17e39
Show file tree
Hide file tree
Showing 6 changed files with 179 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.csse3200.game.physics.components.ColliderComponent;
import com.csse3200.game.physics.components.HitboxComponent;
import com.csse3200.game.rendering.AnimationRenderComponent;
import com.csse3200.game.services.GameTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -27,7 +26,6 @@ public class HumanWanderTask extends DefaultTask implements PriorityTask {
private HumanMovementTask movementTask;
private HumanWaitTask waitTask;
private Task currentTask;
private GameTime endTime;

private boolean isDead = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
*/
public class EngineerConfigs extends BaseEntityConfig {
public BaseEntityConfig engineer = new BaseEntityConfig();

public int health = 10;
public int baseAttack = 1;


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.csse3200.game.components.player;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

class HumanAnimationControllerTest {

@BeforeEach
void setUp() {
}

@AfterEach
void tearDown() {
}

@Test
void create() {
}

@Test
void animateIdleLeft() {
}

@Test
void animateIdleRight() {
}

@Test
void animateLeftWalk() {
}

@Test
void animateRightWalk() {
}

@Test
void animateFiring() {
}

@Test
void animateHit() {
}

@Test
void animateDeath() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.csse3200.game.components.tasks.human;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

class HumanMovementTaskTest {

@BeforeEach
void setUp() {
}

@AfterEach
void tearDown() {
}

@Test
void start() {
}

@Test
void update() {
}

@Test
void setTarget() {
}

@Test
void stop() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.csse3200.game.components.tasks.human;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

class HumanWanderTaskTest {

@BeforeEach
void setUp() {
}

@AfterEach
void tearDown() {
}

@Test
void getPriority() {
}

@Test
void start() {
}

@Test
void update() {
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,68 @@
package com.csse3200.game.entities.factories;

import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.csse3200.game.entities.Entity;
import com.csse3200.game.extensions.GameExtension;
import com.csse3200.game.physics.PhysicsService;
import com.csse3200.game.rendering.AnimationRenderComponent;
import com.csse3200.game.rendering.DebugRenderer;
import com.csse3200.game.rendering.RenderService;
import com.csse3200.game.services.GameTime;
import com.csse3200.game.services.ResourceService;
import com.csse3200.game.services.ServiceLocator;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;


import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@ExtendWith(GameExtension.class)
class EngineerFactoryTest {

Entity target = new Entity();
private String[] texture = {
"images/engineers/engineer.png"
};
private String[] atlas = {"images/engineers/engineer.atlas"};
private static final String[] sounds = {
"sounds/engineers/firing_auto.mp3"
};

@BeforeEach
void setUp() {
GameTime gameTime = mock(GameTime.class);
when(gameTime.getDeltaTime()).thenReturn(0.02f);
ServiceLocator.registerTimeSource(gameTime);
ServiceLocator.registerPhysicsService(new PhysicsService());
RenderService render = new RenderService();
render.setDebug(mock(DebugRenderer.class));
ServiceLocator.registerRenderService(render);
ResourceService resourceService = new ResourceService();
ServiceLocator.registerResourceService(resourceService);
resourceService.loadTextureAtlases(atlas);
resourceService.loadSounds(sounds);
resourceService.loadAll();
}

@AfterEach
void tearDown() {

}

@Test
void createEngineer() {
Entity engineer = EngineerFactory.createEngineer(target);
assertNotNull(engineer);
}

@Test
void createBaseHumanNPC() {
Entity human = EngineerFactory.createBaseHumanNPC(target);
assertNotNull(human);
}
}

0 comments on commit 5a17e39

Please sign in to comment.