Skip to content

Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.

C++

Isolate compiled QML caches by application module content

Veyra Goal Agenta66f7e9e7f71
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 460eca38..4ea5a7b1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1244,7 +1244,7 @@ if(VEYRA_BUILD_QML_UI AND Qt6_FOUND)
# WIN32: a GUI subsystem binary. Without it a console window follows the app
# around, which is not what a player should look like. Diagnostics still reach
# the log file through the logger.
- add_executable(veyra_qml_ui WIN32 apps/veyra-qml/main.cpp src/ui/QmlDataDirectory.cpp)
+ add_executable(veyra_qml_ui WIN32 apps/veyra-qml/main.cpp src/ui/QmlDataDirectory.cpp src/ui/QmlDiskCache.cpp)
# The QML copy is its own always-run step rather than a POST_BUILD of the link:
# its two long E:/项目 paths on the link statement pushed that command past
# CMake's response-file threshold, and link.exe reads response files in the
@@ -1290,6 +1290,12 @@ if(VEYRA_BUILD_QML_UI AND Qt6_FOUND)
target_link_libraries(veyra_subtitle_cache_tests PRIVATE veyra_engine)
target_compile_features(veyra_qml_data_tests PRIVATE cxx_std_20)
target_include_directories(veyra_qml_data_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
+ # The per-build QML disk cache folder (QmlDiskCache.h).
+ add_executable(veyra_qml_cache_tests tests/unit/QmlDiskCacheTests.cpp src/ui/QmlDiskCache.cpp)
+ target_compile_features(veyra_qml_cache_tests PRIVATE cxx_std_20)
+ target_compile_options(veyra_qml_cache_tests PRIVATE /utf-8)
+ target_include_directories(veyra_qml_cache_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
+ target_link_libraries(veyra_qml_cache_tests PRIVATE Qt6::Core)
# G0.6: Theme easing curves read back through QML against the design's CSS curves.
# Loads qml/ from the source tree; runs offscreen with the Qt bin directory on PATH.
diff --git a/apps/veyra-qml/main.cpp b/apps/veyra-qml/main.cpp
index 77999258..c014e989 100644
--- a/apps/veyra-qml/main.cpp
+++ b/apps/veyra-qml/main.cpp
@@ -32,8 +32,10 @@
#include <QDebug>
#include <QAbstractNativeEventFilter>
#include <QFile>
+#include <QDir>
#include <QJsonDocument>
#include <QJsonObject>
+#include <QStandardPaths>
#include <windows.h>
#include <shellapi.h>
@@ -41,6 +43,7 @@
#include <dbghelp.h>
#include <d3d12.h>
+#include <chrono>
#include <cmath>
#include <cstdlib>
#include <cstring>
@@ -55,6 +58,7 @@
#include "veyra/gfx/PresentationHooks.h"
#include "veyra/ui/InterfaceRenderer.h"
#include "veyra/ui/QmlDataDirectory.h"
+#include "veyra/ui/QmlDiskCache.h"
#include "veyra/ui/QmlPlayerBridge.h"
#include "veyra/ui/ThumbnailProvider.h"
@@ -712,6 +716,35 @@ static int runApplication(int argc, char** argv, QString& restartProgram, QStrin
}
});
+ // Compiled QML goes to a cache folder of this build's own QML (see
+ // QmlDiskCache.h): with Qt's shared folder, 2.1.3 extracted over 2.1.2 ran
+ // the 2.1.2 pages. Qt reads QML_DISK_CACHE_PATH once, at the first QML load,
+ // with fromLocal8Bit; a folder the ANSI code page cannot spell turns the disk
+ // cache off rather than letting Qt fall back to the shared one.
+ {
+ const auto started = std::chrono::steady_clock::now();
+ const QString testRoot = qEnvironmentVariable("VEYRA_TEST_QML_CACHE_ROOT");
+ const auto cache = ui::chooseQmlDiskCache(
+ QCoreApplication::applicationDirPath() + QStringLiteral("/qml/Veyra"),
+ testRoot.isEmpty() ? QStandardPaths::writableLocation(QStandardPaths::CacheLocation) : testRoot,
+ qgetenv("QML_DISK_CACHE_PATH"), qgetenv("QML_DISABLE_DISK_CACHE"));
+ QString outcome = cache.note;
+ if (!cache.directory.isEmpty()) {
+ const QString folder = QDir::toNativeSeparators(cache.directory);
+ const QByteArray local = folder.toLocal8Bit();
+ if (QString::fromLocal8Bit(local) == folder) {
+ qputenv("QML_DISK_CACHE_PATH", local);
+ outcome = QStringLiteral("folder=") + folder;
+ } else {
+ qputenv("QML_DISABLE_DISK_CACHE", "1");
+ outcome = QStringLiteral("disk cache off: the code page cannot spell ") + folder;
+ }
+ }
+ const double ms = std::chrono::duration<double, std::milli>(std::chrono::steady_clock::now() - started).count();
+ veyra::log::info("qml-cache", std::format("{} digest={} files={} bytes={} ms={:.1f}",
+ outcome.toStdString(), cache.digest.isEmpty() ? "none" : cache.digest.toStdString(), cache.files, cache.bytes, ms));
+ }
+
QQmlApplicationEngine engine;
engine.rootContext()->setContextProperty(QStringLiteral("vySoftwareUi"), softwareUi);
auto* thumbnails = new ui::ThumbnailProvider;
diff --git a/docs/QML_CACHE_PER_BUILD_2026-11-06.md b/docs/QML_CACHE_PER_BUILD_2026-11-06.md
new file mode 100644
index 00000000..dcecc21f
--- /dev/null
+++ b/docs/QML_CACHE_PER_BUILD_2026-11-06.md
@@ -0,0 +1,85 @@
+# 每个构建使用自己的界面编译缓存(2026-11-06,Claude)
+
+- **分支**:`claude/qmlcache-20261106`,工作树 `E:/项目/Veyra/worktrees/claude-qmlcache-20261106`。
+- **基线**:main `edd901e`(2.1.3 产品 `7a2d15d` 加文档)。
+- **状态**:未提交,未合并,未 push/Release。
+- **用户要求**:先排查“2.1.3 选不了 RTX 视频超分三种模型”,确认原因后要求“实现修复”。
+
+## 原因(排查见 `E:/项目/Veyra/reports/claude-sr-qmlcache-20261106/FINDINGS.md`)
+
+- **Qt 的缓存规则**:Qt 把编译好的界面放在每个用户共用的 `%LOCALAPPDATA%\Veyra\Veyra\cache\qmlcache`。缓存文件名是界面文件完整路径的 SHA-1;只要路径和修改时间不变就直接沿用,不比较内容。
+- **两版发布 ZIP 的时间戳相同**:几乎所有文件都是 1980-01-01。
+- **结果**:
+ - 2.1.3 解压到 2.1.2 用过的同一路径时,沿用的是 2.1.2 编译的 ProPage;
+ - 旧处理 `Number(id)` 把 `rtx`、`rtx-hb`、`rtx-st` 变成 0,于是跳回 DLSS。
+ - 2.1.2 到 2.1.3 共改了 9 个界面文件,原地升级的用户可能整套界面都还是旧的。
+
+## 改动
+
+**`include/veyra/ui/QmlDiskCache.h` 和 `src/ui/QmlDiskCache.cpp`(新增)**:`chooseQmlDiskCache` 决定这次构建用哪个缓存目录。
+
+- **计算方式**:对程序自带的 Veyra 界面模块(`<程序>/qml/Veyra`,约 101 个文件、1.9 MB)的“相对路径 + 大小 + 内容”算 SHA-256,取前 16 位,作为缓存目录名 `qmlcache-<摘要>`。
+- **不计入 Qt 自带模块**:Qt 升级时,Qt 自己会检查版本和编译哈希。
+- **保留明确设置**:已设置 `QML_DISK_CACHE_PATH` 时保持不动;`QML_DISABLE_DISK_CACHE` 为非 0 时不做任何设置。
+- **无法计算时**:找不到模块或文件读不出,则保持 Qt 原样,并记录原因。
+
+**`apps/veyra-qml/main.cpp`**:在创建 QML 引擎之前调用上面的函数,把 `QML_DISK_CACHE_PATH` 设为 `<用户缓存目录>/qmlcache-<摘要>`。
+
+- 日志新增一行 `[qml-cache] folder=… digest=… files=… bytes=… ms=…`。
+- Qt 用 `fromLocal8Bit` 读这个变量。如果系统代码页无法表示这个路径,就改为关闭界面编译缓存(宁可慢一点,也不退回共用目录)。
+- `VEYRA_TEST_QML_CACHE_ROOT` 仅供测试,用来把缓存根目录换成私有目录。
+- 程序用退出码 42 自动重启时,子进程继承同一个设置;同一构建对应的目录本来就相同,不受影响。
+
+**`CMakeLists.txt`**:`veyra_qml_ui` 加入新源文件,并新增 `veyra_qml_cache_tests`。
+
+**没有做的**:
+
+- 不自动删除旧的 `qmlcache` 或其他构建的缓存目录:一个构建约 2–3 MB,新程序也不会再读旧目录。
+- 不改打包时间戳:发布包的可复现性和摘要核对保持不变。
+
+## 验证
+
+**构建**:`scripts/acceptance/build-recording-handoff.py --task claude-qmlcache-20261106 --label 2.1.3-qmlcache-test --jobs 2 veyra_qml_ui veyra_qml_cache_tests`,新建构建目录 `build/claude-qmlcache-20261106`,301.0 秒通过,新文件没有编译警告。
+
+**单元测试 `veyra_qml_cache_tests`**:通过。覆盖这些情况:
+
+- 同样的文件得到同一目录,与安装位置和列出顺序无关;
+- 同名、同大小、同 1980 时间戳但内容不同时换新目录;
+- 改名或新增文件时换新目录;
+- 明确设置的 `QML_DISK_CACHE_PATH` 保留;
+- `QML_DISABLE_DISK_CACHE=1` 保持关闭,`=0` 不算关闭;
+- 没有模块或没有缓存根目录时,保持 Qt 默认。
+
+**真实程序**:
+
+- **方法**:脚本 `E:/项目/Veyra/tmp/claude-sr-qmlcache-20261106/qmlcache_fix_run.py`。
+ - 在固定目录先解压 2.1.2 并运行,填充旧的共用 `qmlcache`;
+ - 再把 2.1.3 解压到同一位置覆盖,两次都保留 ZIP 里的 1980 时间;
+ - 私有缓存根目录,私有配置和日志;
+ - 探针模拟依次选择 FSR、高码率、FSR、标准、FSR、流媒体、FSR、DLSS。
+- **结果**:
+
+| 运行 | 缓存目录 | ProPage 编译缓存 | 选框宽度 | 三种 RTX 提交 |
+|---|---|---|---|---|
+| 未修复的 2.1.3 程序 | 旧共用 `qmlcache` | 沿用 2.1.2 的 | 150 | 0 / 0 / 0(跳回 DLSS) |
+| 修复版,升级后首次启动 | `qmlcache-69f354eeebfa5bcb`(101 个文件,摘要 15.7 ms) | 重新编译;旧目录未动 | 210 | 17 / 2 / 21 |
+| 修复版,第二次启动 | 同上(12.3 ms) | 复用 | 210 | 17 / 2 / 21 |
+| 只改 ProPage 一个数字(大小与 1980 时间不变) | `qmlcache-2d41dc8775b7b895`(13.5 ms) | 重新编译 | 150(改动立即生效) | — |
+| 改回发布原样 | 回到 `qmlcache-69f354eeebfa5bcb`(12.4 ms) | 复用 | 210 | — |
+| 修复版,外部已设置 `QML_DISK_CACHE_PATH` | 保持外部设置(日志 `kept`) | — | — | — |
+
+- 测试结束后,ProPage 已逐字节恢复为 2.1.3 发布版的内容。
+
+## 没有验证的部分
+
+- **未在现场验证**:没有在用户的 RTX 3080 上验证。已经中招的用户,需要换成带这个修复的新版本程序后才会自动恢复;仍用 2.1.3 的用户,要按排查报告删除 `qmlcache` 目录。
+- **代码页回退未实测**:“代码页无法表示路径时关闭缓存”这一分支只有代码审读,没有在非中文代码页的系统上实测。
+- **启动耗时**:本机摘要约 12–16 ms;机械硬盘冷启动时可能更长,没有测。
+- **其余测试**:没有重跑全套 QtQuick 和其他合同测试。这次没有改动 QML,也没有改动除启动缓存设置以外的 C++。
+- **测试副本**:`E:/项目/Veyra/tests/claude-sr-qmlcache-20261106/install` 约 1.1 GB,可以重新生成,留待提交后清理;里面的 EXE 已换成本次测试构建。
+
+## 产物
+
+- **排查报告**:`E:/项目/Veyra/reports/claude-sr-qmlcache-20261106/`。
+- **本次回执**:`E:/项目/Veyra/reports/claude-qmlcache-20261106/FINAL.json`。
+- **日志**:`E:/项目/Veyra/logs/claude-qmlcache-20261106`(构建与单元测试)和 `E:/项目/Veyra/logs/claude-sr-qmlcache-20261106/fx-*.log`(真实程序)。
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index 49e8a7cb..d651cca4 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -722,3 +722,28 @@ Veyra-2.1.3-AMD-win64-portable.zip:717577602 bytes,SHA256 `dc1223f0aff0feb39
首个QtTest夹具when:windowShown在独立应用中未触发,已停止唯一私有路径测试进程并改Timer显式调用测试方法;两次有效检查均exit0,无engine/QML错误。未碰用户运行进程、配置和原日志。仅作为受控对照把旧处理器放入私有QML,已恢复原字节。
本轮删除SHA白名单隔离测试副本的命令被自动审批以blocked by policy拒绝,未执行;保留tests/sr-menu-investigation-20261106/app,不改shell/工具绕过,配置和日志保留。证据CLEANUP.json。产品代码和已发布包均未修改。
+
+## 2026-11-06 2.1.3 选不了三种 RTX 视频超分:每个构建使用自己的界面编译缓存(Claude)
+
+**状态**:分支 `claude/qmlcache-20261106`,基线 main `edd901e`,未提交。
+
+**排查**:见 `E:/项目/Veyra/reports/claude-sr-qmlcache-20261106/FINDINGS.md`。
+- 发布 ZIP 把文件时间统一成 1980-01-01,而 Qt 界面编译缓存只按“路径+时间”判断是否过期。
+- 所以 2.1.3 覆盖 2.1.2 后,沿用 2.1.2 编译的 ProPage,`Number(id)` 把三种 RTX 模型变成 DLSS。
+
+**修复**:新增 `QmlDiskCache`。
+- 启动时按 `qml/Veyra` 的内容摘要,把 `QML_DISK_CACHE_PATH` 设为 `<缓存>/qmlcache-<摘要>`。
+- 外部明确设置的路径或关闭缓存的设置保留。
+- 系统代码页无法表示路径时关闭缓存。
+- 日志新增 `[qml-cache]` 一行。
+
+**验证**:
+- 构建 301.0 秒通过;`veyra_qml_cache_tests` 通过。
+- 真实程序在“2.1.2 → 2.1.3 原地覆盖”的安装里:
+ - 未修复程序:宽 150,提交 0/0/0;
+ - 修复版:首次重新编译、宽 210,提交 17/2/21;第二次复用缓存;
+ - 同大小、同时间地改动 ProPage 后,立即换目录并生效;改回后复用原目录。
+
+**记录**:`docs/QML_CACHE_PER_BUILD_2026-11-06.md`,回执 `E:/项目/Veyra/reports/claude-qmlcache-20261106/FINAL.json`。
+
+**未验证**:未在用户 RTX 3080 上验证,代码页回退分支未实测,未重跑全套 QtQuick。
diff --git a/include/veyra/ui/QmlDiskCache.h b/include/veyra/ui/QmlDiskCache.h
new file mode 100644
index 00000000..b48c7ad6
--- /dev/null
+++ b/include/veyra/ui/QmlDiskCache.h
@@ -0,0 +1,36 @@
+#pragma once
+
+#include <QByteArray>
+#include <QString>
+
+namespace veyra::ui {
+
+// Where Qt's QML disk cache goes for this build.
+//
+// Qt keeps compiled QML in one folder per user (<cache>/qmlcache), shared by
+// every install, and trusts a compiled file while the source keeps its path and
+// modification time; it never looks at the contents. The release archives stamp
+// every file 1980-01-01, so 2.1.3 extracted over a 2.1.2 folder kept running the
+// 2.1.2 compiled pages: the RTX Video SR families were mapped to DLSS SR by the
+// old ProPage (field log 2026-11-06). A folder named after the contents of the
+// application's QML module keeps every build's compiled QML apart.
+struct QmlDiskCacheChoice {
+ // Folder for QML_DISK_CACHE_PATH; empty leaves Qt's setting alone.
+ QString directory;
+ // First 16 hex digits of the SHA-256 over the module's paths and contents.
+ QString digest;
+ int files = 0;
+ qint64 bytes = 0;
+ // Why no folder was chosen, for the log.
+ QString note;
+};
+
+// moduleDir: the application's own QML module (<app>/qml/Veyra). Qt's modules
+// need no digest: a Qt upgrade changes the Qt version and compile hash that Qt
+// already checks. cacheRoot: the user's cache folder. explicitPath and
+// disableCache: the current QML_DISK_CACHE_PATH and QML_DISABLE_DISK_CACHE,
+// which are respected.
+QmlDiskCacheChoice chooseQmlDiskCache(const QString& moduleDir, const QString& cacheRoot,
+ const QByteArray& explicitPath, const QByteArray& disableCache);
+
+} // namespace veyra::ui
diff --git a/src/ui/QmlDiskCache.cpp b/src/ui/QmlDiskCache.cpp
new file mode 100644
index 00000000..c20bd3f9
--- /dev/null
+++ b/src/ui/QmlDiskCache.cpp
@@ -0,0 +1,58 @@
+#include "veyra/ui/QmlDiskCache.h"
+
+#include <QCryptographicHash>
+#include <QDir>
+#include <QDirIterator>
+#include <QFile>
+#include <QStringList>
+
+namespace veyra::ui {
+
+QmlDiskCacheChoice chooseQmlDiskCache(const QString& moduleDir, const QString& cacheRoot,
+ const QByteArray& explicitPath, const QByteArray& disableCache) {
+ QmlDiskCacheChoice choice;
+ if (!explicitPath.isEmpty()) {
+ choice.note = QStringLiteral("QML_DISK_CACHE_PATH is set; kept");
+ return choice;
+ }
+ if (!disableCache.isEmpty() && disableCache != "0") {
+ choice.note = QStringLiteral("QML_DISABLE_DISK_CACHE is set; no disk cache");
+ return choice;
+ }
+ if (cacheRoot.isEmpty()) {
+ choice.note = QStringLiteral("no cache folder; Qt default kept");
+ return choice;
+ }
+ const QDir module(moduleDir);
+ if (!module.exists()) {
+ choice.note = QStringLiteral("no QML module at ") + moduleDir + QStringLiteral("; Qt default kept");
+ return choice;
+ }
+
+ QStringList files;
+ QDirIterator it(moduleDir, QDir::Files | QDir::Hidden | QDir::System, QDirIterator::Subdirectories);
+ while (it.hasNext()) files << module.relativeFilePath(it.next());
+ files.sort(); // the same tree gives the same digest whatever the listing order
+
+ QCryptographicHash hash(QCryptographicHash::Sha256);
+ for (const QString& name : files) {
+ QFile file(module.filePath(name));
+ if (!file.open(QIODevice::ReadOnly)) {
+ choice.note = QStringLiteral("cannot read ") + name + QStringLiteral("; Qt default kept");
+ return choice;
+ }
+ const QByteArray header = name.toUtf8() + '\0' + QByteArray::number(file.size()) + '\0';
+ hash.addData(header);
+ if (!hash.addData(&file)) {
+ choice.note = QStringLiteral("cannot read ") + name + QStringLiteral("; Qt default kept");
+ return choice;
+ }
+ ++choice.files;
+ choice.bytes += file.size();
+ }
+ choice.digest = QString::fromLatin1(hash.result().toHex().left(16));
+ choice.directory = QDir(cacheRoot).filePath(QStringLiteral("qmlcache-") + choice.digest);
+ return choice;
+}
+
+} // namespace veyra::ui
diff --git a/tests/unit/QmlDiskCacheTests.cpp b/tests/unit/QmlDiskCacheTests.cpp
new file mode 100644
index 00000000..9c73d58c
--- /dev/null
+++ b/tests/unit/QmlDiskCacheTests.cpp
@@ -0,0 +1,81 @@
+// The QML disk cache folder must change with the QML module's contents, even
+// when a release archive gives the new files the old size and time stamp
+// (2.1.3 over 2.1.2, 2026-11-06), and must leave explicit Qt settings alone.
+#include "veyra/ui/QmlDiskCache.h"
+
+#include <QCoreApplication>
+#include <QDateTime>
+#include <QDir>
+#include <QFile>
+#include <QFileInfo>
+
+#include <iostream>
+
+namespace {
+bool check(bool condition, const char* message) {
+ if (!condition) std::cerr << "FAIL: " << message << '\n';
+ return condition;
+}
+// Writes like an archive extraction: fixed contents, then the archive's time stamp.
+bool write(const QString& path, const QByteArray& contents, const QDateTime& stamp) {
+ QDir().mkpath(QFileInfo(path).absolutePath());
+ QFile file(path);
+ if (!file.open(QIODevice::ReadWrite | QIODevice::Truncate)) return false;
+ const bool written = file.write(contents) == contents.size();
+ file.flush();
+ return written && file.setFileTime(stamp, QFileDevice::FileModificationTime);
+}
+veyra::ui::QmlDiskCacheChoice choose(const QString& module, const QString& cacheRoot,
+ const QByteArray& explicitPath = {}, const QByteArray& disable = {}) {
+ return veyra::ui::chooseQmlDiskCache(module, cacheRoot, explicitPath, disable);
+}
+} // namespace
+
+int main(int argc, char** argv) {
+ QCoreApplication app(argc, argv);
+ const QStringList args = QCoreApplication::arguments();
+ if (args.size() != 2) { std::cerr << "usage: veyra_qml_cache_tests <new scratch directory>\n"; return 2; }
+ const QString root = QDir::cleanPath(args.at(1));
+ if (QFileInfo::exists(root)) { std::cerr << "scratch directory already exists\n"; return 2; }
+ const QDateTime stamp(QDate(1980, 1, 1), QTime(0, 0));
+ const QString a = root + "/a/qml/Veyra", b = root + "/b/qml/Veyra", cacheRoot = root + "/cache";
+
+ bool ok = check(write(a + "/ProPage.qml", "Item { implicitWidth: 150 }\n", stamp)
+ && write(a + "/sub/Helper.js", "var picked = 1\n", stamp)
+ && write(a + "/qmldir", "module Veyra\n", stamp), "write module a");
+ // The same files in another folder, written in another order.
+ ok &= check(write(b + "/qmldir", "module Veyra\n", stamp)
+ && write(b + "/sub/Helper.js", "var picked = 1\n", stamp)
+ && write(b + "/ProPage.qml", "Item { implicitWidth: 150 }\n", stamp), "write module b");
+
+ const auto first = choose(a, cacheRoot);
+ ok &= check(first.files == 3 && first.digest.size() == 16 && first.note.isEmpty(), "a module gets a digest");
+ ok &= check(QDir::cleanPath(first.directory) == cacheRoot + "/qmlcache-" + first.digest, "the folder sits in the cache root");
+ ok &= check(choose(a, cacheRoot).directory == first.directory, "the same files give the same folder");
+ ok &= check(choose(b, cacheRoot).directory == first.directory, "install folder and listing order do not matter");
+
+ // 2.1.2 -> 2.1.3: same name, same size, same time stamp, new contents.
+ ok &= check(write(a + "/ProPage.qml", "Item { implicitWidth: 210 }\n", stamp), "rewrite ProPage");
+ ok &= check(QFileInfo(a + "/ProPage.qml").lastModified() == stamp && QFileInfo(a + "/ProPage.qml").size() == QFileInfo(b + "/ProPage.qml").size(),
+ "the rewrite keeps the archive's size and time stamp");
+ const auto changed = choose(a, cacheRoot);
+ ok &= check(!changed.directory.isEmpty() && changed.directory != first.directory, "new contents get a new folder");
+
+ ok &= check(QFile::rename(a + "/sub/Helper.js", a + "/sub/Helper2.js"), "rename a file");
+ const auto renamed = choose(a, cacheRoot);
+ ok &= check(renamed.directory != changed.directory, "a renamed file gets a new folder");
+ ok &= check(write(a + "/NrWebPad.qml", "Item {}\n", stamp), "add a file");
+ const auto added = choose(a, cacheRoot);
+ ok &= check(added.files == 4 && added.directory != renamed.directory, "an added file gets a new folder");
+
+ const auto kept = choose(a, cacheRoot, "D:/elsewhere");
+ ok &= check(kept.directory.isEmpty() && kept.note.contains("QML_DISK_CACHE_PATH"), "an explicit QML_DISK_CACHE_PATH is kept");
+ ok &= check(choose(a, cacheRoot, {}, "1").directory.isEmpty(), "a disabled disk cache stays disabled");
+ ok &= check(!choose(a, cacheRoot, {}, "0").directory.isEmpty(), "QML_DISABLE_DISK_CACHE=0 is not a request to disable");
+ const auto missing = choose(root + "/missing/qml/Veyra", cacheRoot);
+ ok &= check(missing.directory.isEmpty() && missing.note.contains("no QML module"), "no module keeps Qt's default");
+ ok &= check(choose(a, QString()).directory.isEmpty(), "no cache folder keeps Qt's default");
+
+ std::cout << (ok ? "PASS" : "FAIL") << " qml disk cache folder\n";
+ return ok ? 0 : 1;
+}