mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 08:14:47 -07:00
Fix release tests (#4063)
This commit is contained in:
parent
80f613a77a
commit
44297dcd1c
57 changed files with 1114 additions and 697 deletions
|
|
@ -1,4 +1,12 @@
|
|||
ADD_DEFINITIONS("-DCARDDB_DATADIR=\"${CMAKE_CURRENT_SOURCE_DIR}/data/\"")
|
||||
|
||||
find_package(Qt5 COMPONENTS Concurrent Network Widgets Svg REQUIRED)
|
||||
|
||||
QT5_WRAP_CPP(MOCKS_SOURCES
|
||||
../../cockatrice/src/settingscache.h
|
||||
../../cockatrice/src/settings/carddatabasesettings.h
|
||||
)
|
||||
|
||||
add_executable(carddatabase_test
|
||||
carddatabase_test.cpp
|
||||
mocks.cpp
|
||||
|
|
@ -6,7 +14,9 @@ add_executable(carddatabase_test
|
|||
../../cockatrice/src/carddbparser/carddatabaseparser.cpp
|
||||
../../cockatrice/src/carddbparser/cockatricexml3.cpp
|
||||
../../cockatrice/src/carddbparser/cockatricexml4.cpp
|
||||
../../cockatrice/src/settings/settingsmanager.cpp
|
||||
${VERSION_STRING_CPP}
|
||||
${MOCKS_SOURCES}
|
||||
)
|
||||
add_executable(filter_string_test
|
||||
filter_string_test.cpp
|
||||
|
|
@ -18,14 +28,15 @@ add_executable(filter_string_test
|
|||
../../cockatrice/src/carddbparser/carddatabaseparser.cpp
|
||||
../../cockatrice/src/carddbparser/cockatricexml3.cpp
|
||||
../../cockatrice/src/carddbparser/cockatricexml4.cpp
|
||||
../../cockatrice/src/settings/settingsmanager.cpp
|
||||
${VERSION_STRING_CPP}
|
||||
${MOCKS_SOURCES}
|
||||
)
|
||||
if(NOT GTEST_FOUND)
|
||||
add_dependencies(carddatabase_test gtest)
|
||||
add_dependencies(filter_string_test gtest)
|
||||
endif()
|
||||
|
||||
find_package(Qt5 COMPONENTS Concurrent Network Widgets Svg REQUIRED)
|
||||
set(TEST_QT_MODULES Qt5::Concurrent Qt5::Network Qt5::Widgets Qt5::Svg)
|
||||
|
||||
target_link_libraries(carddatabase_test Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES})
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
|
||||
#include "mocks.h"
|
||||
|
||||
CardDatabaseSettings::CardDatabaseSettings(QString settingPath, QObject *parent)
|
||||
: SettingsManager(settingPath + "cardDatabase.ini", parent)
|
||||
{
|
||||
}
|
||||
void CardDatabaseSettings::setSortKey(QString /* shortName */, unsigned int /* sortKey */){};
|
||||
void CardDatabaseSettings::setEnabled(QString /* shortName */, bool /* enabled */){};
|
||||
void CardDatabaseSettings::setIsKnown(QString /* shortName */, bool /* isknown */){};
|
||||
|
|
@ -17,38 +21,254 @@ bool CardDatabaseSettings::isKnown(QString /* shortName */)
|
|||
return true;
|
||||
};
|
||||
|
||||
QString SettingsCache::getDataPath()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
QString SettingsCache::getSettingsPath()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
void SettingsCache::translateLegacySettings()
|
||||
{
|
||||
}
|
||||
QString SettingsCache::getSafeConfigPath(QString /* configEntry */, QString defaultPath) const
|
||||
{
|
||||
return defaultPath;
|
||||
}
|
||||
QString SettingsCache::getSafeConfigFilePath(QString /* configEntry */, QString defaultPath) const
|
||||
{
|
||||
return defaultPath;
|
||||
}
|
||||
SettingsCache::SettingsCache()
|
||||
: settings{new QSettings("global.ini", QSettings::IniFormat, this)},
|
||||
shortcutsSettings{nullptr},
|
||||
cardDatabaseSettings{new CardDatabaseSettings("", this)},
|
||||
serversSettings{nullptr},
|
||||
messageSettings{nullptr},
|
||||
gameFiltersSettings{nullptr},
|
||||
layoutsSettings{nullptr},
|
||||
downloadSettings{nullptr},
|
||||
cardDatabasePath{QString("%1/cards.xml").arg(CARDDB_DATADIR)},
|
||||
customCardDatabasePath{QString("%1/customsets/").arg(CARDDB_DATADIR)},
|
||||
spoilerDatabasePath{QString("%1/spoiler.xml").arg(CARDDB_DATADIR)},
|
||||
tokenDatabasePath{QString("%1/tokens.xml").arg(CARDDB_DATADIR)}
|
||||
{
|
||||
cardDatabaseSettings = new CardDatabaseSettings();
|
||||
};
|
||||
SettingsCache::~SettingsCache()
|
||||
{
|
||||
delete cardDatabaseSettings;
|
||||
};
|
||||
QString SettingsCache::getCustomCardDatabasePath() const
|
||||
{
|
||||
return QString("%1/customsets/").arg(CARDDB_DATADIR);
|
||||
}
|
||||
QString SettingsCache::getCardDatabasePath() const
|
||||
void SettingsCache::setUseTearOffMenus(bool /* _useTearOffMenus */)
|
||||
{
|
||||
return QString("%1/cards.xml").arg(CARDDB_DATADIR);
|
||||
}
|
||||
QString SettingsCache::getTokenDatabasePath() const
|
||||
void SettingsCache::setKnownMissingFeatures(const QString &/* _knownMissingFeatures */)
|
||||
{
|
||||
return QString("%1/tokens.xml").arg(CARDDB_DATADIR);
|
||||
}
|
||||
QString SettingsCache::getSpoilerCardDatabasePath() const
|
||||
void SettingsCache::setCardInfoViewMode(const int /* _viewMode */)
|
||||
{
|
||||
return QString("%1/spoiler.xml").arg(CARDDB_DATADIR);
|
||||
}
|
||||
CardDatabaseSettings &SettingsCache::cardDatabase() const
|
||||
void SettingsCache::setHighlightWords(const QString &/* _highlightWords */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setMasterVolume(int /* _masterVolume */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setLeftJustified(const int /* _leftJustified */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setCardScaling(const int /* _scaleCards */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setShowMessagePopups(const int /* _showMessagePopups */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setShowMentionPopups(const int /* _showMentionPopus */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setRoomHistory(const int /* _roomHistory */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setLang(const QString &/* _lang */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setShowTipsOnStartup(bool /* _showTipsOnStartup */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setSeenTips(const QList<int> &/* _seenTips */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setDeckPath(const QString &/* _deckPath */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setReplaysPath(const QString &/* _replaysPath */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setPicsPath(const QString &/* _picsPath */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setCardDatabasePath(const QString &/* _cardDatabasePath */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setSpoilerDatabasePath(const QString &/* _spoilerDatabasePath */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setTokenDatabasePath(const QString &/* _tokenDatabasePath */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setThemeName(const QString &/* _themeName */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setPicDownload(int /* _picDownload */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setNotificationsEnabled(int /* _notificationsEnabled */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setSpectatorNotificationsEnabled(int /* _spectatorNotificationsEnabled */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setBuddyConnectNotificationsEnabled(int /* _buddyConnectNotificationsEnabled */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setDoubleClickToPlay(int /* _doubleClickToPlay */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setPlayToStack(int /* _playToStack */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setStartingHandSize(int /* _startingHandSize */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setAnnotateTokens(int /* _annotateTokens */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setTabGameSplitterSizes(const QByteArray &/* _tabGameSplitterSizes */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setDisplayCardNames(int /* _displayCardNames */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setHorizontalHand(int /* _horizontalHand */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setInvertVerticalCoordinate(int /* _invertVerticalCoordinate */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setMinPlayersForMultiColumnLayout(int /* _minPlayersForMultiColumnLayout */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setTapAnimation(int /* _tapAnimation */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setChatMention(int /* _chatMention */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setChatMentionCompleter(const int /* _enableMentionCompleter */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setChatMentionForeground(int /* _chatMentionForeground */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setChatHighlightForeground(int /* _chatHighlightForeground */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setChatMentionColor(const QString &/* _chatMentionColor */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setChatHighlightColor(const QString &/* _chatHighlightColor */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setZoneViewSortByName(int /* _zoneViewSortByName */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setZoneViewSortByType(int /* _zoneViewSortByType */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setZoneViewPileView(int /* _zoneViewPileView */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setSoundEnabled(int /* _soundEnabled */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setSoundThemeName(const QString &/* _soundThemeName */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setIgnoreUnregisteredUsers(int /* _ignoreUnregisteredUsers */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setIgnoreUnregisteredUserMessages(int /* _ignoreUnregisteredUserMessages */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setMainWindowGeometry(const QByteArray &/* _mainWindowGeometry */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setTokenDialogGeometry(const QByteArray &/* _tokenDialogGeometry */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setPixmapCacheSize(const int /* _pixmapCacheSize */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setClientID(const QString &/* _clientID */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setClientVersion(const QString &/* _clientVersion */)
|
||||
{
|
||||
}
|
||||
QStringList SettingsCache::getCountries() const
|
||||
{
|
||||
static QStringList countries = QStringList() << "us";
|
||||
return countries;
|
||||
}
|
||||
void SettingsCache::setGameDescription(const QString /* _gameDescription */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setMaxPlayers(const int /* _maxPlayers */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setGameTypes(const QString /* _gameTypes */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setOnlyBuddies(const bool /* _onlyBuddies */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setOnlyRegistered(const bool /* _onlyRegistered */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setSpectatorsAllowed(const bool /* _spectatorsAllowed */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setSpectatorsNeedPassword(const bool /* _spectatorsNeedPassword */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setSpectatorsCanTalk(const bool /* _spectatorsCanTalk */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setSpectatorsCanSeeEverything(const bool /* _spectatorsCanSeeEverything */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setRememberGameSettings(const bool /* _rememberGameSettings */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setNotifyAboutUpdate(int /* _notifyaboutupdate */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setNotifyAboutNewVersion(int /* _notifyaboutnewversion */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setDownloadSpoilerStatus(bool /* _spoilerStatus */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setUpdateReleaseChannel(int /* _updateReleaseChannel */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setMaxFontSize(int /* _max */)
|
||||
{
|
||||
return *cardDatabaseSettings;
|
||||
}
|
||||
|
||||
|
||||
void PictureLoader::clearPixmapCache(CardInfoPtr /* card */)
|
||||
{
|
||||
}
|
||||
|
||||
SettingsCache *settingsCache;
|
||||
|
||||
SettingsCache& SettingsCache::instance()
|
||||
{
|
||||
return *settingsCache;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,46 +6,15 @@
|
|||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
#define PICTURELOADER_H
|
||||
|
||||
#include "../../cockatrice/src/carddatabase.h"
|
||||
|
||||
#define SETTINGSCACHE_H
|
||||
|
||||
|
||||
class CardDatabaseSettings
|
||||
{
|
||||
public:
|
||||
void setSortKey(QString shortName, unsigned int sortKey);
|
||||
void setEnabled(QString shortName, bool enabled);
|
||||
void setIsKnown(QString shortName, bool isknown);
|
||||
|
||||
unsigned int getSortKey(QString shortName);
|
||||
bool isEnabled(QString shortName);
|
||||
bool isKnown(QString shortName);
|
||||
};
|
||||
|
||||
class SettingsCache : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
CardDatabaseSettings *cardDatabaseSettings;
|
||||
|
||||
public:
|
||||
SettingsCache();
|
||||
~SettingsCache();
|
||||
QString getCustomCardDatabasePath() const;
|
||||
QString getCardDatabasePath() const;
|
||||
QString getTokenDatabasePath() const;
|
||||
QString getSpoilerCardDatabasePath() const;
|
||||
CardDatabaseSettings &cardDatabase() const;
|
||||
signals:
|
||||
void cardDatabasePathChanged();
|
||||
};
|
||||
#include "../../cockatrice/src/settingscache.h"
|
||||
|
||||
extern SettingsCache *settingsCache;
|
||||
|
||||
#define PICTURELOADER_H
|
||||
|
||||
class PictureLoader
|
||||
{
|
||||
void clearPixmapCache(CardInfoPtr card);
|
||||
public:
|
||||
static void clearPixmapCache(CardInfoPtr card);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue