Skip to content

test(cpu-gui-egui-test): egui/eframe offscreen render + interaction carpet - #1876

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

test(cpu-gui-egui-test): egui/eframe offscreen render + interaction carpet#1876
Lfan-ke wants to merge 1 commit into
rcore-os:devfrom
Lfan-ke:apps-starry-cpu-gui-egui-test

Conversation

@Lfan-ke

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

Copy link
Copy Markdown
Contributor

概述

apps/starry/cpu-gui-egui-test:egui/eframe GUI carpet(C 侧纯 CPU)。egui(immediate-mode Rust GUI)经 egui_kittest + egui_wgpu 跑 wgpu crate 落到 Mesa lavapipe(软件 Vulkan CPU adapter, backend=Vulkan device_type=Cpu, 同 cpu-wgpu-render 已证 musl 路径)。每断言都是逐像素闭式 / 精确布局 Rect / 真事件注入状态,不是"widget built"。egui_kittest(官方测试框架)负责渲染+事件,仅比对+golden 自写。官方 crates.io。

Cells 与断言(host 真跑绿 lavapipe, 三门 fail==0 && total==EXPECTED==pass, mutation-tested; egui 0.32.3)

cell 断言
egui_render painter rect_filled 内部逐像素==(0,200,80,255)+背景#1B1B1B+边界+全opaque+确定性重渲+label ink-bbox
egui_layout Response.rect==闭式布局(margin=8/item_spacing=(8,3))vertical/horizontal/2x2-grid+adjacency+resize重布局
egui_interact egui_kittest真模拟: get_by_label click计数增+像素变/checkbox toggle bool+指示器/slider arrow value/TextEdit type_text+禁用负控
egui_snapshot robust 8x8 pooled-luminance签名对golden(0.32.3标定+容差吸收AA)+SHA跨进程3跑稳

共 95 断言。官方 crates.io 构建(无 CN 镜像), prebuild 交叉编译 dynamic-musl per-arch. snapshot golden+EXPECTED 标定 egui 0.32.3 on lavapipe(egui 升级重跑 UPDATE_SNAPSHOT_GRID=1)。

复用 egui/egui_kittest 官方不造 GUI 渲染器; wgpu 后端跑 lavapipe(同 wgpu-render proven). 逐像素+精确布局+真事件注入交互(状态+像素双断言). 浏览器 GUI 栈(#392)egui/eframe 路径, 与 Qt Widgets carpet(#1873)并列。

关键文件: carpetsprebuild.sh

…arpet

egui GUI carpet (C-side, pure CPU). egui (immediate-mode Rust GUI) renders via egui_kittest
+ egui_wgpu on the wgpu crate landing on Mesa lavapipe (software Vulkan CPU adapter,
backend=Vulkan device_type=Cpu - the same lavapipe path cpu-wgpu-render proved on musl).
Every assertion is per-pixel closed-form / exact layout Rect / real event-injection state -
"widget built" is NOT a test. egui_kittest (the official egui test harness) does the render+
event work; only comparison + goldens are self-written. Deterministic; official crates.io.

Cells (three-gate fail==0 && total==EXPECTED==pass, mutation-tested; egui 0.32.3):
- egui_render (31): painter rect_filled interior is exactly (0,200,80,255) per pixel (no AA,
  physical coords), background exactly the panel fill #1B1B1B, edge/corner boundary, all-
  opaque framebuffer, byte-identical re-render (determinism), font-AA-tolerant label ink bbox.
- egui_layout (33): exact Response.rect vs closed form from live style (margin=8,
  item_spacing=(8,3)) for vertical/horizontal/2x2-grid add_sized widgets, adjacency gaps,
  resize re-layout, determinism.
- egui_interact (24): real egui_kittest simulation - get_by_label(..).click() increments a
  counter + asserts pixels changed; checkbox toggle asserts bool + indicator pixels; slider
  arrow-key value steps; TextEdit focus+type_text asserts backing String; disabled-button
  no-op negative control.
- egui_snapshot (7): a robust 8x8 pooled-luminance signature vs a committed golden
  (calibrated to 0.32.3, tolerance absorbs AA jitter) + a SHA-256 fingerprint, cross-process
  stable over 3 runs.

Builds against official crates.io (no CN mirror); prebuild cross-compiles to dynamic-musl
per arch. Snapshot golden + EXPECTED calibrated to egui 0.32.3 on lavapipe (re-run
egui_snapshot with UPDATE_SNAPSHOT_GRID=1 on an egui bump). This is the egui/eframe path of
the browser GUI stack (campaign rcore-os#392), alongside the Qt Widgets carpet.

Signed-off-by: 林晨/禾可 <chengkelfan@qq.com>

@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-egui-test:通过 egui_kittest/wgpu/lavapipe 为 StarryOS 提供四个离屏 GUI carpet,包含 rootfs 预构建、四架构 QEMU 配置和失败传播脚本。

book/guideline/feature-development.md 适用;该变更是局部的应用测试能力,不改内核 ABI 或公共接口。实现复用现有 app 的 prebuild/QEMU 模式,run_all.sh 会把任一 cell 的退出失败传递为 TEST FAILED。已对比 dev 的 cpu-concurrency,并检索开放 PR:#1820 的 wgpu 渲染 carpet 是互补的底层 WebGPU 覆盖,不与本 egui 交互/布局覆盖重复。未发现 [patch.crates-io]

验证:git diff --checkbash -n prebuild.shsh -n run_all.sh 和全部新增 TOML 解析通过;但四个新增 carpet crate 的 cargo fmt --check 都失败,详见行内阻塞意见。CI 当前头部有 34 个成功、35 个预期跳过、1 个取消和 1 个失败;失败的是未触及的 Axvisor 自托管板卡 job,和该应用无关。常规 CI 未运行此 Starry app;Starry Apps workflow仅定时/手动触发,因此没有当前头部的应用 QEMU 运行证据。鉴于格式门禁已阻塞,本次未继续启动耗时的四架构 app 运行。

已检查既有 review/issue 评论:当前无历史 review 或行内讨论需要处理。清单其余审阅项已完成;未完成项仅为修复格式后重新验证并运行文档化 QEMU 流程。

Powered by gpt-5.6-terra


use std::sync::atomic::{AtomicU32, Ordering};

use egui_kittest::kittest::Queryable;

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.

阻塞:这里及同文件多处格式不符合仓库 rustfmt。(cd apps/starry/cpu-gui-egui-test/programs/carpets/egui_interact && cargo fmt --check) 当前退出码为 1,首个差异就是该 import 的排序/合并方式,后续还有多处长调用换行差异。请对新增的四个 carpet crate 执行 cargo fmt 并提交结果,再重新验证格式检查;否则当前新增 Rust 源码不能通过项目的格式门禁。

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