test: add snapshot tests for MessageBuilder (#5598)
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "controllers/userdata/UserDataController.hpp"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
namespace chatterino::mock {
|
||||
|
||||
class UserDataController : public IUserDataController
|
||||
@@ -13,6 +15,11 @@ public:
|
||||
// If the user does not have any extra data, return none
|
||||
std::optional<UserData> getUser(const QString &userID) const override
|
||||
{
|
||||
auto it = this->userMap.find(userID);
|
||||
if (it != this->userMap.end())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -20,8 +27,21 @@ public:
|
||||
void setUserColor(const QString &userID,
|
||||
const QString &colorString) override
|
||||
{
|
||||
// do nothing
|
||||
auto it = this->userMap.find(userID);
|
||||
if (it != this->userMap.end())
|
||||
{
|
||||
it->second.color = QColor(colorString);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->userMap.emplace(userID, UserData{
|
||||
.color = QColor(colorString),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::unordered_map<QString, UserData> userMap;
|
||||
};
|
||||
|
||||
} // namespace chatterino::mock
|
||||
|
||||
Reference in New Issue
Block a user