Allow avatar replacement alongside downloads and correct join fixtures
This commit is contained in:
1 parent
3525bd1a24
commit
a6fa04679c
3 files changed
+10
-6
No files matched your search
@@ -308,9 +308,9 @@ static void member_put_self(struct UTUN_INSTANCE* inst, const char* name) {
|
||||
}
|
||||
|
||||
static void member_put_placeholder(struct UTUN_INSTANCE* inst, int idx, const char* name) {
|
||||
char userinfo[256]; snprintf(userinfo, sizeof(userinfo), "{\"name\":\"%s\"}", name);
|
||||
member_sync_put(inst, g_sh.ch_id, g_sh.nid[idx], g_sh.x_pub[idx], g_sh.ed_pub[idx],
|
||||
NULL, 0, NULL, 0, userinfo, NULL, NULL, 0, 0, NULL);
|
||||
(void)name;
|
||||
if (topo_node_sqlite_member_placeholder_put(inst->topo_sqlite_db, g_sh.ch_id, g_sh.nid[idx], g_sh.x_pub[idx], g_sh.ed_pub[idx]) < 0)
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_MEMBER_SYNC, "test: cannot create member placeholder node=%016llx", (unsigned long long)g_sh.nid[idx]);
|
||||
}
|
||||
|
||||
/* C специально откладывает обработку KEY_REGISTER. Ссылки до этого момента быть не должно. */
|
||||
|
||||
@@ -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