feat: add the ability to unit test some aspects of SplitInput (#5179)
This commit is contained in:
@@ -525,6 +525,11 @@ const IndirectChannel &TwitchIrcServer::getWatchingChannel() const
|
||||
return this->watchingChannel;
|
||||
}
|
||||
|
||||
QString TwitchIrcServer::getLastUserThatWhisperedMe() const
|
||||
{
|
||||
return this->lastUserThatWhisperedMe.get();
|
||||
}
|
||||
|
||||
void TwitchIrcServer::reloadBTTVGlobalEmotes()
|
||||
{
|
||||
getIApp()->getBttvEmotes()->loadEmotes();
|
||||
|
||||
@@ -29,6 +29,8 @@ public:
|
||||
|
||||
virtual const IndirectChannel &getWatchingChannel() const = 0;
|
||||
|
||||
virtual QString getLastUserThatWhisperedMe() const = 0;
|
||||
|
||||
// Update this interface with TwitchIrcServer methods as needed
|
||||
};
|
||||
|
||||
@@ -81,6 +83,8 @@ public:
|
||||
|
||||
const IndirectChannel &getWatchingChannel() const override;
|
||||
|
||||
QString getLastUserThatWhisperedMe() const override;
|
||||
|
||||
protected:
|
||||
void initializeConnection(IrcConnection *connection,
|
||||
ConnectionType type) override;
|
||||
|
||||
@@ -78,7 +78,7 @@ SplitInput::SplitInput(QWidget *parent, Split *_chatWidget,
|
||||
|
||||
void SplitInput::initLayout()
|
||||
{
|
||||
auto *app = getApp();
|
||||
auto *app = getIApp();
|
||||
LayoutCreator<SplitInput> layoutCreator(this);
|
||||
|
||||
auto layout =
|
||||
@@ -202,7 +202,7 @@ void SplitInput::initLayout()
|
||||
|
||||
void SplitInput::scaleChangedEvent(float scale)
|
||||
{
|
||||
auto *app = getApp();
|
||||
auto *app = getIApp();
|
||||
// update the icon size of the buttons
|
||||
this->updateEmoteButton();
|
||||
this->updateCancelReplyButton();
|
||||
@@ -919,9 +919,14 @@ bool SplitInput::isHidden() const
|
||||
return this->hidden;
|
||||
}
|
||||
|
||||
void SplitInput::setInputText(const QString &newInputText)
|
||||
{
|
||||
this->ui_.textEdit->setPlainText(newInputText);
|
||||
}
|
||||
|
||||
void SplitInput::editTextChanged()
|
||||
{
|
||||
auto *app = getApp();
|
||||
auto *app = getIApp();
|
||||
|
||||
// set textLengthLabel value
|
||||
QString text = this->ui_.textEdit->toPlainText();
|
||||
@@ -936,7 +941,7 @@ void SplitInput::editTextChanged()
|
||||
if (text.startsWith("/r ", Qt::CaseInsensitive) &&
|
||||
this->split_->getChannel()->isTwitchChannel())
|
||||
{
|
||||
QString lastUser = app->twitch->lastUserThatWhisperedMe.get();
|
||||
auto lastUser = app->getTwitch()->getLastUserThatWhisperedMe();
|
||||
if (!lastUser.isEmpty())
|
||||
{
|
||||
this->ui_.textEdit->setPlainText("/w " + lastUser + text.mid(2));
|
||||
|
||||
@@ -66,6 +66,13 @@ public:
|
||||
**/
|
||||
bool isHidden() const;
|
||||
|
||||
/**
|
||||
* @brief Sets the text of this input
|
||||
*
|
||||
* This method should only be used in tests
|
||||
*/
|
||||
void setInputText(const QString &newInputText);
|
||||
|
||||
pajlada::Signals::Signal<const QString &> textChanged;
|
||||
pajlada::Signals::NoArgSignal selectionChanged;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user