Search in sources :

Example 6 with GamesBackup

use of com.nolanlawson.keepscore.serialization.GamesBackup in project KeepScore by nolanlawson.

the class SerializationTest method testGamesBackup.

private void testGamesBackup(GamesBackup gamesBackup) {
    String xmlData = GamesBackupSerializer.serialize(gamesBackup);
    GamesBackup deserializedGamesBackup = GamesBackupSerializer.deserialize(xmlData);
    compareGamesBackups(gamesBackup, deserializedGamesBackup);
}
Also used : GamesBackup(com.nolanlawson.keepscore.serialization.GamesBackup)

Example 7 with GamesBackup

use of com.nolanlawson.keepscore.serialization.GamesBackup in project KeepScore by nolanlawson.

the class SerializationTest method testSingleGame.

public void testSingleGame() {
    GamesBackup gamesBackup = createRandomGamesBackup();
    gamesBackup.setGames(Collections.singletonList(gamesBackup.getGames().get(0)));
    testGamesBackup(gamesBackup);
}
Also used : GamesBackup(com.nolanlawson.keepscore.serialization.GamesBackup)

Example 8 with GamesBackup

use of com.nolanlawson.keepscore.serialization.GamesBackup in project KeepScore by nolanlawson.

the class SerializationTest method testNullsAndEmpties.

public void testNullsAndEmpties() {
    GamesBackup gamesBackup = createRandomGamesBackup();
    gamesBackup.getGames().get(0).setName(null);
    gamesBackup.getGames().get(1).setName("");
    gamesBackup.getGames().get(0).getPlayerScores().get(0).setName(null);
    gamesBackup.getGames().get(0).getPlayerScores().get(0).setPlayerColor(PlayerColor.BUILT_INS[7]);
    gamesBackup.getGames().get(0).getPlayerScores().get(1).setName("");
    gamesBackup.getGames().get(0).getPlayerScores().get(1).setPlayerColor(new CustomPlayerColor(Color.parseColor("#FF00FF00")));
    gamesBackup.getGames().get(0).getPlayerScores().get(0).setHistory(Collections.<Delta>emptyList());
    testGamesBackup(gamesBackup);
}
Also used : CustomPlayerColor(com.nolanlawson.keepscore.helper.PlayerColor.CustomPlayerColor) GamesBackup(com.nolanlawson.keepscore.serialization.GamesBackup)

Example 9 with GamesBackup

use of com.nolanlawson.keepscore.serialization.GamesBackup in project KeepScore by nolanlawson.

the class SerializationTest method testBasicSerialization.

public void testBasicSerialization() {
    GamesBackup gamesBackup = createRandomGamesBackup();
    testGamesBackup(gamesBackup);
}
Also used : GamesBackup(com.nolanlawson.keepscore.serialization.GamesBackup)

Aggregations

GamesBackup (com.nolanlawson.keepscore.serialization.GamesBackup)9 Game (com.nolanlawson.keepscore.db.Game)4 GameDBHelper (com.nolanlawson.keepscore.db.GameDBHelper)3 ArrayList (java.util.ArrayList)2 ProgressDialog (android.app.ProgressDialog)1 LoadGamesBackupResult (com.nolanlawson.keepscore.data.LoadGamesBackupResult)1 CustomPlayerColor (com.nolanlawson.keepscore.helper.PlayerColor.CustomPlayerColor)1 List (java.util.List)1