mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-13 05:20:00 -08:00
Test Identity, ATK/HP, Attack, Armour and Health column sorting and legacy field mapping
This commit is contained in:
parent
ea0ff5c8df
commit
fbd5a58dd1
1 changed files with 39 additions and 0 deletions
|
|
@ -26,6 +26,7 @@
|
||||||
#include <libcockatrice/card/card_info.h>
|
#include <libcockatrice/card/card_info.h>
|
||||||
#include <libcockatrice/card/database/card_database_data.h>
|
#include <libcockatrice/card/database/card_database_data.h>
|
||||||
#include <libcockatrice/card/database/parser/cockatrice_xml_4.h>
|
#include <libcockatrice/card/database/parser/cockatrice_xml_4.h>
|
||||||
|
#include <libcockatrice/card/game_specific_terms.h>
|
||||||
#include <libcockatrice/card/lazy_properties_hash.h>
|
#include <libcockatrice/card/lazy_properties_hash.h>
|
||||||
#include <libcockatrice/card/printing/printing_info.h>
|
#include <libcockatrice/card/printing/printing_info.h>
|
||||||
#include <libcockatrice/card/relation/card_relation.h>
|
#include <libcockatrice/card/relation/card_relation.h>
|
||||||
|
|
@ -87,6 +88,44 @@ TEST(CardDatabaseTest, EmptyLoadedSnapshotIsReadyNotLoading)
|
||||||
EXPECT_EQ(NotLoaded, db.getLoadStatus());
|
EXPECT_EQ(NotLoaded, db.getLoadStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(CardInfoTest, ContinuumIdentityAndStatsHaveNativeAndLegacyPropertyAccess)
|
||||||
|
{
|
||||||
|
auto native = CardInfo::newInstance("Native Continuum Card");
|
||||||
|
native->setProperty("identity", "The Shadow Queen");
|
||||||
|
native->setProperty("attack", "10");
|
||||||
|
native->setProperty("armour", "3");
|
||||||
|
native->setProperty("health", "12");
|
||||||
|
|
||||||
|
EXPECT_EQ(native->getIdentity(), "The Shadow Queen");
|
||||||
|
EXPECT_EQ(native->getAttack(), "10");
|
||||||
|
EXPECT_EQ(native->getArmour(), "3");
|
||||||
|
EXPECT_EQ(native->getHealth(), "12");
|
||||||
|
EXPECT_EQ(native->getAtkHp(), "10/12");
|
||||||
|
EXPECT_EQ(native->getPowTough(), "10/12"); // Legacy accessor remains useful.
|
||||||
|
|
||||||
|
auto legacyMse = CardInfo::newInstance("Legacy Continuum Card");
|
||||||
|
legacyMse->setProperty("alias", "The Guardian");
|
||||||
|
legacyMse->setProperty("strength", "9");
|
||||||
|
legacyMse->setProperty("armor", "4");
|
||||||
|
legacyMse->setProperty("health", "8");
|
||||||
|
EXPECT_EQ(legacyMse->getIdentity(), "The Guardian");
|
||||||
|
EXPECT_EQ(legacyMse->getAttack(), "9");
|
||||||
|
EXPECT_EQ(legacyMse->getArmour(), "4");
|
||||||
|
EXPECT_EQ(legacyMse->getHealth(), "8");
|
||||||
|
EXPECT_EQ(legacyMse->getAtkHp(), "9/8");
|
||||||
|
|
||||||
|
auto oldPt = CardInfo::newInstance("Old Imported Card");
|
||||||
|
oldPt->setProperty(Mtg::PowTough, "2/7");
|
||||||
|
EXPECT_EQ(oldPt->getAttack(), "2");
|
||||||
|
EXPECT_EQ(oldPt->getHealth(), "7");
|
||||||
|
EXPECT_EQ(oldPt->getAtkHp(), "2/7");
|
||||||
|
|
||||||
|
// Missing values should not be represented as false zeroes.
|
||||||
|
auto blank = CardInfo::newInstance("No Stats");
|
||||||
|
EXPECT_TRUE(blank->getAtkHp().isEmpty());
|
||||||
|
EXPECT_TRUE(blank->getArmour().isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
TEST(CardDatabaseTest, LazyPropertiesHashStreamsBlobAccessors)
|
TEST(CardDatabaseTest, LazyPropertiesHashStreamsBlobAccessors)
|
||||||
{
|
{
|
||||||
QHash<QString, QString> props;
|
QHash<QString, QString> props;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue