mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-03-12 21:22:55 -07:00
[DeckList] Fix double-faced cards not importing correctly (#6665)
* [DeckList] Fix double-faced cards not importing correctly * make tests compile
This commit is contained in:
@@ -1,7 +1,25 @@
|
||||
#include "card_name_normalizer.h"
|
||||
|
||||
#include "../database/card_database_manager.h"
|
||||
#include "../printing/exact_card.h"
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
/**
|
||||
* @brief Resolves the complete display name of a card.
|
||||
* @param cardName Base name.
|
||||
* @return Full display name, or the cardName unchanged if a display name is not found.
|
||||
*/
|
||||
static QString getCompleteCardName(const QString &cardName)
|
||||
{
|
||||
ExactCard temp = CardDatabaseManager::query()->guessCard({cardName});
|
||||
if (temp) {
|
||||
return temp.getName();
|
||||
}
|
||||
|
||||
return cardName;
|
||||
}
|
||||
|
||||
QString CardNameNormalizer::operator()(const QString &cardNameString) const
|
||||
{
|
||||
QString cardName = cardNameString;
|
||||
@@ -41,5 +59,8 @@ QString CardNameNormalizer::operator()(const QString &cardNameString) const
|
||||
cardName.replace(diff.key(), diff.value());
|
||||
}
|
||||
|
||||
// Resolve complete card name
|
||||
cardName = getCompleteCardName(cardName);
|
||||
|
||||
return cardName;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
add_definitions("-DCARDDB_DATADIR=\"${CMAKE_CURRENT_SOURCE_DIR}/data/\"")
|
||||
add_executable(loading_from_clipboard_test clipboard_testing.cpp loading_from_clipboard_test.cpp)
|
||||
add_executable(loading_from_clipboard_test ${VERSION_STRING_CPP} clipboard_testing.cpp loading_from_clipboard_test.cpp)
|
||||
|
||||
if(NOT GTEST_FOUND)
|
||||
add_dependencies(loading_from_clipboard_test gtest)
|
||||
|
||||
Reference in New Issue
Block a user