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++

test(ui-mig): G0.6 easing curves read back through QML against the CSS curves

Veyra Goal Agent828199b7477f
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a748457e..7bc6e79e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -773,6 +773,13 @@ if(VEYRA_BUILD_QML_UI AND Qt6_FOUND)
target_compile_features(veyra_qml_ui PRIVATE cxx_std_20)
# Qt6::CorePrivate only for QUnifiedTimer's slow mode behind --slow-animations.
target_link_libraries(veyra_qml_ui PRIVATE veyra_qml_bridge veyra_engine Qt6::CorePrivate)
+
+ # 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.
+ add_executable(veyra_qml_easing_tests tests/qml/QmlEasingTests.cpp)
+ target_compile_features(veyra_qml_easing_tests PRIVATE cxx_std_20)
+ target_compile_definitions(veyra_qml_easing_tests PRIVATE VEYRA_QML_DIR="${CMAKE_CURRENT_SOURCE_DIR}/qml")
+ target_link_libraries(veyra_qml_easing_tests PRIVATE Qt6::Gui Qt6::Qml Qt6::Quick)
endif()
# Qt + D3D12 host probe (S3.0): answers whether Qt can host the native video
diff --git a/docs/UI_FULL_GOAL_PLAN_2026-09-26.md b/docs/UI_FULL_GOAL_PLAN_2026-09-26.md
index 8ab65c37..9c4e313e 100644
--- a/docs/UI_FULL_GOAL_PLAN_2026-09-26.md
+++ b/docs/UI_FULL_GOAL_PLAN_2026-09-26.md
@@ -9,7 +9,7 @@
| 阶段 | 状态 | 最后标签 | 备注 |
|---|---|---|---|
-| G0 工具与基线 | 进行中 | checkpoint/ui-mig-g0.5 | G0.2 设计参考在 `logs\ui-qml-migration-20260925\design-ref\`(shotpage 默认关过渡,`?motion=1` 保留动画);G0.3 测试开关逐项截图于 `goal\g0.3\`;G0.4 对比图在 `compare\`;G0.5 动效曲线在 `goal\g0.5\`(QML 线性无超调、页面无过渡);下一步 G0.6 |
+| G0 工具与基线 | 进行中 | checkpoint/ui-mig-g0.6 | G0.2 设计参考在 `logs\ui-qml-migration-20260925\design-ref\`(shotpage 默认关过渡,`?motion=1` 保留动画);G0.3 测试开关逐项截图于 `goal\g0.3\`;G0.4 对比图在 `compare\`;G0.5 动效曲线在 `goal\g0.5\`(QML 线性无超调、页面无过渡);G0.6 `veyra_qml_easing_tests` 修前 3 条全失败(构建目录改 `qt-probe-20260926`);下一步 G0.7 |
| G1 基础(缓动/背景/字体/图标/组件动效) | 未开始 | | |
| G2 外壳 | 未开始 | | |
| G3 四主屏 | 未开始 | | |
diff --git a/docs/UI_MIGRATION_EXECUTION_2026-09-25.md b/docs/UI_MIGRATION_EXECUTION_2026-09-25.md
index 103fe5ae..5c1d52b8 100644
--- a/docs/UI_MIGRATION_EXECUTION_2026-09-25.md
+++ b/docs/UI_MIGRATION_EXECUTION_2026-09-25.md
@@ -41,6 +41,7 @@
| G0.3 | 应用测试开关 | 完成(逐项截图已看) | `checkpoint/ui-mig-g0.3` | `--page --tab --dialog --aspect --dock-pinned --size WxH --reduced-motion --slow-animations N`;证据 `goal\g0.3\`。带片源时应用自动进极简且原生视频窗盖住 QML,对话框/dock 截图需不带片源 |
| G0.4 | `shoot-all.ps1`(17 屏 QML)+ `compose-compare.ps1`(左设计右 QML) | 完成(看图) | `checkpoint/ui-mig-g0.4` | QML 截图 `logs\ui-qml-migration-20260925\qml-ref\`,对比 `compare\cmp-f-*.png`。首页缺“继续上次/最近”、卡片图标为 emoji、标志偏低;专业页缺 NR 多层卡、仪表折线与分段柱、顺序条换行——列入 G1/G3 |
| G0.5 | 动效采样(设计 vs QML) | 完成(曲线已看) | `checkpoint/ui-mig-g0.5` | `tools/qt_probe/motion-sample.ps1`;设计端 `shotpage.js ?motion=1&probe=` 暂停 Web Animations 按 10ms 定位读值,QML 端 `--motion-probe` 每帧记日志。证据 `goal\g0.5\`(design/qml CSV + chart)。dock:设计 110ms 到位、130ms 超调峰 10.17px,QML 线性 566ms 到 8px 无超调;开关:设计峰 14.6px,QML 线性 500ms;页面切换:设计 rise 16→0 约 150ms,QML 无过渡。证实 4 值 bezierCurve 退化为线性(G1.1)与缺页面进入动画(G2.2) |
+| G0.6 | 缓动单元测试 `veyra_qml_easing_tests` | 完成(修前失败,符合预期) | `checkpoint/ui-mig-g0.6` | `tests/qml/QmlEasingTests.cpp` 通过 QML 读回 NumberAnimation 的曲线,与 CSS `linear()` / `cubic-bezier` 求值比较(容差 0.01)。修前三条曲线类型均为 0(Linear),最大误差 spring 0.81、springSoft 0.76、easeOut 0.53(`goal\g0.6\before-fix.txt`)。构建目录改为 `build\qt-probe-20260926`:旧目录 CMake 不再写 `rules.ninja`,根因是 936 代码页下 include-probe 前缀乱码(与 WORKLOG 0.0.4 同一故障),`build-qt-probe.ps1` 现以 65001 调用并加 `-Out` |
## 发现并修复的 bug
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index f9f9fdfa..bda10648 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -6551,3 +6551,15 @@ release. 5090 live acceptance, 15-second hitch and user flicker remain unresolve
QML 线性 500ms;页面进入设计 y 16→0 约 150ms(spring-soft),QML 完全无过渡。
脚本首版反斜杠正则在生成时退化为非法正则,改用 `.Replace([char]92,[char]47)`。
引擎门槛未跑(仅测试探针,未动引擎)。
+
+- G0.6:新增 `tests/qml/QmlEasingTests.cpp`(目标 `veyra_qml_easing_tests`,Qt offscreen),把 Theme.spring /
+ springSoft / easeOut 装进真实 NumberAnimation 读回 QEasingCurve,与设计稿 CSS `linear()` 停靠点和
+ `cubic-bezier(.2,.8,.2,1)` 逐 0.005 比较,容差 0.01。修前结果(预期失败):三条曲线 type=0(线性),
+ 最大误差 0.8141 / 0.7600 / 0.5276,输出 `E:/项目/Veyra/logs/ui-qml-migration-20260925/goal/g0.6/before-fix.txt`。
+ 构建故障:在旧目录加目标后 ninja 报 unknown build rule,CMake 不再写 `CMakeFiles/rules.ninja`。
+ cl `/showIncludes` 在 936 代码页输出 GBK,include-probe 前缀乱码,与 0.0.4 时同一根因。
+ `scripts/build-qt-probe.ps1` 改为 chcp 65001 下调用(结束恢复原代码页),新增 `-Out`,默认新目录 `E:/项目/Veyra/build/qt-probe-20260926`。
+ 在 .cmd 内部切代码页会让 cmd 以 UTF-8 重读非 ASCII 输出路径,产物落进乱码目录 `E:/椤圭洰`。
+ 该试验本轮在那里生成的 build/tmp 已删除;该乱码目录下原有的 logs 非本轮产物,保留未动。
+ 旧目录 `qt-probe-20260925` 留存未删。
+ 重建 `veyra_qml_ui` exit 0。
diff --git a/scripts/build-qt-probe.ps1 b/scripts/build-qt-probe.ps1
index b88cb6dd..93d5c9cd 100644
--- a/scripts/build-qt-probe.ps1
+++ b/scripts/build-qt-probe.ps1
@@ -1,12 +1,20 @@
# Wrapper for scripts/build-qt-probe.cmd: sets the non-ASCII paths (a .cmd is
# parsed in the ANSI code page) and runs the build through cmd's redirection.
-param([string[]]$Targets = @(), [string]$Log = 'E:\项目\Veyra\logs\ui-qml-migration-20260925\qt-build.log')
-$env:VEYRA_QT_OUT = 'E:\项目\Veyra\build\qt-probe-20260925'
+param([string[]]$Targets = @(), [string]$Log = 'E:\项目\Veyra\logs\ui-qml-migration-20260925\qt-build.log',
+ [string]$Out = 'E:\项目\Veyra\build\qt-probe-20260926')
+$env:VEYRA_QT_OUT = $Out
$env:VEYRA_QT_TMP = 'E:\项目\Veyra\tmp\ui-qml-migration-20260925'
$env:VEYRA_QT_DIR = 'E:\项目\Veyra\deps\qt\6.8.3\msvc2022_64'
$cmd = Join-Path $PSScriptRoot 'build-qt-probe.cmd'
-& cmd.exe /c "`"$cmd`" $($Targets -join ' ') > `"$Log`" 2>&1"
-$code = $LASTEXITCODE
+# CMake decodes cl /showIncludes in the console code page. Under 936 the include-probe
+# prefix comes back garbled and the Ninja generator silently stops writing
+# CMakeFiles/rules.ninja (WORKLOG 0.0.4 build failure; build-isolated.ps1 does the same).
+# The code page is switched out here, not inside the .cmd: there cmd re-reads the
+# non-ASCII output path as UTF-8 and the build lands in a mojibake directory.
+$savedCodePage = (& cmd.exe /d /c chcp) -replace '[^0-9]', ''
+& cmd.exe /d /c 'chcp 65001 >nul'
+try { & cmd.exe /c "`"$cmd`" $($Targets -join ' ') > `"$Log`" 2>&1"; $code = $LASTEXITCODE }
+finally { & cmd.exe /d /c "chcp $savedCodePage >nul" }
Get-Content -LiteralPath $Log -Tail 30 -Encoding utf8
"exit=$code"
exit $code
diff --git a/tests/qml/QmlEasingTests.cpp b/tests/qml/QmlEasingTests.cpp
new file mode 100644
index 00000000..909d9c48
--- /dev/null
+++ b/tests/qml/QmlEasingTests.cpp
@@ -0,0 +1,101 @@
+// G0.6: the Theme easing curves, read back from a real QML NumberAnimation, against the
+// design's CSS timing functions (prototypes/ui-redesign-2026-09-25/*.css, inside .vy):
+// --spring linear(0,.009,.035 2.1%,.141 4.4%,.723 12.9%,.938 16.7%,1.017 20.2%,
+// 1.043 24%,1.035 28.4%,.998 38.5%,.99 44.1%,1.001 60.7%,1)
+// --spring-soft linear(0,.02,.08 3.2%,.3 7.5%,.84 17%,1.01 25%,1.025 31%,1.004 45%,1)
+// --out cubic-bezier(.2,.8,.2,1)
+// Reading the curve through QML matters: easing.bezierCurve silently falls back to
+// linear when its length is not a multiple of 6, which is exactly the bug this catches.
+#include <QCoreApplication>
+#include <QEasingCurve>
+#include <QGuiApplication>
+#include <QQmlComponent>
+#include <QQmlEngine>
+#include <QVariant>
+#include <cmath>
+#include <cstdio>
+#include <memory>
+#include <utility>
+#include <vector>
+
+namespace {
+using Stops = std::vector<std::pair<double, double>>; // (input %, output)
+
+// CSS linear(): points without a position are spread evenly between their neighbours.
+Stops css_linear(std::vector<std::pair<double, double>> raw) {
+ // raw: (output, position or -1)
+ const size_t n = raw.size();
+ raw.front().second = raw.front().second < 0 ? 0 : raw.front().second;
+ raw.back().second = raw.back().second < 0 ? 100 : raw.back().second;
+ for (size_t i = 1; i < n; ++i) {
+ if (raw[i].second >= 0) continue;
+ size_t j = i;
+ while (raw[j].second < 0) ++j;
+ const double a = raw[i - 1].second, b = raw[j].second;
+ for (size_t k = i; k < j; ++k) raw[k].second = a + (b - a) * double(k - i + 1) / double(j - i + 1);
+ }
+ Stops s;
+ for (auto& [v, p] : raw) s.push_back({p / 100.0, v});
+ return s;
+}
+
+double eval_linear(const Stops& s, double t) {
+ for (size_t i = 1; i < s.size(); ++i)
+ if (t <= s[i].first) {
+ const double span = s[i].first - s[i - 1].first;
+ const double f = span > 0 ? (t - s[i - 1].first) / span : 1;
+ return s[i - 1].second + (s[i].second - s[i - 1].second) * f;
+ }
+ return s.back().second;
+}
+
+double eval_bezier(double x1, double y1, double x2, double y2, double x) {
+ auto bx = [&](double u) { return 3 * x1 * u * (1 - u) * (1 - u) + 3 * x2 * u * u * (1 - u) + u * u * u; };
+ auto by = [&](double u) { return 3 * y1 * u * (1 - u) * (1 - u) + 3 * y2 * u * u * (1 - u) + u * u * u; };
+ double lo = 0, hi = 1;
+ for (int i = 0; i < 60; ++i) { const double m = (lo + hi) / 2; (bx(m) < x ? lo : hi) = m; }
+ return by((lo + hi) / 2);
+}
+
+int failures = 0;
+
+void compare(QQmlEngine& engine, const char* property, auto reference) {
+ QQmlComponent c(&engine);
+ c.setData(QByteArray("import QtQuick\nimport Veyra\nNumberAnimation { easing.bezierCurve: Theme.") + property + " }",
+ QUrl(QStringLiteral("inline.qml")));
+ std::unique_ptr<QObject> anim(c.create());
+ if (!anim) {
+ std::printf("FAIL %s: %s\n", property, qPrintable(c.errorString()));
+ ++failures;
+ return;
+ }
+ const auto curve = anim->property("easing").value<QEasingCurve>();
+ double worst = 0, at = 0;
+ for (int i = 0; i <= 200; ++i) {
+ const double t = i / 200.0;
+ const double e = std::abs(curve.valueForProgress(t) - reference(t));
+ if (e > worst) { worst = e; at = t; }
+ }
+ const bool ok = worst <= 0.01;
+ std::printf("%s %s: type=%d max error %.4f at t=%.3f\n", ok ? "PASS" : "FAIL", property, int(curve.type()), worst, at);
+ if (!ok) ++failures;
+}
+} // namespace
+
+int main(int argc, char** argv) {
+ qputenv("QT_QPA_PLATFORM", "offscreen");
+ QGuiApplication app(argc, argv);
+ QQmlEngine engine;
+ engine.addImportPath(QStringLiteral(VEYRA_QML_DIR));
+
+ const Stops spring = css_linear({{0, -1}, {.009, -1}, {.035, 2.1}, {.141, 4.4}, {.723, 12.9}, {.938, 16.7},
+ {1.017, 20.2}, {1.043, 24}, {1.035, 28.4}, {.998, 38.5}, {.99, 44.1},
+ {1.001, 60.7}, {1, -1}});
+ const Stops soft = css_linear({{0, -1}, {.02, -1}, {.08, 3.2}, {.3, 7.5}, {.84, 17}, {1.01, 25},
+ {1.025, 31}, {1.004, 45}, {1, -1}});
+ compare(engine, "spring", [&](double t) { return eval_linear(spring, t); });
+ compare(engine, "springSoft", [&](double t) { return eval_linear(soft, t); });
+ compare(engine, "easeOut", [](double t) { return eval_bezier(.2, .8, .2, 1, t); });
+ std::printf("failures=%d\n", failures);
+ return failures ? 1 : 0;
+}