Commit fe849317 authored by Aneta Steimarova's avatar Aneta Steimarova

#949 Edited itests due to rule to get bonus trophy changed

parent 5918bbb3
......@@ -17,6 +17,9 @@
package cz.nic.tablexia.testing;
import java.util.ArrayList;
import java.util.List;
import cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.game.AbstractTablexiaGame;
import cz.nic.tablexia.game.GameDefinition;
......@@ -34,31 +37,52 @@ import cz.nic.tablexia.util.ui.TablexiaImage;
* Created by aneta on 15.11.16.
*/
public abstract class AbstractTestScenarioHallOfFameTrophies extends AbstractTestScenario {
public static final int BONUS_TROPHY_MULTIPLE = 6;
public AbstractTestScenarioHallOfFameTrophies(Tablexia tablexia) {
super(tablexia);
}
private void checkTrophy(GameTrophyDefinition gameTrophyDefinition, User user, boolean [] gotTrophies, int i){
writeToLogFile("\tCheck trophy: " + gameTrophyDefinition.toString() + "\n");
swipeToActor("\t\ta. Swipe to trophy " + gameTrophyDefinition.toString(), gameTrophyDefinition.getTrophyName());
if (gotTrophies[i]) checkTrophyFull(user, gameTrophyDefinition);
else checkTrophyEmpty(user, gameTrophyDefinition);
}
protected void checkGameTrophies(int stepNumber, User user, boolean[] gotTrophies) {
writeToLogFile(stepNumber + ". Check all trophies:\n");
int i = 0;
List<GameTrophyDefinition> bonusTrophyDefinitions = new ArrayList<>();
for (GameTrophyDefinition gameTrophyDefinition : GameTrophyDefinition.values()) {
writeToLogFile("\tCheck trophy: " + gameTrophyDefinition.toString() + "\n");
swipeToActor("\t\ta. Swipe to trophy " + gameTrophyDefinition.toString(), gameTrophyDefinition.getTrophyName());
if(gotTrophies[i]) checkTrophyFull(user, gameTrophyDefinition);
else checkTrophyEmpty(user, gameTrophyDefinition);
if((i+1)%BONUS_TROPHY_MULTIPLE == 0) bonusTrophyDefinitions.add(gameTrophyDefinition);
else checkTrophy(gameTrophyDefinition, user, gotTrophies, i);
i++;
}
i=6;
for(GameTrophyDefinition bonusTrophyDefinition: bonusTrophyDefinitions){
checkTrophy(bonusTrophyDefinition, user, gotTrophies, i-1);
i+=BONUS_TROPHY_MULTIPLE;
}
}
private void checkTrophyEmpty(GameTrophyDefinition gameTrophyDefinition, User user){
writeToLogFile("\tCheck empty trophy: " + gameTrophyDefinition.toString() + "\n");
swipeToActor("\t\ta. Swipe to trophy " + gameTrophyDefinition.toString(), gameTrophyDefinition.getTrophyName());
checkTrophyEmpty(user, gameTrophyDefinition);
}
protected void checkAllTrophiesEmpty(int stepNumber, User user) {
writeToLogFile(stepNumber + ". Check if all trophies are empty:\n");
List<GameTrophyDefinition> bonusTrophyDefinitions = new ArrayList<>();
int i=0;
for (GameTrophyDefinition gameTrophyDefinition : GameTrophyDefinition.values()) {
writeToLogFile("\tCheck trophy: " + gameTrophyDefinition.toString() + "\n");
swipeToActor("\t\ta. Swipe to trophy " + gameTrophyDefinition.toString(), gameTrophyDefinition.getTrophyName());
checkTrophyEmpty(user, gameTrophyDefinition);
if((i+1)%BONUS_TROPHY_MULTIPLE == 0) bonusTrophyDefinitions.add(gameTrophyDefinition);
else checkTrophyEmpty(gameTrophyDefinition, user);
i++;
}
for(GameTrophyDefinition bonusTrophyDefinition: bonusTrophyDefinitions) checkTrophyEmpty(bonusTrophyDefinition, user);
}
protected void addNewScoreAndGoToHallOfFame(int stepNumber, User user, GameDifficulty gameDifficulty, GameDefinition gameDefinition, AbstractTablexiaGame.GameResult gameResult) {
......
......@@ -208,7 +208,7 @@ public class TestScenarioHallOfFameCrimeSceneTrophies extends AbstractTestScenar
false, false, false, false, false, false}); //SAFE
writeToLogFile("\nADD GAME CRIME_SCENE BONUS 2 STARS ---> CHECK TROPHIES\n");
addNewScoreAndGoToHallOfFame(31, user, GameDifficulty.BONUS, GameDefinition.CRIME_SCENE, AbstractTablexiaGame.GameResult.TWO_STAR); //get _BONUS
addNewScoreAndGoToHallOfFame(31, user, GameDifficulty.BONUS, GameDefinition.CRIME_SCENE, AbstractTablexiaGame.GameResult.THREE_STAR); //get _BONUS
checkGameTrophies(32, user, new boolean[]{ false, false, false, false, false, false, //ROBBERY
false, false, false, false, false, false, //PURSUIT
false, false, false, false, false, false, //KIDNAPPING
......
......@@ -209,7 +209,7 @@ public class TestScenarioHallOfFameInTheDarknessTrophies extends AbstractTestSce
false, false, false, false, false, false}); //SAFE
writeToLogFile("\nADD GAME IN_THE_DARKNESS BONUS 1 STAR ---> CHECK TROPHIES\n");
addNewScoreAndGoToHallOfFame(31, user, GameDifficulty.BONUS, GameDefinition.IN_THE_DARKNESS, AbstractTablexiaGame.GameResult.ONE_STAR); //get _BONUS
addNewScoreAndGoToHallOfFame(31, user, GameDifficulty.BONUS, GameDefinition.IN_THE_DARKNESS, AbstractTablexiaGame.GameResult.THREE_STAR); //get _BONUS
checkGameTrophies(32, user, new boolean[]{ false, false, false, false, false, false, //ROBBERY
false, false, false, false, false, false, //PURSUIT
false, false, false, false, false, false, //KIDNAPPING
......
......@@ -208,7 +208,7 @@ public class TestScenarioHallOfFameKidnappingTrophies extends AbstractTestScenar
false, false, false, false, false, false}); //SAFE
writeToLogFile("\nADD GAME KIDNAPPING BONUS 0 STARS ---> CHECK TROPHIES\n");
addNewScoreAndGoToHallOfFame(31, user, GameDifficulty.BONUS, GameDefinition.KIDNAPPING, AbstractTablexiaGame.GameResult.NO_STAR); //get _BONUS
addNewScoreAndGoToHallOfFame(31, user, GameDifficulty.BONUS, GameDefinition.KIDNAPPING, AbstractTablexiaGame.GameResult.THREE_STAR); //get _BONUS
checkGameTrophies(32, user, new boolean[]{ false, false, false, false, false, false, //ROBBERY
false, false, false, false, false, false, //PURSUIT
true, true, true, true, true, true, //KIDNAPPING
......
......@@ -208,7 +208,7 @@ public class TestScenarioHallOfFamePursuitTrophies extends AbstractTestScenarioH
false, false, false, false, false, false}); //SAFE
writeToLogFile("\nADD GAME PURSUIT BONUS 1 STAR ---> CHECK TROPHIES\n");
addNewScoreAndGoToHallOfFame(31, user, GameDifficulty.BONUS, GameDefinition.PURSUIT, AbstractTablexiaGame.GameResult.ONE_STAR); //get _BONUS
addNewScoreAndGoToHallOfFame(31, user, GameDifficulty.BONUS, GameDefinition.PURSUIT, AbstractTablexiaGame.GameResult.THREE_STAR); //get _BONUS
checkGameTrophies(32, user, new boolean[]{ false, false, false, false, false, false, //ROBBERY
true, true, true, true, true, true, //PURSUIT
false, false, false, false, false, false, //KIDNAPPING
......
......@@ -208,7 +208,7 @@ public class TestScenarioHallOfFameRobberyTrophies extends AbstractTestScenarioH
false, false, false, false, false, false}); //SAFE
writeToLogFile("\nADD GAME ROBBERY BONUS 2 STARS ---> CHECK TROPHIES\n");
addNewScoreAndGoToHallOfFame(31, user, GameDifficulty.BONUS, GameDefinition.ROBBERY, AbstractTablexiaGame.GameResult.TWO_STAR); //get _BONUS
addNewScoreAndGoToHallOfFame(31, user, GameDifficulty.BONUS, GameDefinition.ROBBERY, AbstractTablexiaGame.GameResult.THREE_STAR); //get _BONUS
checkGameTrophies(32, user, new boolean[]{ true, true, true, true, true, true, //ROBBERY
false, false, false, false, false, false, //PURSUIT
false, false, false, false, false, false, //KIDNAPPING
......
......@@ -205,7 +205,7 @@ public class TestScenarioHallOfFameSafeTrophies extends AbstractTestScenarioHall
true, true, true, true, true, false}); //SAFE
writeToLogFile("\nADD GAME SAFE BONUS 1 STAR ---> CHECK TROPHIES\n");
addNewScoreAndGoToHallOfFame(31, user, GameDifficulty.BONUS, GameDefinition.SAFE, AbstractTablexiaGame.GameResult.ONE_STAR); //get _BONUS
addNewScoreAndGoToHallOfFame(31, user, GameDifficulty.BONUS, GameDefinition.SAFE, AbstractTablexiaGame.GameResult.THREE_STAR); //get _BONUS
checkGameTrophies(32, user, new boolean[]{ false, false, false, false, false, false, //ROBBERY
false, false, false, false, false, false, //PURSUIT
false, false, false, false, false, false, //KIDNAPPING
......
......@@ -208,7 +208,7 @@ public class TestScenarioHallOfFameShootingRangeTrophies extends AbstractTestSce
false, false, false, false, false, false}); //SAFE
writeToLogFile("\nADD GAME SHOOTING_RANGE BONUS 0 STARS ---> CHECK TROPHIES\n");
addNewScoreAndGoToHallOfFame(31, user, GameDifficulty.BONUS, GameDefinition.SHOOTING_RANGE, AbstractTablexiaGame.GameResult.NO_STAR); //get _BONUS
addNewScoreAndGoToHallOfFame(31, user, GameDifficulty.BONUS, GameDefinition.SHOOTING_RANGE, AbstractTablexiaGame.GameResult.THREE_STAR); //get _BONUS
checkGameTrophies(32, user, new boolean[]{ false, false, false, false, false, false, //ROBBERY
false, false, false, false, false, false, //PURSUIT
false, false, false, false, false, false, //KIDNAPPING
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment