From ed3815a40629be53c0431d636b692f483414e897 Mon Sep 17 00:00:00 2001 From: evgeny Date: Tue, 6 Oct 2026 14:54:23 +0200 Subject: [PATCH] Use the portable remove command in the browser and storage tests --- tests/test_member_files.c | 14 +++++++------- tools/chatgui/src/member_files/browser.cpp | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/test_member_files.c b/tests/test_member_files.c index c4c95749..f0cc4446 100644 --- a/tests/test_member_files.c +++ b/tests/test_member_files.c @@ -119,7 +119,7 @@ static void storage_test(const char* directory) { snprintf(q.target, sizeof(q.target), "renamed"); run(s, 55, 77, MF_RENAME, MF_OK); run(s, 55, 77, MF_STAT, MF_NOT_FOUND); snprintf(q.path, sizeof(q.path), "renamed"); memset(q.version, 0, 16); run(s, 55, 77, MF_STAT, MF_OK); - memcpy(q.version, r.version, 16); run(s, 55, 88, MF_REMOVE, MF_ACCESS_DENIED); run(s, 55, 77, MF_REMOVE, MF_OK); + memcpy(q.version, r.version, 16); run(s, 55, 88, MF_REMOVE_PATH, MF_ACCESS_DENIED); run(s, 55, 77, MF_REMOVE_PATH, MF_OK); snprintf(q.path, sizeof(q.path), "folder"); memset(q.version, 0, 16); run(s, 55, 77, MF_MKDIR, MF_OK); q.path[0] = 0; run(s, 55, 88, MF_LIST, MF_OK); EXPECT(r.data_len > 0, "directory listing"); #ifndef _WIN32 @@ -245,15 +245,15 @@ static void count_test(const char* directory) { check_counts(s, 10, 101, 2, 2); check_counts(s, 10, 202, 1, 0); count_mutation(s, 10, 101, "folder", "moved", MF_RENAME, MF_OK); check_counts(s, 10, 101, 2, 2); - count_mutation(s, 10, 101, "moved", NULL, MF_REMOVE, MF_IO_ERROR); + count_mutation(s, 10, 101, "moved", NULL, MF_REMOVE_PATH, MF_IO_ERROR); check_counts(s, 10, 101, 2, 2); - count_mutation(s, 10, 101, "moved/zero", NULL, MF_REMOVE, MF_OK); + count_mutation(s, 10, 101, "moved/zero", NULL, MF_REMOVE_PATH, MF_OK); mf_storage_execute(s, 10, 101, &q, &r); EXPECT(r.status == MF_OK, "file remove replay"); check_counts(s, 20, 101, 1, 2); check_quota(s, 20, 101, 3, 0, 40); - count_mutation(s, 10, 101, "moved/sub", NULL, MF_REMOVE, MF_OK); + count_mutation(s, 10, 101, "moved/sub", NULL, MF_REMOVE_PATH, MF_OK); mf_storage_execute(s, 10, 101, &q, &r); EXPECT(r.status == MF_OK, "directory remove replay"); check_counts(s, 20, 101, 1, 1); - count_mutation(s, 10, 101, "moved", NULL, MF_REMOVE, MF_OK); check_counts(s, 10, 101, 1, 0); + count_mutation(s, 10, 101, "moved", NULL, MF_REMOVE_PATH, MF_OK); check_counts(s, 10, 101, 1, 0); quota_begin(s, 10, 101, "aborted", 4, 66, NULL, MF_OK); check_counts(s, 10, 101, 1, 0); run(s, 10, 101, MF_ABORT, MF_OK); check_counts(s, 10, 101, 1, 0); quota_begin(s, 10, 101, "expired", 4, 67, NULL, MF_OK); @@ -313,12 +313,12 @@ static void quota_test(const char* directory) { run(s, 10, 101, MF_RENAME, MF_OK); check_quota(s, 10, 101, 28, 0, 40); snprintf(q.path, sizeof(q.path), "renamed"); memset(q.version, 0, 16); run(s, 10, 101, MF_STAT, MF_OK); memcpy(q.version, r.version, 16); - run(s, 10, 101, MF_REMOVE, MF_OK); + run(s, 10, 101, MF_REMOVE_PATH, MF_OK); mf_storage_execute(s, 10, 101, &q, &r); EXPECT(r.status == MF_OK, "remove replay retains quota"); check_quota(s, 20, 101, 8, 0, 40); memset(&q, 0, sizeof(q)); q.owner = 101; snprintf(q.path, sizeof(q.path), "folder"); run(s, 10, 101, MF_MKDIR, MF_OK); run(s, 10, 101, MF_STAT, MF_OK); memcpy(q.version, r.version, 16); - run(s, 10, 101, MF_REMOVE, MF_OK); check_quota(s, 10, 101, 8, 0, 40); + run(s, 10, 101, MF_REMOVE_PATH, MF_OK); check_quota(s, 10, 101, 8, 0, 40); quota_begin(s, 10, 101, "expired", 6, 38, NULL, MF_OK); check_quota(s, 20, 101, 8, 6, 40); mf_storage_sweep(s, get_time_tb() + 200001); check_quota(s, 10, 101, 8, 0, 40); run(s, 10, 101, MF_ABORT, MF_OK); diff --git a/tools/chatgui/src/member_files/browser.cpp b/tools/chatgui/src/member_files/browser.cpp index 271ef33e..79c02397 100644 --- a/tools/chatgui/src/member_files/browser.cpp +++ b/tools/chatgui/src/member_files/browser.cpp @@ -83,7 +83,7 @@ MemberFileBrowser::MemberFileBrowser(DbManager* db, QWidget* parent) : QDialog(p connect(m_download, &QPushButton::clicked, this, [this]() { download(false); }); connect(m_mkdir, &QPushButton::clicked, this, [this]() { mutate(MF_MKDIR); }); connect(m_rename, &QPushButton::clicked, this, [this]() { mutate(MF_RENAME); }); - connect(m_remove, &QPushButton::clicked, this, [this]() { mutate(MF_REMOVE); }); + connect(m_remove, &QPushButton::clicked, this, [this]() { mutate(MF_REMOVE_PATH); }); connect(m_cancel, &QPushButton::clicked, this, &MemberFileBrowser::cancel); m_entries->setContextMenuPolicy(Qt::CustomContextMenu); connect(m_entries, &QWidget::customContextMenuRequested, this, [this](const QPoint& point) {