Rename legacy shell demo toggle away from ImGui

This commit is contained in:
2026-04-05 16:34:50 +08:00
parent 74b1280aa6
commit cbd888e745
7 changed files with 50 additions and 49 deletions

View File

@@ -71,11 +71,11 @@ struct ShellCommandHarness {
bindings.setXCUILayoutLabPanelVisible = [this](bool visible) {
panels[ToPanelIndex(Application::ShellPanelId::XCUILayoutLab)].visible = visible;
};
bindings.getImGuiDemoWindowVisible = [this]() {
return viewToggles.imguiDemoWindowVisible;
bindings.getLegacyHostDemoWindowVisible = [this]() {
return viewToggles.legacyHostDemoWindowVisible;
};
bindings.setImGuiDemoWindowVisible = [this](bool visible) {
viewToggles.imguiDemoWindowVisible = visible;
bindings.setLegacyHostDemoWindowVisible = [this](bool visible) {
viewToggles.legacyHostDemoWindowVisible = visible;
};
bindings.getNativeBackdropVisible = [this]() {
return viewToggles.nativeBackdropVisible;
@@ -134,7 +134,7 @@ TEST(ApplicationShellCommandBindingsTest, RegisterShellViewCommandsInvokesBoundT
EXPECT_TRUE(router.HasCommand(Application::ShellCommandIds::ToggleXCUIDemoPanel));
EXPECT_TRUE(router.HasCommand(Application::ShellCommandIds::ToggleXCUILayoutLabPanel));
EXPECT_TRUE(router.HasCommand(Application::ShellCommandIds::ToggleImGuiDemoWindow));
EXPECT_TRUE(router.HasCommand(Application::ShellCommandIds::ToggleLegacyHostDemoWindow));
EXPECT_TRUE(router.HasCommand(Application::ShellCommandIds::ToggleNativeBackdrop));
EXPECT_TRUE(router.HasCommand(Application::ShellCommandIds::TogglePulseAccent));
EXPECT_TRUE(router.HasCommand(Application::ShellCommandIds::ToggleNativeXCUIOverlay));
@@ -144,8 +144,8 @@ TEST(ApplicationShellCommandBindingsTest, RegisterShellViewCommandsInvokesBoundT
EXPECT_TRUE(router.InvokeCommand(Application::ShellCommandIds::ToggleXCUIDemoPanel));
EXPECT_FALSE(harness.Panel(Application::ShellPanelId::XCUIDemo).visible);
EXPECT_TRUE(router.InvokeCommand(Application::ShellCommandIds::ToggleImGuiDemoWindow));
EXPECT_TRUE(harness.viewToggles.imguiDemoWindowVisible);
EXPECT_TRUE(router.InvokeCommand(Application::ShellCommandIds::ToggleLegacyHostDemoWindow));
EXPECT_TRUE(harness.viewToggles.legacyHostDemoWindowVisible);
EXPECT_TRUE(router.InvokeCommand(Application::ShellCommandIds::ToggleNativeBackdrop));
EXPECT_FALSE(harness.viewToggles.nativeBackdropVisible);
EXPECT_TRUE(router.InvokeCommand(Application::ShellCommandIds::ToggleNativeXCUIOverlay));

View File

@@ -17,7 +17,7 @@ TEST(XCUIShellChromeStateTest, DefaultsMatchCurrentShellChromeConfiguration) {
XCUIShellChromeState state = {};
const auto& viewToggles = state.GetViewToggles();
EXPECT_FALSE(viewToggles.imguiDemoWindowVisible);
EXPECT_FALSE(viewToggles.legacyHostDemoWindowVisible);
EXPECT_TRUE(viewToggles.nativeBackdropVisible);
EXPECT_TRUE(viewToggles.pulseAccentEnabled);
EXPECT_TRUE(viewToggles.nativeXCUIOverlayVisible);
@@ -118,9 +118,9 @@ TEST(XCUIShellChromeStateTest, HostedPreviewStateSeparatesEnablementFromRequeste
TEST(XCUIShellChromeStateTest, ViewToggleMutatorsOnlyFlipRequestedFlags) {
XCUIShellChromeState state = {};
EXPECT_TRUE(state.SetViewToggle(XCUIShellViewToggleId::ImGuiDemoWindow, true));
EXPECT_TRUE(state.GetViewToggle(XCUIShellViewToggleId::ImGuiDemoWindow));
EXPECT_FALSE(state.SetViewToggle(XCUIShellViewToggleId::ImGuiDemoWindow, true));
EXPECT_TRUE(state.SetViewToggle(XCUIShellViewToggleId::LegacyHostDemoWindow, true));
EXPECT_TRUE(state.GetViewToggle(XCUIShellViewToggleId::LegacyHostDemoWindow));
EXPECT_FALSE(state.SetViewToggle(XCUIShellViewToggleId::LegacyHostDemoWindow, true));
EXPECT_TRUE(state.ToggleViewToggle(XCUIShellViewToggleId::HostedPreviewHud));
EXPECT_FALSE(state.GetViewToggle(XCUIShellViewToggleId::HostedPreviewHud));
@@ -204,9 +204,9 @@ TEST(XCUIShellChromeStateTest, ViewMenuDescriptorMatchesCurrentApplicationOrderi
EXPECT_EQ(menu.items[1].command.commandId, XCUIShellChromeCommandIds::ToggleXCUILayoutLabPanel);
ASSERT_EQ(menu.items[2].kind, XCUIShellMenuItemKind::Command);
EXPECT_EQ(menu.items[2].command.label, "ImGui Demo");
EXPECT_EQ(menu.items[2].command.label, "Legacy Host Demo");
EXPECT_EQ(menu.items[2].command.shortcut, "Ctrl+3");
EXPECT_EQ(menu.items[2].command.commandId, XCUIShellChromeCommandIds::ToggleImGuiDemoWindow);
EXPECT_EQ(menu.items[2].command.commandId, XCUIShellChromeCommandIds::ToggleLegacyHostDemoWindow);
EXPECT_EQ(menu.items[3].kind, XCUIShellMenuItemKind::Separator);
@@ -276,8 +276,8 @@ TEST(XCUIShellChromeStateTest, PanelCommandIdHelpersMatchCurrentShellCommands) {
TEST(XCUIShellChromeStateTest, ViewToggleCommandIdHelpersMatchCurrentShellCommands) {
EXPECT_EQ(
XCUIShellChromeState::GetViewToggleCommandId(XCUIShellViewToggleId::ImGuiDemoWindow),
XCUIShellChromeCommandIds::ToggleImGuiDemoWindow);
XCUIShellChromeState::GetViewToggleCommandId(XCUIShellViewToggleId::LegacyHostDemoWindow),
XCUIShellChromeCommandIds::ToggleLegacyHostDemoWindow);
EXPECT_EQ(
XCUIShellChromeState::GetViewToggleCommandId(XCUIShellViewToggleId::NativeBackdrop),
XCUIShellChromeCommandIds::ToggleNativeBackdrop);