Добавить обучение и полный экран результата
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
package com.projectsacrifice.game;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public final class CompletionResultTest {
|
||||
@Test
|
||||
public void resultKeepsThisRunAndSavedBestSeparateAndSuggestsTheMissingTarget() {
|
||||
LevelDefinition level = LevelCatalog.get(0);
|
||||
|
||||
CompletionResult result = CompletionResult.create(
|
||||
level,
|
||||
2,
|
||||
42_000L,
|
||||
0,
|
||||
25_000L,
|
||||
true
|
||||
);
|
||||
|
||||
assertEquals(2, result.currentDeaths());
|
||||
assertEquals(42_000L, result.currentTimeMs());
|
||||
assertEquals(0, result.bestDeaths());
|
||||
assertEquals(25_000L, result.bestTimeMs());
|
||||
assertEquals(CompletionResult.NextGoal.TARGET_DEATHS, result.nextGoal());
|
||||
assertEquals(0, result.nextGoalValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void masteredLevelPointsAtTheNextLevelOrPersonalBest() {
|
||||
LevelDefinition first = LevelCatalog.get(0);
|
||||
CompletionResult timeTarget = CompletionResult.create(first, 0, 31_000L,
|
||||
0, 25_000L, true);
|
||||
assertEquals(CompletionResult.NextGoal.TARGET_TIME, timeTarget.nextGoal());
|
||||
assertEquals(30_000L, timeTarget.nextGoalValue());
|
||||
|
||||
CompletionResult next = CompletionResult.create(first, 0, 25_000L,
|
||||
0, 25_000L, true);
|
||||
assertEquals(CompletionResult.NextGoal.NEXT_LEVEL, next.nextGoal());
|
||||
assertEquals(2, next.nextGoalValue());
|
||||
|
||||
LevelDefinition last = LevelCatalog.get(LevelCatalog.all().size() - 1);
|
||||
CompletionResult lastResult = CompletionResult.create(last,
|
||||
last.targetDeaths, last.targetSeconds * 900L,
|
||||
last.targetDeaths, last.targetSeconds * 900L, false);
|
||||
assertEquals(CompletionResult.NextGoal.PERSONAL_BEST, lastResult.nextGoal());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.projectsacrifice.game;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public final class OnboardingFlowTest {
|
||||
@Test
|
||||
public void firstRunExplainsControlsAndCorpsesThenStaysDismissed() {
|
||||
OnboardingFlow flow = OnboardingFlow.firstRun(false);
|
||||
|
||||
assertTrue(flow.isVisible());
|
||||
assertEquals(OnboardingFlow.Step.MOVEMENT, flow.step());
|
||||
|
||||
flow.next();
|
||||
assertEquals(OnboardingFlow.Step.MULTITOUCH_JUMP, flow.step());
|
||||
|
||||
flow.next();
|
||||
assertEquals(OnboardingFlow.Step.CORPSES_ARE_TOOLS, flow.step());
|
||||
|
||||
flow.next();
|
||||
assertFalse(flow.isVisible());
|
||||
assertTrue(flow.isComplete());
|
||||
assertFalse(OnboardingFlow.firstRun(flow.isComplete()).isVisible());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void firstRunCanBeSkippedImmediately() {
|
||||
OnboardingFlow flow = OnboardingFlow.firstRun(false);
|
||||
|
||||
flow.skip();
|
||||
|
||||
assertFalse(flow.isVisible());
|
||||
assertTrue(flow.isComplete());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user