Update to Emoji v13 (2020) (#1555)

This commit is contained in:
pajlada
2021-02-13 19:17:22 +01:00
committed by GitHub
parent 648757529d
commit 6b0ce396d6
15 changed files with 154 additions and 1947 deletions
+49
View File
@@ -0,0 +1,49 @@
#include "providers/emoji/Emojis.hpp"
#include <gtest/gtest.h>
#include <QDebug>
#include <QString>
using namespace chatterino;
TEST(Emojis, ShortcodeParsing)
{
Emojis emojis;
emojis.load();
struct TestCase {
QString input;
QString expectedOutput;
};
std::vector<TestCase> tests{
{
.input = "foo :penguin: bar",
.expectedOutput = "foo 🐧 bar",
},
{
.input = "foo :nonexistantcode: bar",
.expectedOutput = "foo :nonexistantcode: bar",
},
{
.input = ":male-doctor:",
.expectedOutput = "👨‍⚕️",
},
};
for (const auto &test : tests)
{
auto output = emojis.replaceShortCodes(test.input);
auto matches = output == test.expectedOutput;
if (!matches && !output.endsWith(QChar(0xFE0F)))
{
// Try to append 0xFE0F if needed
output = output.append(QChar(0xFE0F));
}
EXPECT_EQ(output, test.expectedOutput)
<< "Input " << test.input.toStdString() << " failed";
}
}
-27
View File
@@ -22,33 +22,6 @@
using namespace chatterino;
void xd()
{
std::mutex mut;
bool requestDone = false;
std::condition_variable requestDoneCondition;
EXPECT_TRUE(NetworkManager::workerThread.isRunning());
using namespace std::chrono_literals;
auto url = "http://localhost:8000/status/200";
NetworkRequest(url)
.onSuccess([&](NetworkResult result) -> Outcome {
qDebug() << "ON SUCCESS";
qDebug() << url;
return Success;
})
.onError([&](NetworkResult result) {
qDebug() << "ON ERROR";
})
.execute();
EXPECT_TRUE(NetworkManager::workerThread.isRunning());
EXPECT_TRUE(true);
}
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);