Allow avatar replacement alongside downloads and correct join fixtures
This commit is contained in:
1 parent
dc156c7f2b
commit
9bfdf3ea41
3 files changed
+10
-6
No files matched your search
@@ -241,9 +241,9 @@ void AvatarManager::scheduleOwn(quint64 group) {
|
||||
}
|
||||
|
||||
void AvatarManager::enqueue(const Job& job) {
|
||||
for (const auto& old : m_jobs) if ((old.ref.group == job.ref.group && old.ref.owner == job.ref.owner) ||
|
||||
for (const auto& old : m_jobs) if ((old.upload == job.upload && old.ref.group == job.ref.group && old.ref.owner == job.ref.owner) ||
|
||||
(!job.upload && !old.upload && old.ref.hash == job.ref.hash)) return;
|
||||
for (const auto& old : m_queue) if ((old.ref.group == job.ref.group && old.ref.owner == job.ref.owner) ||
|
||||
for (const auto& old : m_queue) if ((old.upload == job.upload && old.ref.group == job.ref.group && old.ref.owner == job.ref.owner) ||
|
||||
(!job.upload && !old.upload && old.ref.hash == job.ref.hash)) return;
|
||||
if (job.upload) m_queue.prepend(job); else m_queue.enqueue(job);
|
||||
}
|
||||
|
||||
@@ -160,8 +160,12 @@ private slots:
|
||||
QCOMPARE(downloads, 1u);
|
||||
const QString replacement = directory.path() + "/replacement.png"; image.fill(Qt::red); QVERIFY(image.save(replacement));
|
||||
manager.uploadDefault(replacement, testInstance->node_id);
|
||||
auto isRed = [&manager, &db](const QString& channel) {
|
||||
const QImage current = manager.image(channel, db.myNodeId());
|
||||
return !current.isNull() && current.pixelColor(128, 128) == QColor(Qt::red);
|
||||
};
|
||||
for (const auto& channel : channels)
|
||||
QTRY_VERIFY_WITH_TIMEOUT(manager.image(channel.channelId, testInstance->node_id).pixelColor(128, 128) == QColor(Qt::red), 10000);
|
||||
QTRY_VERIFY_WITH_TIMEOUT(isRed(channel.channelId), 10000);
|
||||
deferDownload = false; manager.onTransfer((const uint8_t*)delayedDownload.constData(), delayedDownload.size());
|
||||
QTRY_VERIFY_WITH_TIMEOUT(QFile::exists(cached), 5000);
|
||||
for (const auto& channel : channels) QCOMPARE(manager.image(channel.channelId, testInstance->node_id).pixelColor(128, 128), QColor(Qt::red));
|
||||
|
||||
Reference in new issue
Block a user