Skip to content

feat(ui-test): 增加测试页面用于测试 UI,仅 Debug 模式编译 - #3505

Open
MoeSnowyFox wants to merge 1 commit into
PCL-Community:devfrom
MoeSnowyFox:dev
Open

feat(ui-test): 增加测试页面用于测试 UI,仅 Debug 模式编译#3505
MoeSnowyFox wants to merge 1 commit into
PCL-Community:devfrom
MoeSnowyFox:dev

Conversation

@MoeSnowyFox

@MoeSnowyFox MoeSnowyFox commented Aug 5, 2026

Copy link
Copy Markdown

喵喵喵

Summary by Sourcery

添加仅用于调试的 UI 测试页面和导航入口,用于新 UI 的内部测试。

新功能:

  • 引入一个仅在调试模式下可见的顶级 Test 页面,包含左、右面板,用于 UI 试验。
  • 在主窗口标题栏中添加一个 Test 选项卡按钮,仅在 Debug 构建中显示。

增强:

  • 在调试控制台模式下将控制台输出编码初始化为 UTF-8,以提升日志可读性。
Original summary in English

Summary by Sourcery

Add a debug-only UI test page and navigation entry for internal testing of the new UI.

New Features:

  • Introduce a debug-only top-level Test page with left and right panels for UI experimentation.
  • Add a Test tab button to the main window title bar that appears only in Debug builds.

Enhancements:

  • Initialize console output encoding to UTF-8 in debug console mode to improve log readability.

@pcl-ce-automation pcl-ce-automation Bot added 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 size: L PR 大小评估:大型 labels Aug 5, 2026
@sourcery-ai

sourcery-ai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

