-
Notifications
You must be signed in to change notification settings - Fork 0
Worker Idle Testing
Alexander Johnson edited this page Aug 29, 2022
·
2 revisions
These JUnit test cases aim to check if the WorkerIdleTask
passes the following functionality tests:
-
shouldNotMoveOnStart
: when thestart
method is called on the task and updated, the unit should not be moving
void shouldNotMoveOnStart() {
Vector2 startPosition = new Vector2(10.0f, 10.0f);
WorkerIdleTask task = new WorkerIdleTask();
Entity entity = new Entity().addComponent(new PhysicsComponent());
PhysicsMovementComponent movementComponent = new PhysicsMovementComponent();
entity.addComponent(movementComponent);
entity.create();
entity.setPosition(startPosition.x, startPosition.y);
task.create(() -> entity);
task.start();
task.update();
// Check to make sure that entity hasn't moved
assertEquals(Task.Status.FINISHED, task.getMovementTask().getStatus());
assertEquals(entity.getPosition(), startPosition);
}
-
shouldBeIdle
: when the task is started and the unit is not currently moving, theidling
attribute of the task should be set asfalse
void shouldBeIdle() {
WorkerIdleTask task = new WorkerIdleTask();
Entity entity = new Entity().addComponent(new PhysicsComponent());
PhysicsMovementComponent movementComponent = new PhysicsMovementComponent();
entity.addComponent(movementComponent);
entity.create();
task.create(() -> entity);
task.start();
task.update(); // Should have stopped
task.update(); // Should have updated idling to true
assertTrue(task.isIdling());
}
-
shouldNotBeIdle
: when the task is started and the unit is currently moving, theidling
attribute of the task should be set astrue
void shouldNotBeIdle() {
Vector2 startPosition = new Vector2(10.0f, 10.0f);
WorkerIdleTask task = new WorkerIdleTask();
Entity entity = new Entity().addComponent(new PhysicsComponent());
PhysicsMovementComponent movementComponent = new PhysicsMovementComponent();
entity.addComponent(movementComponent);
entity.create();
entity.setPosition(startPosition);
task.create(() -> entity);
task.start();
task.update(); // Should have stopped
task.update(); // Should have updated idling to true
assertTrue(task.isIdling()); // Should be idle
task.startMoving(new Vector2(15.0f, 15.0f));
assertFalse(task.isIdling()); // Should be moving
task.update();
assertFalse(task.isIdling()); // Should still be moving
}
Map
City
Buildings
Unit Selections
Game User Testing: Theme of Unit Selection & Spell System
Health Bars
In Game menu
- Feature
- User Testing:In Game Menu
Landscape Tile Design Feedback