#pragma once #include "core/disk-node.h" #include "core/disk-scanner.h" #include #include #include // Test helpers only: they keep the fixtures readable without hiding behaviour. namespace test_helpers { inline bool writeFile(const QString &path, int bytes) { QFile file(path); if (!file.open(QIODevice::WriteOnly)) { return false; } return file.write(QByteArray(bytes, 'x')) == bytes; } inline DiskNode *childNamed(const DiskNode &node, const QString &name) { for (const auto &child : node.children) { if (child->name == name) { return child.get(); } } return nullptr; } inline std::shared_ptr scan(const QString &path, ScanStats *stats = nullptr) { DiskScanner scanner(path); scanner.start(); if (!scanner.wait(30000)) { return nullptr; } if (stats) { *stats = scanner.stats(); } return scanner.takeTree(); } } // namespace test_helpers