fixed verify test not checking split/aftermath cards correctly

This commit is contained in:
Evan Kranzler 2021-10-12 09:35:53 -04:00
parent f98069e829
commit b0a2abb205
2 changed files with 9 additions and 7 deletions

View file

@ -40,6 +40,8 @@ public final class MtgJsonCard {
|| "flip".equals(layout) || "flip".equals(layout)
|| "adventure".equals(layout) || "adventure".equals(layout)
|| "modal_dfc".equals(layout) || "modal_dfc".equals(layout)
|| "split".equals(layout)
|| "aftermath".equals(layout)
|| "meld".equals(layout)) { // mtgjson uses composite names for meld cards, but scryfall uses simple face names || "meld".equals(layout)) { // mtgjson uses composite names for meld cards, but scryfall uses simple face names
return faceName; return faceName;
} }

View file

@ -262,13 +262,13 @@ public class VerifyCardDataTest {
for (Card card : CardScanner.getAllCards()) { for (Card card : CardScanner.getAllCards()) {
cardIndex++; cardIndex++;
if (card instanceof SplitCard) { if (card instanceof SplitCard) {
check(((SplitCard) card).getLeftHalfCard(), cardIndex, true); check(((SplitCard) card).getLeftHalfCard(), cardIndex);
check(((SplitCard) card).getRightHalfCard(), cardIndex, true); check(((SplitCard) card).getRightHalfCard(), cardIndex);
} else if (card instanceof ModalDoubleFacesCard) { } else if (card instanceof ModalDoubleFacesCard) {
check(((ModalDoubleFacesCard) card).getLeftHalfCard(), cardIndex, false); check(((ModalDoubleFacesCard) card).getLeftHalfCard(), cardIndex);
check(((ModalDoubleFacesCard) card).getRightHalfCard(), cardIndex, false); check(((ModalDoubleFacesCard) card).getRightHalfCard(), cardIndex);
} else { } else {
check(card, cardIndex, false); check(card, cardIndex);
} }
} }
@ -1231,11 +1231,11 @@ public class VerifyCardDataTest {
} }
} }
private void check(Card card, int cardIndex, boolean skipWarning) { private void check(Card card, int cardIndex) {
MtgJsonCard ref = MtgJsonService.cardFromSet(card.getExpansionSetCode(), card.getName(), card.getCardNumber()); MtgJsonCard ref = MtgJsonService.cardFromSet(card.getExpansionSetCode(), card.getName(), card.getCardNumber());
if (ref != null) { if (ref != null) {
checkAll(card, ref, cardIndex); checkAll(card, ref, cardIndex);
} else if (!skipWarning && !ONLY_TEXT) { } else {
warn(card, "Missing card reference"); warn(card, "Missing card reference");
} }
} }