Continues the build order past the Add-URL/File-Info/Progress dialog flow.
- OptionsDialog: General/Save To/Connection/Downloads/Proxy/Sounds tabs, every
control bound to a real settings.* key (contracts/schema/types/Settings.
schema.json). The spec's File Types and Site Logins tabs have no settings.*
backing (categories go through category.upsert, credentials through the
Secret Service) so they don't exist here — a tab either binds to a real key
or isn't shipped. diffChanged() sends only what actually changed, matching
settings.set's "changed[] names exactly what took effect" contract.
- SchedulerDialog: per-queue schedule (schedule.get/set) plus maxConcurrent/
onComplete (queue.upsert), Start Now/Stop. Queue.schema.json already carries
the schedule so queue.list alone seeds the window.
- SpeedLimiterDialog: the live global limiter (limiter.get/set) — a different
thing from Options' downloads.speedLimit* default. buildParams() enforces
the schema's "0 with enabled true must not be offered".
- BatchDialog: clipboard-blob and {start..end}-wildcard tabs sharing one
category/queue/start-mode footer into download.addBatch.
- GrabberWizard: 4-step QWizard (project label -> start URL/depth/filters ->
file-type filter -> review), grabber.start feeding a poll+event.grabber.
progress-driven review page, Finish = grabber.harvest for the checked files.
- TrayIcon: active-count tooltip, Show/Add URL/Pause All/Resume All/Speed
Limiter submenu/Quit. Quit only closes the GUI — there is no RPC to stop
veloxd itself, filed as a new gap in daemon-requests-m1.md. MainWindow now
also hides to tray instead of closing when general.minimizeToTray is set.
Every dialog's non-widget logic (diffChanged, buildSchedule, buildParams,
parseUrlBlob/expandWildcard/buildAddBatchParams, buildFileTypes/
buildStartParams/buildHarvestParams) is a static pure function with its own
test, same shape as FileInfoDialog::buildSpec from the previous round.
Verified end-to-end against a running mockd under ASan+UBSan: all five
surfaces render real data (settings.get values, queue.list's two seeded
queues, limiter.get, a live grabber.start/status crawl returning 3 files) with
no sanitizer reports. gui-check (non-ASan) and dev (ASan+UBSan) presets both
build the whole repo clean; all gui-labeled ctest targets pass.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NSCdCWFXBTSBBK3MzWtJiC
65 lines
2.4 KiB
C++
65 lines
2.4 KiB
C++
// GrabberWizard unit tests: buildFileTypes, buildStartParams, buildHarvestParams. Lane GUI.
|
|
//
|
|
// Red when every file-type checkbox unchecked stops meaning "every type" (null, not an
|
|
// empty array), a blank include/exclude field stops becoming schema null, or harvest
|
|
// params drop a selected fileId.
|
|
|
|
#include <QJsonArray>
|
|
#include <QtTest>
|
|
|
|
#include "dialogs/GrabberWizard.hpp"
|
|
|
|
using velox::gui::GrabberWizard;
|
|
|
|
class TstGrabberWizard : public QObject {
|
|
Q_OBJECT
|
|
|
|
private slots:
|
|
void noFileTypesSelectedMeansNull();
|
|
void selectedTypesAndCustomAreMerged();
|
|
void blankFiltersBecomeNull();
|
|
void filtersAreSplitOnCommaAndNewline();
|
|
void harvestParamsCarrySelection();
|
|
};
|
|
|
|
void TstGrabberWizard::noFileTypesSelectedMeansNull() {
|
|
const QJsonValue v = GrabberWizard::buildFileTypes(false, false, false, false, false, "");
|
|
QVERIFY(v.isNull());
|
|
}
|
|
|
|
void TstGrabberWizard::selectedTypesAndCustomAreMerged() {
|
|
const QJsonValue v =
|
|
GrabberWizard::buildFileTypes(true, false, false, false, false, "iso, bin");
|
|
QVERIFY(v.isArray());
|
|
const QJsonArray a = v.toArray();
|
|
QVERIFY(a.contains(QStringLiteral("jpg")));
|
|
QVERIFY(a.contains(QStringLiteral("iso")));
|
|
QVERIFY(a.contains(QStringLiteral("bin")));
|
|
}
|
|
|
|
void TstGrabberWizard::blankFiltersBecomeNull() {
|
|
const QJsonObject p =
|
|
GrabberWizard::buildStartParams("https://example.test/", 2, true, "", "", QJsonValue());
|
|
QVERIFY(p.value("includePatterns").isNull());
|
|
QVERIFY(p.value("excludePatterns").isNull());
|
|
QCOMPARE(p.value("depth").toInt(), 2);
|
|
QCOMPARE(p.value("sameHostOnly").toBool(), true);
|
|
}
|
|
|
|
void TstGrabberWizard::filtersAreSplitOnCommaAndNewline() {
|
|
const QJsonObject p = GrabberWizard::buildStartParams("https://example.test/", 1, false,
|
|
"*.jpg,*.png\n*.gif", "", QJsonValue());
|
|
QCOMPARE(p.value("includePatterns").toArray().size(), 3);
|
|
}
|
|
|
|
void TstGrabberWizard::harvestParamsCarrySelection() {
|
|
const QJsonObject p = GrabberWizard::buildHarvestParams("job1", {"f1", "f2"}, "cat1", "later");
|
|
QCOMPARE(p.value("jobId").toString(), QStringLiteral("job1"));
|
|
QCOMPARE(p.value("select").toArray().size(), 2);
|
|
QCOMPARE(p.value("defaults").toObject().value("categoryId").toString(), QStringLiteral("cat1"));
|
|
QCOMPARE(p.value("defaults").toObject().value("startMode").toString(), QStringLiteral("later"));
|
|
}
|
|
|
|
QTEST_MAIN(TstGrabberWizard)
|
|
#include "tst_grabberwizard.moc"
|