mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 09:05:10 -07:00
Support tab-separated deck imports (#4222)
Third-party deck tools (e.g. Delver Lens) export decks as tab-separated rows such as "2 Card Name Set Name". Card names never contain tab characters, so a leading numeric column marks a tabular record: the first two columns are read as the quantity and card name, and any further columns are discarded as printer/set metadata. - deck_list: parse tab-delimited rows before whitespace collapsing - tests: cover tab-separated mainboard and sideboard imports - docs: document the accepted plain-text import format (fills the TODO)
This commit is contained in:
parent
fb482f037e
commit
7d907e54d0
3 changed files with 60 additions and 7 deletions
|
|
@ -74,6 +74,20 @@ TEST(LoadingFromClipboardTest, WeirdWhitespaceIsIgnored)
|
|||
testDeck(clipboard, result);
|
||||
}
|
||||
|
||||
TEST(LoadingFromClipboardTest, TabSeparatedImport)
|
||||
{
|
||||
QString clipboard("2\tMystic Snake\tStreets of New Capenna\n"
|
||||
"3x\tCounterspell\tNPH\n"
|
||||
"\t2\tSol Ring\tFMB\n"
|
||||
"1\tForest\n"
|
||||
"\n"
|
||||
"2x\tDoom Blade\tM11\n");
|
||||
|
||||
Result result("", "", {{"Mystic Snake", 2}, {"Counterspell", 3}, {"Sol Ring", 2}, {"Forest", 1}},
|
||||
{{"Doom Blade", 2}});
|
||||
testDeck(clipboard, result);
|
||||
}
|
||||
|
||||
TEST(LoadingFromClipboardTest, RemoveBlankEntriesFromBeginningAndEnd)
|
||||
{
|
||||
QString clipboard("\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue