Skip to content

test(cpu-gui-qt-test): Qt Widgets offscreen render + interaction carpet - #1873

Open
Lfan-ke wants to merge 1 commit into
rcore-os:devfrom
Lfan-ke:apps-starry-cpu-gui-qt-test
Open

test(cpu-gui-qt-test): Qt Widgets offscreen render + interaction carpet#1873
Lfan-ke wants to merge 1 commit into
rcore-os:devfrom
Lfan-ke:apps-starry-cpu-gui-qt-test

Conversation

@Lfan-ke

@Lfan-ke Lfan-ke commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

概述

apps/starry/cpu-gui-qt-test:GUI 框架 carpet(C 侧纯 CPU)。Qt Widgets 经 RASTER paint engine + offscreen QPA 平台(QT_QPA_PLATFORM=offscreen)渲染 - 无显示服务器、无 GPU。每断言都是逐像素闭式 / 精确布局几何 / 真事件注入状态,不是"widget 建了"。Qt 负责 toolkit,仅 SHA/比对/golden 自写。亦是浏览器 GUI 栈(#392)前置。

Cells 与断言(host 真验证绿 Qt6 offscreen/raster, 三门 fail==0 && total==EXPECTED==pass, mutation-tested)

cell 断言
gui_render QPainter fillRect 精确内部+未触 bg+边缘像素; drawLine 覆盖; drawEllipse 解析(中心填充/bbox 角 bg/面积~πr²); Porter-Duff over 逐像素闭式; QLabel grab; 文本 ink-in-bbox
gui_layout QVBox/QHBox/QGrid 子 geometry()==闭式偏移(spacing/margin)+resize 重布局+sizeHint
gui_interact QTest::mouseClick 触发 handler(+禁用按钮负控); QCheckBox toggle 断言 isChecked()+指示器像素变; QLineEdit keyClicks/backspace/ctrl-a; QSlider 精确 value
gui_realassets 真 .ttf 载入 Qt 断言 family+ink; ASSET_DIR 缺 honest-skip

共 89 断言。cells 1-3 全确定(固定 widget 尺寸, offscreen raster)。字体/资产在 git submodule(Lfan-ke/hw4os-s5d1t2 media 分支, git-LFS)经 ASSET_DIR 引用,仓库只放 carpet 代码+golden(避污染主仓)。

特殊声明:素材仅用于 OS 功能完整性 & 正确性验证,不作他用!有事请找:@Lfan-ke

复用 qt6-qtbase musl 不造 toolkit; 逐像素渲染+精确布局+真事件注入交互(状态+重绘双断言)。

关键文件: carpetsprebuild.sh

@mai-team-app mai-team-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本 PR 新增 apps/starry/cpu-gui-qt-test:通过 Qt6 offscreen/raster 覆盖渲染、布局、交互和字体场景。该能力属于新增应用场景,已按 feature-development.md 作为共享的高成本应用工作流审查;实现位于 apps/starry,默认分支未发现等价的 Qt/offscreen 场景,相关开放 PR 检索未发现重叠项。

阻塞问题:当前 head 无法按 README 所述构建并运行该新增应用。详见行内评论。

验证:

  • bash -n prebuild.shsh -n run_all.shpython3 -m py_compile tools/gen_goldens.py 通过;golden 生成器输出与文档的布局/像素常量一致。
  • cargo xtask starry app qemu -t cpu-gui-qt-test --arch x86_64 已实际执行。managed rootfs 下载、扩容和 275 个 APK 安装完成,但首个 Qt carpet 编译时因 cc1plus 派生失败退出,未进入 QEMU;这不是环境缺少工具,qemu-x86_64-staticdebugfsresize2fs 均可用,且 cc1plus 文件已安装于 staging root。
  • 组织 CI(当前 head)有格式、clippy 等成功结果;该新增 app 不在 PR CI 路径中运行,因此这些成功结果不能替代本应用的端到端验证。当前没有既有 review thread 或 issue 评论需要处理。

运行器的 TEST PASSED/TEST FAILED 门控和失败正则已审阅,设计本身看起来可传播失败;但在修复 prebuild 的交叉编译方式并跑通至少一个声明架构的完整 QEMU 应用命令前,四个 carpet 均不可达。

Powered by gpt-5.6-terra

Comment thread apps/starry/cpu-gui-qt-test/prebuild.sh Outdated
PKG_CONFIG_SYSROOT_DIR="$staging_root" PKG_CONFIG_LIBDIR="$staging_root/usr/lib/pkgconfig" \
"$qemu_runner" -L "$staging_root" "$staging_root/usr/bin/pkg-config" "$@"; }

# Each cell is a standalone C++ program including gui_common.h + linking Qt6 Widgets/Test. A compile failure

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