审阅者指南(Reviewer's Guide)

在调试模式下新增一个仅用于调试的顶层 Test 页面(带左右双栏和标题栏按钮),将其接入页面导航和全局页面实例管理,并确保在调试模式下控制台输出使用 UTF-8;同时为新页面增加本地化条目并完成项目接线。

导航到新调试 Test 页面的时序图

sequenceDiagram
    actor User
    participant FormMain
    participant ModMain
    participant PageTestLeft
    participant PageTestRight

    User->>FormMain: BtnTitleSelect_Click(btnTitleTest, args)
    FormMain->>FormMain: PageChangeActual(stack, PageType.Test)
    FormMain->>ModMain: access frmTestLeft
    alt frmTestLeft is null
        FormMain->>ModMain: create new PageTestLeft()
        ModMain-->>PageTestLeft: store instance in frmTestLeft
    end
    FormMain->>ModMain: access frmTestRight
    alt frmTestRight is null
        FormMain->>ModMain: create new PageTestRight()
        ModMain-->>PageTestRight: store instance in frmTestRight
    end
    FormMain->>FormMain: PageChangeAnim(frmTestLeft, frmTestRight)
Loading

Test 页面中新 Toast 测试操作的时序图

sequenceDiagram
    actor User
    participant PageTestRight
    participant HintService

    User->>PageTestRight: BtnToastTest_Click(sender, MouseButtonEventArgs)
    PageTestRight->>HintService: Hint("测试 Toast:新弹窗系统工作正常", HintType.Info)
Loading

文件级变更

变更 详情 文件
引入仅在调试模式下可用的顶层 Test 页面及其导航入口。
  • 添加一个仅在 Debug 下显示的标题栏单选按钮,用于导航到 Test 页面。
  • 扩展 PageType,新增一个仅在 Debug 下使用的 Test 枚举值,并在 PageChangeActual 中处理它以实例化并显示 PageTestLeft/PageTestRight。
  • 在 ModMain 中为 PageTestLeft/PageTestRight 注册静态引用,并用 DEBUG 宏进行保护。
Plain Craft Launcher 2/FormMain.xaml.cs
Plain Craft Launcher 2/Modules/ModMain.cs
实现 Test 页面左右面板壳和一个示例 Toast 测试操作。
  • 创建 PageTestLeft 部分类及其 XAML 布局,作为用于测试 UI 的左侧面板容器。
  • 创建 PageTestRight 部分类及其 XAML 布局,包括一个 BtnToastTest_Click 处理函数,用于显示信息类型的 Hint toast 来验证新的 toast 系统。
Plain Craft Launcher 2/Pages/PageTest/PageTestLeft.xaml.cs
Plain Craft Launcher 2/Pages/PageTest/PageTestRight.xaml.cs
Plain Craft Launcher 2/Pages/PageTest/PageTestLeft.xaml
Plain Craft Launcher 2/Pages/PageTest/PageTestRight.xaml
调整新的 Test 选项卡的调试控制台行为和本地化。
  • 在 Debug 构建中将 Console.OutputEncoding 设置为 UTF-8,以保证使用 --console 标志时中文/Unicode 输出能正确显示。
  • 为新的 Main.Tab.Test 标签在 en-US 和 zh-CN 资源文件中添加本地化条目。
  • 更新项目文件,将新的 Test 页面 XAML 和后台代码文件包含进构建。
Plain Craft Launcher 2/Program.cs
PCL.Core/App/Localization/Languages/en-US.xaml
PCL.Core/App/Localization/Languages/zh-CN.xaml
Plain Craft Launcher 2/Plain Craft Launcher 2.csproj

提示与命令

与 Sourcery 交互

  • 触发新的审阅: 在拉取请求上评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub Issue: 在审阅评论下回复,要求 Sourcery 从该评论创建一个 issue。你也可以在审阅评论下回复 @sourcery-ai issue 来从该评论创建 issue。
  • 生成拉取请求标题: 在拉取请求标题的任意位置写入 @sourcery-ai,即可随时生成标题。你也可以在拉取请求上评论 @sourcery-ai title 来(重新)生成标题。
  • 生成拉取请求摘要: 在拉取请求正文中任意位置写入 @sourcery-ai summary,即可在该位置生成 PR 摘要。你也可以在拉取请求上评论 @sourcery-ai summary 来(重新)生成摘要。
  • 生成审阅者指南: 在拉取请求上评论 @sourcery-ai guide,即可(重新)生成审阅者指南。
  • 解决所有 Sourcery 评论: 在拉取请求上评论 @sourcery-ai resolve,即可将所有 Sourcery 评论标记为已解决。如果你已经处理完所有评论且不想再看到它们,这会很有用。
  • 驳回所有 Sourcery 审阅: 在拉取请求上评论 @sourcery-ai dismiss,即可驳回所有现有的 Sourcery 审阅。尤其适合你想在新审阅中从头开始的场景——别忘了再评论 @sourcery-ai review 来触发新的审阅!

自定义你的使用体验

打开你的 控制面板 可以:

  • 启用或禁用诸如 Sourcery 生成的拉取请求摘要、审阅者指南等审阅功能。
  • 更改审阅语言。
  • 添加、移除或编辑自定义审阅指令。
  • 调整其他审阅设置。

获取帮助

Original review guide in English

Reviewer's Guide

Adds a debug-only top-level Test page with left/right panes and a title bar button, wires it into the page navigation and global page instances, and ensures console output uses UTF-8 in debug mode; also introduces localization entries and project wiring for the new page.

Sequence diagram for navigation to the new debug Test page

sequenceDiagram
    actor User
    participant FormMain
    participant ModMain
    participant PageTestLeft
    participant PageTestRight

    User->>FormMain: BtnTitleSelect_Click(btnTitleTest, args)
    FormMain->>FormMain: PageChangeActual(stack, PageType.Test)
    FormMain->>ModMain: access frmTestLeft
    alt frmTestLeft is null
        FormMain->>ModMain: create new PageTestLeft()
        ModMain-->>PageTestLeft: store instance in frmTestLeft
    end
    FormMain->>ModMain: access frmTestRight
    alt frmTestRight is null
        FormMain->>ModMain: create new PageTestRight()
        ModMain-->>PageTestRight: store instance in frmTestRight
    end
    FormMain->>FormMain: PageChangeAnim(frmTestLeft, frmTestRight)
Loading

Sequence diagram for the new toast test action on Test page

sequenceDiagram
    actor User
    participant PageTestRight
    participant HintService

    User->>PageTestRight: BtnToastTest_Click(sender, MouseButtonEventArgs)
    PageTestRight->>HintService: Hint("测试 Toast:新弹窗系统工作正常", HintType.Info)
Loading

File-Level Changes

Change Details Files
Introduce a debug-only top-level Test page and navigation entry.
  • Add a Debug-only title bar radio button that navigates to the Test page.
  • Extend PageType with a Debug-only Test enum value and handle it in PageChangeActual to instantiate and show PageTestLeft/PageTestRight.
  • Register static references for PageTestLeft/PageTestRight in ModMain behind DEBUG guards.
Plain Craft Launcher 2/FormMain.xaml.cs
Plain Craft Launcher 2/Modules/ModMain.cs
Implement Test page left/right pane shells and a sample Toast test action.
  • Create PageTestLeft partial class and XAML layout as the left pane container for testing UI.
  • Create PageTestRight partial class and XAML layout, including a BtnToastTest_Click handler that shows an info Hint toast to verify the new toast system.
Plain Craft Launcher 2/Pages/PageTest/PageTestLeft.xaml.cs
Plain Craft Launcher 2/Pages/PageTest/PageTestRight.xaml.cs
Plain Craft Launcher 2/Pages/PageTest/PageTestLeft.xaml
Plain Craft Launcher 2/Pages/PageTest/PageTestRight.xaml
Adjust debug console behavior and localization for the new Test tab.
  • Set Console.OutputEncoding to UTF-8 in Debug builds to ensure Chinese/Unicode output renders correctly when using the --console flag.
  • Add localization entries for the new Main.Tab.Test label in both en-US and zh-CN resource files.
  • Update the project file to include the new Test page XAML and code-behind files in the build.
Plain Craft Launcher 2/Program.cs
PCL.Core/App/Localization/Languages/en-US.xaml
PCL.Core/App/Localization/Languages/zh-CN.xaml
Plain Craft Launcher 2/Plain Craft Launcher 2.csproj

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai 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.

Hey - 我在下面给出了一些整体性的反馈:

  • 建议将新测试按钮中硬编码的 Tag 值 "4" 替换为从枚举中派生出来的值(例如 ((int)PageType.Test).ToString()),以避免在 PageType 的取值发生变化时,Tag 与之不同步。
  • PageType.Test 的取值被包裹在 #if DEBUG 中,因此将来在枚举中新增成员时需要特别注意顺序;你可能会希望为后续的枚举成员显式指定整数值,以避免在 Debug 和 Release 构建之间出现不易察觉的编号变化。
给 AI Agent 的提示
Please address the comments from this code review:

## Overall Comments
- Consider replacing the hardcoded Tag value "4" for the new test button with something derived from the enum (e.g., ((int)PageType.Test).ToString()) to avoid the Tag getting out of sync if PageType values change.
- The PageType.Test value is wrapped in #if DEBUG, so any future additions to the enum should be carefully ordered; you might want to explicitly assign integer values to later enum members to avoid subtle numbering changes between Debug and Release builds.

Sourcery 对开源项目是免费的——如果你觉得我们的评审对你有帮助,欢迎分享 ✨
帮我变得更有用!请对每条评论点击 👍 或 👎,我会根据你的反馈不断改进评审质量。
Original comment in English

Hey - I've left some high level feedback:

  • Consider replacing the hardcoded Tag value "4" for the new test button with something derived from the enum (e.g., ((int)PageType.Test).ToString()) to avoid the Tag getting out of sync if PageType values change.
  • The PageType.Test value is wrapped in #if DEBUG, so any future additions to the enum should be carefully ordered; you might want to explicitly assign integer values to later enum members to avoid subtle numbering changes between Debug and Release builds.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider replacing the hardcoded Tag value "4" for the new test button with something derived from the enum (e.g., ((int)PageType.Test).ToString()) to avoid the Tag getting out of sync if PageType values change.
- The PageType.Test value is wrapped in #if DEBUG, so any future additions to the enum should be carefully ordered; you might want to explicitly assign integer values to later enum members to avoid subtle numbering changes between Debug and Release builds.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 489a913b5d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Plain Craft Launcher 2/Program.cs Outdated
@pcl-ce-automation pcl-ce-automation Bot added size: M PR 大小评估:中型 and removed size: L PR 大小评估:大型 labels Aug 5, 2026

@Chiloven945 Chiloven945 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

请确保测试内容也接入 i18n。

@Chiloven945 Chiloven945 changed the title imp: 增加测试页面用于测试ui, 仅debug模式编译 feat(ui-test): 增加测试页面用于测试 UI,仅 Debug 模式编译 Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: M PR 大小评估:中型 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants