Add semantic pixel asserts for lighting scenes

This commit is contained in:
2026-04-05 16:46:47 +08:00
parent cda4a57756
commit 54a699aa26
11 changed files with 282 additions and 96 deletions

View File

@@ -17,7 +17,6 @@ TEST(XCUIShellChromeStateTest, DefaultsMatchCurrentShellChromeConfiguration) {
XCUIShellChromeState state = {};
const auto& viewToggles = state.GetViewToggles();
EXPECT_FALSE(viewToggles.legacyHostDemoWindowVisible);
EXPECT_TRUE(viewToggles.nativeBackdropVisible);
EXPECT_TRUE(viewToggles.pulseAccentEnabled);
EXPECT_TRUE(viewToggles.nativeXCUIOverlayVisible);
@@ -118,10 +117,6 @@ TEST(XCUIShellChromeStateTest, HostedPreviewStateSeparatesEnablementFromRequeste
TEST(XCUIShellChromeStateTest, ViewToggleMutatorsOnlyFlipRequestedFlags) {
XCUIShellChromeState state = {};
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));
EXPECT_TRUE(state.GetViewToggle(XCUIShellViewToggleId::NativeBackdrop));
@@ -190,7 +185,7 @@ TEST(XCUIShellChromeStateTest, ViewMenuDescriptorMatchesCurrentApplicationOrderi
const auto menu = state.BuildViewMenuDescriptor();
ASSERT_EQ(menu.label, "View");
ASSERT_EQ(menu.items.size(), 10u);
ASSERT_EQ(menu.items.size(), 9u);
ASSERT_EQ(menu.items[0].kind, XCUIShellMenuItemKind::Command);
EXPECT_EQ(menu.items[0].command.label, "XCUI Demo");
@@ -203,42 +198,37 @@ TEST(XCUIShellChromeStateTest, ViewMenuDescriptorMatchesCurrentApplicationOrderi
EXPECT_EQ(menu.items[1].command.shortcut, "Ctrl+2");
EXPECT_EQ(menu.items[1].command.commandId, XCUIShellChromeCommandIds::ToggleXCUILayoutLabPanel);
ASSERT_EQ(menu.items[2].kind, XCUIShellMenuItemKind::Command);
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::ToggleLegacyHostDemoWindow);
EXPECT_EQ(menu.items[2].kind, XCUIShellMenuItemKind::Separator);
EXPECT_EQ(menu.items[3].kind, XCUIShellMenuItemKind::Separator);
ASSERT_EQ(menu.items[3].kind, XCUIShellMenuItemKind::Command);
EXPECT_EQ(menu.items[3].command.label, "Native Backdrop");
EXPECT_EQ(menu.items[3].command.shortcut, "Ctrl+Shift+B");
EXPECT_EQ(menu.items[3].command.commandId, XCUIShellChromeCommandIds::ToggleNativeBackdrop);
ASSERT_EQ(menu.items[4].kind, XCUIShellMenuItemKind::Command);
EXPECT_EQ(menu.items[4].command.label, "Native Backdrop");
EXPECT_EQ(menu.items[4].command.shortcut, "Ctrl+Shift+B");
EXPECT_EQ(menu.items[4].command.commandId, XCUIShellChromeCommandIds::ToggleNativeBackdrop);
EXPECT_EQ(menu.items[4].command.label, "Pulse Accent");
EXPECT_EQ(menu.items[4].command.shortcut, "Ctrl+Shift+P");
EXPECT_EQ(menu.items[4].command.commandId, XCUIShellChromeCommandIds::TogglePulseAccent);
ASSERT_EQ(menu.items[5].kind, XCUIShellMenuItemKind::Command);
EXPECT_EQ(menu.items[5].command.label, "Pulse Accent");
EXPECT_EQ(menu.items[5].command.shortcut, "Ctrl+Shift+P");
EXPECT_EQ(menu.items[5].command.commandId, XCUIShellChromeCommandIds::TogglePulseAccent);
EXPECT_EQ(menu.items[5].command.label, "Native XCUI Overlay");
EXPECT_EQ(menu.items[5].command.shortcut, "Ctrl+Shift+O");
EXPECT_EQ(menu.items[5].command.commandId, XCUIShellChromeCommandIds::ToggleNativeXCUIOverlay);
ASSERT_EQ(menu.items[6].kind, XCUIShellMenuItemKind::Command);
EXPECT_EQ(menu.items[6].command.label, "Native XCUI Overlay");
EXPECT_EQ(menu.items[6].command.shortcut, "Ctrl+Shift+O");
EXPECT_EQ(menu.items[6].command.commandId, XCUIShellChromeCommandIds::ToggleNativeXCUIOverlay);
EXPECT_EQ(menu.items[6].command.label, "Hosted Preview HUD");
EXPECT_EQ(menu.items[6].command.shortcut, "Ctrl+Shift+H");
EXPECT_EQ(menu.items[6].command.commandId, XCUIShellChromeCommandIds::ToggleHostedPreviewHud);
ASSERT_EQ(menu.items[7].kind, XCUIShellMenuItemKind::Command);
EXPECT_EQ(menu.items[7].command.label, "Hosted Preview HUD");
EXPECT_EQ(menu.items[7].command.shortcut, "Ctrl+Shift+H");
EXPECT_EQ(menu.items[7].command.commandId, XCUIShellChromeCommandIds::ToggleHostedPreviewHud);
EXPECT_EQ(menu.items[7].command.label, "Native Demo Panel Preview");
EXPECT_EQ(menu.items[7].command.shortcut, "Ctrl+Alt+1");
EXPECT_EQ(menu.items[7].command.commandId, XCUIShellChromeCommandIds::ToggleNativeDemoPanelPreview);
ASSERT_EQ(menu.items[8].kind, XCUIShellMenuItemKind::Command);
EXPECT_EQ(menu.items[8].command.label, "Native Demo Panel Preview");
EXPECT_EQ(menu.items[8].command.shortcut, "Ctrl+Alt+1");
EXPECT_EQ(menu.items[8].command.commandId, XCUIShellChromeCommandIds::ToggleNativeDemoPanelPreview);
ASSERT_EQ(menu.items[9].kind, XCUIShellMenuItemKind::Command);
EXPECT_EQ(menu.items[9].command.label, "Native Layout Lab Preview");
EXPECT_EQ(menu.items[9].command.shortcut, "Ctrl+Alt+2");
EXPECT_EQ(menu.items[9].command.commandId, XCUIShellChromeCommandIds::ToggleNativeLayoutLabPreview);
EXPECT_EQ(menu.items[8].command.label, "Native Layout Lab Preview");
EXPECT_EQ(menu.items[8].command.shortcut, "Ctrl+Alt+2");
EXPECT_EQ(menu.items[8].command.commandId, XCUIShellChromeCommandIds::ToggleNativeLayoutLabPreview);
}
TEST(XCUIShellChromeStateTest, ViewMenuDescriptorCheckedStateTracksShellStateChanges) {
@@ -254,9 +244,9 @@ TEST(XCUIShellChromeStateTest, ViewMenuDescriptorCheckedStateTracksShellStateCha
const auto menu = state.BuildViewMenuDescriptor();
EXPECT_FALSE(menu.items[0].command.checked);
EXPECT_FALSE(menu.items[6].command.checked);
EXPECT_FALSE(menu.items[7].command.checked);
EXPECT_FALSE(menu.items[8].command.checked);
EXPECT_TRUE(menu.items[9].command.checked);
EXPECT_TRUE(menu.items[8].command.checked);
}
TEST(XCUIShellChromeStateTest, PanelCommandIdHelpersMatchCurrentShellCommands) {
@@ -275,9 +265,6 @@ TEST(XCUIShellChromeStateTest, PanelCommandIdHelpersMatchCurrentShellCommands) {
}
TEST(XCUIShellChromeStateTest, ViewToggleCommandIdHelpersMatchCurrentShellCommands) {
EXPECT_EQ(
XCUIShellChromeState::GetViewToggleCommandId(XCUIShellViewToggleId::LegacyHostDemoWindow),
XCUIShellChromeCommandIds::ToggleLegacyHostDemoWindow);
EXPECT_EQ(
XCUIShellChromeState::GetViewToggleCommandId(XCUIShellViewToggleId::NativeBackdrop),
XCUIShellChromeCommandIds::ToggleNativeBackdrop);