mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
UI: improved deck editor exports:
* added deck export to files (#4243); * fixed wrong card sorting in deck files after save (#3719);
This commit is contained in:
parent
8b5993805a
commit
04cb20f46a
14 changed files with 482 additions and 340 deletions
|
|
@ -1,31 +0,0 @@
|
|||
package mage.cards.decks.exporter;
|
||||
|
||||
import mage.cards.decks.DeckCardInfo;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class DckExporterTest {
|
||||
|
||||
@Test
|
||||
public void writeDeck() throws IOException {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
DeckCardLists deck = new DeckCardLists();
|
||||
deck.getCards().add(new DeckCardInfo("Forest", "RNA", "1", 2));
|
||||
deck.getCards().add(new DeckCardInfo("Plains", "RNA", "2", 3));
|
||||
deck.getSideboard().add(new DeckCardInfo("Island", "RNA", "3", 2));
|
||||
DckExporter exporter = new DckExporter();
|
||||
exporter.writeDeck(baos, deck);
|
||||
assertEquals("2 [1:RNA] Forest" + System.lineSeparator() +
|
||||
"3 [2:RNA] Plains" + System.lineSeparator() +
|
||||
"SB: 2 [3:RNA] Island" + System.lineSeparator() +
|
||||
"LAYOUT MAIN:" + System.lineSeparator() +
|
||||
"LAYOUT SIDEBOARD:" + System.lineSeparator(),
|
||||
baos.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ import java.io.IOException;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class MtgoExporterTest {
|
||||
public class MtgoDeckExporterTest {
|
||||
|
||||
@Test
|
||||
public void writeDeck() throws IOException {
|
||||
|
|
@ -18,7 +18,7 @@ public class MtgoExporterTest {
|
|||
deck.getCards().add(new DeckCardInfo("Forest", "RNA", "1", 2));
|
||||
deck.getCards().add(new DeckCardInfo("Plains", "RNA", "2", 3));
|
||||
deck.getSideboard().add(new DeckCardInfo("Island", "RNA", "3", 2));
|
||||
MtgoExporter exporter = new MtgoExporter();
|
||||
MtgoDeckExporter exporter = new MtgoDeckExporter();
|
||||
exporter.writeDeck(baos, deck);
|
||||
assertEquals("2 Forest" + System.lineSeparator() +
|
||||
"3 Plains" + System.lineSeparator() +
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package mage.cards.decks.exporter;
|
||||
|
||||
import mage.cards.decks.DeckCardInfo;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class XmageDeckExporterTest {
|
||||
|
||||
@Test
|
||||
public void writeDeck() throws IOException {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
DeckCardLists deck = new DeckCardLists();
|
||||
deck.getCards().add(new DeckCardInfo("Forest", "1", "RNA", 2));
|
||||
deck.getCards().add(new DeckCardInfo("Plains", "2", "RNA", 3));
|
||||
deck.getCards().add(new DeckCardInfo("Plains", "2", "RNA", 5)); // must combine
|
||||
deck.getCards().add(new DeckCardInfo("Mountain", "3", "RNA", 1));
|
||||
deck.getSideboard().add(new DeckCardInfo("Island", "1", "RNA", 2));
|
||||
deck.getSideboard().add(new DeckCardInfo("Island", "1", "RNA", 5)); // must combine
|
||||
deck.getSideboard().add(new DeckCardInfo("Mountain", "2", "RNA", 3));
|
||||
XmageDeckExporter exporter = new XmageDeckExporter();
|
||||
exporter.writeDeck(baos, deck);
|
||||
assertEquals("2 [RNA:1] Forest" + System.lineSeparator() +
|
||||
"8 [RNA:2] Plains" + System.lineSeparator() +
|
||||
"1 [RNA:3] Mountain" + System.lineSeparator() +
|
||||
"SB: 7 [RNA:1] Island" + System.lineSeparator() +
|
||||
"SB: 3 [RNA:2] Mountain" + System.lineSeparator(),
|
||||
baos.toString());
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue