Fix input completion tests on Qt6 & run tests on 22.04 (#4774)
* Tests: Fix InputCompletion tests in Qt6 This is achieved by not checking exact order for certain completion tests * Tests: Use Ubuntu 22.04 for all tests This allows us to be a bit more loose and use more C++20 features in tests * Update dockerfiles
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
#include <QString>
|
||||
#include <QTemporaryDir>
|
||||
|
||||
#include <span>
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace chatterino;
|
||||
@@ -224,6 +226,25 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
void containsRoughly(std::span<detail::CompletionEmote> span,
|
||||
std::set<QString> values)
|
||||
{
|
||||
for (const auto &v : values)
|
||||
{
|
||||
bool found = false;
|
||||
for (const auto &actualValue : span)
|
||||
{
|
||||
if (actualValue.displayName == v)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT_TRUE(found) << qPrintable(v) << " was not found in the span";
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(InputCompletionTest, EmoteNameFiltering)
|
||||
{
|
||||
// The completion doesn't guarantee an ordering for a specific category of emotes.
|
||||
@@ -238,12 +259,11 @@ TEST_F(InputCompletionTest, EmoteNameFiltering)
|
||||
ASSERT_EQ(completion[1].displayName, "FeelsBadMan");
|
||||
ASSERT_EQ(completion[2].displayName, "FeelsGoodMan");
|
||||
|
||||
// all these matches are Twitch global emotes
|
||||
completion = queryEmoteCompletion(":)");
|
||||
ASSERT_EQ(completion.size(), 3);
|
||||
ASSERT_EQ(completion[0].displayName, ":)"); // Exact match with : prefix
|
||||
// all these matches are Twitch global emotes
|
||||
ASSERT_EQ(completion[1].displayName, ":-)");
|
||||
ASSERT_EQ(completion[2].displayName, "B-)");
|
||||
containsRoughly({completion.begin() + 1, 2}, {":-)", "B-)"});
|
||||
|
||||
completion = queryEmoteCompletion(":cat");
|
||||
ASSERT_TRUE(completion.size() >= 2);
|
||||
|
||||
Reference in New Issue
Block a user