Merge pull request #3371 from drmDev/master

minor adjustments to new perspectives test
This commit is contained in:
Derek M 2017-05-13 13:13:32 -04:00 committed by GitHub
commit e5a69134c8

View file

@ -16,7 +16,9 @@ public class NewPerspectivesTest extends CardTestPlayerBase {
When New Perspectives enters the battlefield, draw three cards. When New Perspectives enters the battlefield, draw three cards.
As long as you have seven or more cards in hand, you may pay 0 rather than pay cycling costs. As long as you have seven or more cards in hand, you may pay 0 rather than pay cycling costs.
*/ */
private String nPerspectives = "New Perspectives"; private final String newPerspectives = "New Perspectives";
private final String reliquaryTower = "Reliquary Tower"; // only used to not have to discard due to hand size to make testing easier
private final String flameJet = "Flame Jet"; // just a cycle card with (2) cycling
/** /**
* just a basic test for free cycling! * just a basic test for free cycling!
@ -24,22 +26,21 @@ public class NewPerspectivesTest extends CardTestPlayerBase {
@Test @Test
public void newPerspectives_7Cards_FreeCycling() { public void newPerspectives_7Cards_FreeCycling() {
String fJet = "Flame Jet"; // {1}{R} Sorcery deal 3 dmg to player. cycling (2)
removeAllCardsFromHand(playerA); removeAllCardsFromHand(playerA);
addCard(Zone.BATTLEFIELD, playerA, "Island", 6); addCard(Zone.BATTLEFIELD, playerA, "Island", 5);
addCard(Zone.HAND, playerA, nPerspectives); addCard(Zone.BATTLEFIELD, playerA, reliquaryTower);
addCard(Zone.HAND, playerA, newPerspectives);
addCard(Zone.HAND, playerA, "Mountain", 3); addCard(Zone.HAND, playerA, "Mountain", 3);
addCard(Zone.HAND, playerA, fJet); addCard(Zone.HAND, playerA, flameJet);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, nPerspectives); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, newPerspectives);
activateAbility(1, PhaseStep.BEGIN_COMBAT, playerA, "Cycling"); activateAbility(1, PhaseStep.BEGIN_COMBAT, playerA, "Cycling");
setStopAt(1, PhaseStep.END_COMBAT); setStopAt(1, PhaseStep.END_COMBAT);
execute(); execute();
assertPermanentCount(playerA, nPerspectives, 1); assertPermanentCount(playerA, newPerspectives, 1);
assertGraveyardCount(playerA, fJet, 1); assertGraveyardCount(playerA, flameJet, 1);
assertHandCount(playerA, 7); // 4 + 3 (new perspectives ETB) (+ 1 - 1) (cycling) assertHandCount(playerA, 7); // 4 + 3 (new perspectives ETB) (+ 1 - 1) (cycling)
} }
@ -49,22 +50,21 @@ public class NewPerspectivesTest extends CardTestPlayerBase {
@Test @Test
public void newPerspectives_LessThan7Cards_CyclingNotFree() { public void newPerspectives_LessThan7Cards_CyclingNotFree() {
String fJet = "Flame Jet"; // {1}{R} Sorcery deal 3 dmg to player. cycling (2)
removeAllCardsFromHand(playerA); removeAllCardsFromHand(playerA);
addCard(Zone.BATTLEFIELD, playerA, "Island", 6); addCard(Zone.BATTLEFIELD, playerA, "Island", 5);
addCard(Zone.HAND, playerA, nPerspectives); addCard(Zone.BATTLEFIELD, playerA, reliquaryTower);
addCard(Zone.HAND, playerA, fJet); addCard(Zone.HAND, playerA, newPerspectives);
addCard(Zone.HAND, playerA, flameJet);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, nPerspectives); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, newPerspectives);
activateAbility(1, PhaseStep.BEGIN_COMBAT, playerA, "Cycling"); activateAbility(1, PhaseStep.BEGIN_COMBAT, playerA, "Cycling");
setStopAt(1, PhaseStep.END_COMBAT); setStopAt(1, PhaseStep.END_COMBAT);
execute(); execute();
assertPermanentCount(playerA, nPerspectives, 1); assertPermanentCount(playerA, newPerspectives, 1);
assertGraveyardCount(playerA, fJet, 0); assertGraveyardCount(playerA, flameJet, 0);
assertHandCount(playerA, fJet, 1); assertHandCount(playerA, flameJet, 1);
assertHandCount(playerA, 4); // 1 + 3 (new perspectives ETB) assertHandCount(playerA, 4); // 1 + 3 (new perspectives ETB)
} }
@ -75,53 +75,51 @@ public class NewPerspectivesTest extends CardTestPlayerBase {
@Test @Test
public void newPerspectives_PlayingSecondOneWithFewerThan7CardsOnCast() { public void newPerspectives_PlayingSecondOneWithFewerThan7CardsOnCast() {
String fJet = "Flame Jet"; // {1}{R} Sorcery deal 3 dmg to player. cycling (2)
removeAllCardsFromHand(playerA); removeAllCardsFromHand(playerA);
addCard(Zone.BATTLEFIELD, playerA, "Island", 6); addCard(Zone.BATTLEFIELD, playerA, "Island", 5);
addCard(Zone.HAND, playerA, nPerspectives, 2); addCard(Zone.BATTLEFIELD, playerA, reliquaryTower);
addCard(Zone.HAND, playerA, fJet); addCard(Zone.HAND, playerA, newPerspectives, 2);
addCard(Zone.HAND, playerA, flameJet);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, nPerspectives); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, newPerspectives);
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, nPerspectives); castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, newPerspectives);
activateAbility(3, PhaseStep.BEGIN_COMBAT, playerA, "Cycling"); activateAbility(3, PhaseStep.BEGIN_COMBAT, playerA, "Cycling");
setStopAt(3, PhaseStep.END_COMBAT); setStopAt(3, PhaseStep.END_COMBAT);
execute(); execute();
assertPermanentCount(playerA, nPerspectives, 2); assertPermanentCount(playerA, newPerspectives, 2);
assertHandCount(playerA, 8); // 1 (flame jet cycled) + 3 (new perspectives ETB) + 1 (draw step) + 3 (2nd perspectives etb) assertHandCount(playerA, 8); // 1 (flame jet cycled) + 3 (new perspectives ETB) + 1 (draw step) + 3 (2nd perspectives etb)
assertGraveyardCount(playerA, fJet, 1); assertGraveyardCount(playerA, flameJet, 1);
} }
/* /*
* Reported bug for #3323: NOTE test failing due to bug in code (game freezes after casting 2nd new perspectives) * Reported bug for #3323:
* If you cast a second copy of New Perspective while the first one is still in play, the client will freeze. * If you cast a second copy of New Perspective while the first one is still in play, the client will freeze.
* Unable to reproduce by Unit Test, only through manual test.
*/ */
@Test @Test
public void newPerspectives_PlayingSecondOneWithMoreThan7CardsOnCast() { public void newPerspectives_PlayingSecondOneWithMoreThan7CardsOnCast() {
String fJet = "Flame Jet"; // {1}{R} Sorcery deal 3 dmg to player. cycling (2)
removeAllCardsFromHand(playerA); removeAllCardsFromHand(playerA);
addCard(Zone.BATTLEFIELD, playerA, "Island", 6); addCard(Zone.BATTLEFIELD, playerA, "Island", 5);
addCard(Zone.HAND, playerA, nPerspectives, 2); addCard(Zone.BATTLEFIELD, playerA, reliquaryTower);
//this made test buggy: addCard(Zone.HAND, playerA, "Mountain", 3); addCard(Zone.HAND, playerA, newPerspectives, 2);
addCard(Zone.HAND, playerA, fJet); addCard(Zone.HAND, playerA, "Mountain", 3);
addCard(Zone.HAND, playerA, flameJet);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, nPerspectives); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, newPerspectives);
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, nPerspectives); castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, newPerspectives);
activateAbility(3, PhaseStep.BEGIN_COMBAT, playerA, "Cycling"); activateAbility(3, PhaseStep.BEGIN_COMBAT, playerA, "Cycling");
setStopAt(3, PhaseStep.END_COMBAT); setStopAt(3, PhaseStep.END_COMBAT);
execute(); execute();
assertGraveyardCount(playerA, nPerspectives, 0); // check it wasn't discarded assertGraveyardCount(playerA, newPerspectives, 0); // check it wasn't discarded
assertPermanentCount(playerA, nPerspectives, 2); assertPermanentCount(playerA, newPerspectives, 2);
assertGraveyardCount(playerA, fJet, 1); assertGraveyardCount(playerA, flameJet, 1);
//assertHandCount(playerA, 11); // 1 (flame jet cycled) + 3 Mountains in hand + 3 (new perspectives ETB) + 1 (draw step) + 3 (2nd perspectives etb) assertHandCount(playerA, 11); // 1 (flame jet cycled) + 3 Mountains in hand + 3 (new perspectives ETB) + 1 (draw step) + 3 (2nd perspectives etb)
assertHandCount(playerA, 8); // 1 (flame jet cycled) + 3 (new perspectives ETB) + 1 (draw step) + 3 (2nd perspectives etb)
} }
} }