feat: add the ability to unit test some aspects of SplitInput (#5179)

This commit is contained in:
pajlada
2024-02-17 13:26:54 +01:00
committed by GitHub
parent 4b48774cbb
commit 32d269dffc
8 changed files with 142 additions and 4 deletions
+9 -4
View File
@@ -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));