阻塞(可运行性):GXX 只是在 qemu-user 下启动目标 g++,但 GCC 随后以绝对路径派生内部的 cc1plus,该路径不会被 -L/--sysroot 重写。按文档运行 cargo xtask starry app qemu -t cpu-gui-qt-test --arch x86_64 已复现:rootfs 下载、扩容和 275 个 APK 安装完成后,首个编译报 g++: fatal error: cannot execute '.../staging-root/usr/bin/../libexec/gcc/.../cc1plus': posix_spawn: No such file or directory;直接最小调用本 wrapper 也同样失败,且 cc1plus 确实已安装在 staging root 内。因此当前 head 没有生成任何 carpet,更无法启动 QEMU 或执行 gate。请改用以该 staging root 为 sysroot 的宿主交叉工具链,或在能正确解析客体绝对路径的 chroot/container/binfmt 环境执行 GCC,并跑通完整 app 命令。

@mai-team-app mai-team-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本 PR 新增 apps/starry/cpu-gui-qt-test,目标是在 Qt6 offscreen/raster 模式下覆盖渲染、布局、交互和字体场景。它是新增的 StarryOS 应用工作流,feature-development.md 适用;按现有材料属于共享、高成本应用流程。实现位于 apps/starry,不会改变内核 syscall/ABI,影响面看起来与现有 Qt Calculator 场景隔离。

当前阻塞:新增应用无法在当前 head 的标准环境完成已文档化的 x86_64 工作流,详见行内评论。必须先修复并获得至少一个架构从 prebuild 到客体 TEST PASSED 的当前 head 证据。

审查与验证:

  • 已运行 cargo xtask starry app qemu -t cpu-gui-qt-test --arch x86_64。managed rootfs 准备、扩容及 264 个 Qt 包安装完成;首个 carpet 链接时,GCC 11 因 .relr.dynunknown type [0x13] 失败,命令在 QEMU 启动前以 exit 4 结束。
  • bash -n apps/starry/cpu-gui-qt-test/prebuild.shsh -n apps/starry/cpu-gui-qt-test/programs/run_all.shpython3 -m py_compile apps/starry/cpu-gui-qt-test/tools/gen_goldens.py、golden 生成器和 git diff --check 通过;cargo fmt --check 通过。
  • 组织当前 head 的 69 个 check 包含通用格式/lint 成功,但没有执行该新增 app 的完整 QEMU 流程;因此不能替代上述端到端验证。存在的 Axvisor 板卡失败/取消任务不覆盖本次新增的 Starry 应用,未作为本 finding 的依据。

既有 review:旧 head 的 cc1plus 可运行性评论针对已替换的 qemu-user 编译实现,已重新在当前 head 核验;当前阻塞是新的 host cross-linker/RELR fallback 问题。没有 issue 评论需要处理。

重复/重叠:base 中有 apps/starry/qt-calc,但未发现等价的 Qt offscreen GUI carpet;以 cpu-gui-qt-testQt6 和 Starry 关键词检索开放 PR,仅命中本 PR,未见需要合并排序的重复实现。

测试与交付:四个 carpet 的放置和 run_all.sh 的失败门控已审阅,但由于 prebuild 失败,二进制未生成、客体未启动,新增测试尚未证明会被运行器实际执行。待修复后请提供运行命令、工具链准备方式和客体成功标记。

最终 todo 审计:PR/head/差异、既有评论、CI、base/开放 PR 对比、静态检查、应用准备及 x86_64 实际运行均已完成;唯一阻塞项为行内所述可复现的 prebuild 链接失败。维护者表中 apps/ 命中 YanLien;本次已明确 REQUEST_CHANGES,不额外调整 reviewer 请求。

Powered by gpt-5.6-terra

CXX_CMD=() CXX_KIND=""
resolve_cxx() {
local zig; zig="$(command -v zig || true)"
if command -v "${triple}-g++" >/dev/null 2>&1; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

阻塞(可运行性,prebuild.sh:130):按 README 的 cargo xtask starry app qemu -t cpu-gui-qt-test --arch x86_64 实际执行后,rootfs 下载、扩容和 264 个 Qt 包安装均完成,但这里选中的 GCC 11 交叉链接器无法读取 Alpine Qt 6.11 的 .relr.dynunknown type [0x13],随后 cannot find -lQt6Widgets),在 QEMU 启动前以 exit 4 结束。脚本声称会回退到 Zig,但当前标准环境没有 zig(apt 也没有可安装包),且脚本/CI 没有固定并准备它,因此该 fallback 实际不可达。请把 RELR-aware 工具链做成可复现的 runner 前置条件(例如固定并安装 Zig,或使用兼容的 Qt/链接器),并提供至少一个当前 head 架构完整到客体 TEST PASSED 的验证。

