[DeckList] Refactor load from plaintext to take normalizer as param (#6664)

* [DeckList] Refactor load from plaintext to take normalizer as param

* update usages

* weaken unit test

* weaken unit test more

* revert unit test

* move CardNameNormalizer to libcockatrice_card

* update unit test

* formatting
This commit is contained in:
RickyRister 2026-03-06 10:39:04 -08:00 committed by GitHub
parent bd5cbb89d4
commit dead993639
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 94 additions and 52 deletions

View file

@ -10,6 +10,7 @@ set(TEST_QT_MODULES ${COCKATRICE_QT_VERSION_NAME}::Concurrent ${COCKATRICE_QT_VE
)
target_link_libraries(
loading_from_clipboard_test libcockatrice_deck_list Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES}
loading_from_clipboard_test libcockatrice_deck_list libcockatrice_card Threads::Threads ${GTEST_BOTH_LIBRARIES}
${TEST_QT_MODULES}
)
add_test(NAME loading_from_clipboard_test COMMAND loading_from_clipboard_test)

View file

@ -1,6 +1,7 @@
#include "clipboard_testing.h"
#include <QTextStream>
#include <libcockatrice/card/import/card_name_normalizer.h>
#include <libcockatrice/deck_list/tree/deck_list_card_node.h>
DeckList getDeckList(const QString &clipboard)
@ -8,7 +9,7 @@ DeckList getDeckList(const QString &clipboard)
DeckList deckList;
QString cp(clipboard);
QTextStream stream(&cp); // text stream requires local copy
deckList.loadFromStream_Plain(stream, false);
deckList.loadFromStream_Plain(stream, false, CardNameNormalizer());
return deckList;
}