Expand upon test channels (#4655)

Available test channels:

- `$$$` - Fill up scrollback (1000 messages), then add a new message every 500ms
- `$$$:e` - Add a new message every 500ms
- `$$$$` - Fill up scrollback (1000 messages), then add a new message every 250ms
- `$$$$:e` - Add a new message every 250ms
- `$$$$$` - Fill up scrollback (1000 messages), then add a new message every 100ms
- `$$$$$:e` - Add a new message every 100ms
- `$$$$$$` - Fill up scrollback (1000 messages), then add a new message every 50ms
- `$$$$$$:e` - Add a new message every 50ms
- `$$$$$$$` - Fill up scrollback (1000 messages), then add a new message every 25ms
- `$$$$$$$:e` - Add a new message every 25ms
This commit is contained in:
pajlada 2023-05-27 13:33:01 +02:00 committed by GitHub
parent c6c884df70
commit 5ca7d387e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 100 additions and 13 deletions

View file

@ -8,6 +8,7 @@
- Dev: Added the ability to see & load custom themes from the Themes directory. No stable promises are made of this feature, changes might be made that breaks custom themes without notice. (#4570)
- Dev: Added test cases for emote and tab completion. (#4644)
- Dev: Fixed `clang-tidy-review` action not picking up dependencies. (#4648)
- Dev: Expanded upon `$$$` test channels. (#4655)
## 2.4.4

View file

@ -274,24 +274,102 @@ std::shared_ptr<Channel> TwitchIrcServer::getCustomChannel(
return this->liveChannel;
}
if (channelName == "$$$")
{
static auto channel =
std::make_shared<Channel>("$$$", chatterino::Channel::Type::Misc);
static auto getTimer = [&] {
static auto getTimer = [](ChannelPtr channel, int msBetweenMessages,
bool addInitialMessages) {
if (addInitialMessages)
{
for (auto i = 0; i < 1000; i++)
{
channel->addMessage(makeSystemMessage(QString::number(i + 1)));
}
}
auto timer = new QTimer;
QObject::connect(timer, &QTimer::timeout, [] {
channel->addMessage(
makeSystemMessage(QTime::currentTime().toString()));
});
timer->start(500);
return timer;
}();
auto *timer = new QTimer;
QObject::connect(timer, &QTimer::timeout, [channel] {
channel->addMessage(
makeSystemMessage(QTime::currentTime().toString()));
});
timer->start(msBetweenMessages);
return timer;
};
if (channelName == "$$$")
{
static auto channel = std::make_shared<Channel>(
channelName, chatterino::Channel::Type::Misc);
getTimer(channel, 500, true);
return channel;
}
if (channelName == "$$$:e")
{
static auto channel = std::make_shared<Channel>(
channelName, chatterino::Channel::Type::Misc);
getTimer(channel, 500, false);
return channel;
}
if (channelName == "$$$$")
{
static auto channel = std::make_shared<Channel>(
channelName, chatterino::Channel::Type::Misc);
getTimer(channel, 250, true);
return channel;
}
if (channelName == "$$$$:e")
{
static auto channel = std::make_shared<Channel>(
channelName, chatterino::Channel::Type::Misc);
getTimer(channel, 250, false);
return channel;
}
if (channelName == "$$$$$")
{
static auto channel = std::make_shared<Channel>(
channelName, chatterino::Channel::Type::Misc);
getTimer(channel, 100, true);
return channel;
}
if (channelName == "$$$$$:e")
{
static auto channel = std::make_shared<Channel>(
channelName, chatterino::Channel::Type::Misc);
getTimer(channel, 100, false);
return channel;
}
if (channelName == "$$$$$$")
{
static auto channel = std::make_shared<Channel>(
channelName, chatterino::Channel::Type::Misc);
getTimer(channel, 50, true);
return channel;
}
if (channelName == "$$$$$$:e")
{
static auto channel = std::make_shared<Channel>(
channelName, chatterino::Channel::Type::Misc);
getTimer(channel, 50, false);
return channel;
}
if (channelName == "$$$$$$$")
{
static auto channel = std::make_shared<Channel>(
channelName, chatterino::Channel::Type::Misc);
getTimer(channel, 25, true);
return channel;
}
if (channelName == "$$$$$$$:e")
{
static auto channel = std::make_shared<Channel>(
channelName, chatterino::Channel::Type::Misc);
getTimer(channel, 25, false);
return channel;
}

View file

@ -631,6 +631,10 @@ void WindowManager::encodeChannel(IndirectChannel channel, QJsonObject &obj)
}
}
break;
case Channel::Type::Misc: {
obj.insert("type", "misc");
obj.insert("name", channel.get()->getName());
}
}
}
@ -676,6 +680,10 @@ IndirectChannel WindowManager::decodeChannel(const SplitDescriptor &descriptor)
return Irc::instance().getOrAddChannel(descriptor.server_,
descriptor.channelName_);
}
else if (descriptor.type_ == "misc")
{
return app->twitch->getChannelOrEmpty(descriptor.channelName_);
}
return Channel::getEmpty();
}