GUI-framework carpet (C-side, pure CPU). Qt Widgets render through the RASTER paint engine
with the offscreen QPA platform (QT_QPA_PLATFORM=offscreen) - no display server, no GPU.
Every assertion is per-pixel closed-form / exact layout geometry / real event-injection
state - "widget created" is NOT a test. Qt does the toolkit work; only SHA/comparison/
goldens are self-written. Also the browser GUI-stack front (campaign rcore-os#392).

Cells (three-gate fail==0 && total==EXPECTED==pass, mutation-tested; Qt 6, offscreen/raster):
- gui_render (41): QPainter fillRect exact interior + untouched-bg + edge pixels; drawLine
  axis-aligned coverage; drawEllipse analytic (center fill, bbox corners bg, area ~pi*r^2);
  Porter-Duff "over" per pixel (red@a=128 over green -> closed-form RGBA); a QLabel grabbed
  to QImage (palette bg + centered ink); text glyph ink-in-bbox (font-agnostic).
- gui_layout (24): QVBoxLayout/QHBoxLayout/QGridLayout child geometry() == the closed-form
  offsets (spacing/margins), re-layout on resize, sizeHint/minimumSizeHint composition.
- gui_interact (16): QTest::mouseClick fires the handler (with a disabled-button negative
  control); QCheckBox toggle asserts isChecked() AND the indicator pixel change; QLineEdit
  keyClicks/backspace/ctrl-a; QSlider arrow/page/Home/End exact value() moves.
- gui_realassets (8): loads a real .ttf into Qt and asserts family + ink; honest-skip when
  the font submodule (ASSET_DIR) is absent (the synthetic legs 1-3 always run).

Fonts/assets live in a git submodule (Lfan-ke/hw4os-s5d1t2 media branch, git-LFS) via
ASSET_DIR; only carpet code + goldens are committed here. Deterministic: fixed widget
sizes, offscreen raster engine.

Signed-off-by: 林晨/禾可 <chengkelfan@qq.com>
Signed-off-by: Leo Cheng <chengkelfan@qq.com>
@Lfan-ke
Lfan-ke force-pushed the apps-starry-cpu-gui-qt-test branch from 21e2a0f to d7a875f Compare August 6, 2026 15:48

@mai-team-app mai-team-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本 PR 新增 apps/starry/cpu-gui-qt-test,通过 Qt6 offscreen/raster 覆盖渲染、布局、交互与字体场景。它是新增的 StarryOS 应用工作流,feature-development.md 适用;实现放在 apps/starry,不改变内核 syscall/ABI。与 base 的 qt-calc 相比,Qt offscreen carpet 是独立场景;开放 PR #1876 是并列的 egui 场景,未与本实现重复或形成合入依赖。

当前不能合入:标准的 x86_64 文档化入口无法完成 prebuild,详见行内评论。该失败使四个 carpet 尚未生成,也没有启动 QEMU,因此还不能证明新增测试会被 runner 实际执行。

验证:

  • cargo xtask starry app qemu -t cpu-gui-qt-test --arch x86_64 已实际执行。rootfs 准备与 264 个 APK 安装完成后,现有 GCC 11/binutils 链接 Alpine Qt6 时因 .relr.dynunknown type [0x13],命令以 exit 1 在 QEMU 前结束。
  • bash -n apps/starry/cpu-gui-qt-test/prebuild.shsh -n apps/starry/cpu-gui-qt-test/programs/run_all.shpython3 -m py_compile apps/starry/cpu-gui-qt-test/tools/gen_goldens.py、golden 生成器、git diff --checkcargo fmt --check 通过。
  • 组织当前 head 的 checks 为 success=1、cancelled=1、skipped=4;没有一个执行该新增 app 的 QEMU 流程,不能替代上述端到端验证,且未发现可归因于本 PR 的独立 CI 失败。

既有 review:旧 head 的 qemu-user cc1plus 问题已由改用 host cross compiler 的实现取代;但当前 head 的 RELR-aware linker 回退仍不可复现,故旧评论的“无法完成应用工作流”结论仍未解除。没有 issue 评论需要处理。

最终 todo 审计:约束/新功能准则、实现与运行器门控、base/开放 PR 对比、CI、静态检查及 x86_64 实际运行均已完成;唯一阻塞项是行内所述 prebuild 链接失败。请修复后提供至少一个架构从 prebuild 到客体 TEST PASSED 的当前 head 证据。

Powered by gpt-5.6-terra

elif [[ "$arch" == "x86_64" ]] && command -v g++ >/dev/null 2>&1; then
CXX_CMD=(g++); CXX_KIND="gxx"
else
echo "prebuild: no host cross C++ toolchain for $triple (tried ${triple}-g++, /opt/${triple}-cross, zig, g++)" >&2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

阻塞(可运行性):这里在首个 ${triple}-g++ 链接 Qt6 失败后只能依赖预先安装zig,但 ensure_host_tools 没有准备或验证它,README 也没有给出可执行的安装步骤。按 README 命令运行 x86_64 时,rootfs 和 264 个 APK 已完成,随后现有 GCC 11/binutils 因 Qt6 的 .relr.dynunknown type [0x13];本机无 zig,脚本便在此退出,QEMU 和四个 carpet 都没有执行。请把 RELR-aware linker 的获取/版本校验纳入可重复的 prebuild 流程(或使用已验证的新 binutils),补全运行文档,并提供至少一个架构从 prebuild 到客体 TEST PASSED 的当前 head 结果。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant