@@ -45,6 +45,8 @@ class ButtonsSharedStageFixture : public LayerEditorTestFixture
4545
4646// Shared stage backed by a real file: root layer is non-anonymous and initially
4747// clean, so the Save button starts disabled and only enables when dirty.
48+ // Not compiled for the old editor: switchToCustomStage is new-editor-only API.
49+ #ifndef MAYAUSD_OLD_LAYER_EDITOR
4850class SaveStageCleanNonAnonFixture : public LayerEditorTestFixture
4951{
5052protected:
@@ -69,6 +71,7 @@ class SaveStageCleanNonAnonFixture : public LayerEditorTestFixture
6971 QFile::remove (_stagePath);
7072 }
7173};
74+ #endif
7275
7376// Clicking "Add a New Layer" with nothing selected inserts an anonymous sublayer at the root.
7477TEST_F (LayerEditorTestFixture, NewLayerButton_Click_CallsAddAnonymousSubLayer)
@@ -81,10 +84,9 @@ TEST_F(LayerEditorTestFixture, NewLayerButton_Click_CallsAddAnonymousSubLayer)
8184 btn->click ();
8285 QApplication::processEvents ();
8386
84- ASSERT_TRUE (_sessionState._commandHookImpl .hasCall (" addAnonymousSubLayer" ))
85- << " addAnonymousSubLayer should have been called" ;
86- EXPECT_EQ (_sessionState._commandHookImpl .lastCall ().args [0 ],
87- _sessionState.stage ()->GetRootLayer ()->GetIdentifier ())
87+ const auto * call = _sessionState._commandHookImpl .lastCallOf (" addAnonymousSubLayer" );
88+ ASSERT_NE (call, nullptr ) << " addAnonymousSubLayer should have been called" ;
89+ EXPECT_EQ (call->args [0 ], _sessionState.stage ()->GetRootLayer ()->GetIdentifier ())
8890 << " addAnonymousSubLayer should target the root layer when nothing is selected" ;
8991}
9092
@@ -173,10 +175,9 @@ TEST_F(LayerEditorTestFixture, NewLayerButton_Click_NoSelection_AddsToRoot)
173175 btn->click ();
174176 QApplication::processEvents ();
175177
176- ASSERT_TRUE (_sessionState._commandHookImpl .hasCall (" addAnonymousSubLayer" ))
177- << " addAnonymousSubLayer should be called on root layer when nothing is selected" ;
178- EXPECT_EQ (_sessionState._commandHookImpl .lastCall ().args [0 ],
179- _sessionState.stage ()->GetRootLayer ()->GetIdentifier ())
178+ const auto * call = _sessionState._commandHookImpl .lastCallOf (" addAnonymousSubLayer" );
179+ ASSERT_NE (call, nullptr ) << " addAnonymousSubLayer should be called on root layer when nothing is selected" ;
180+ EXPECT_EQ (call->args [0 ], _sessionState.stage ()->GetRootLayer ()->GetIdentifier ())
180181 << " parent should be the root layer when there is no selection" ;
181182}
182183
@@ -264,11 +265,10 @@ TEST_F(LayerEditorTestFixture, NewLayerButton_Click_WithSublayerSelectionAddsSib
264265 btn->click ();
265266 QApplication::processEvents ();
266267
267- ASSERT_TRUE (_sessionState._commandHookImpl .hasCall (" addAnonymousSubLayer" ))
268- << " addAnonymousSubLayer should be called on the parent when adding a sibling" ;
269268 // Adding a sibling means inserting into the selected layer's parent (root).
270- EXPECT_EQ (_sessionState._commandHookImpl .lastCall ().args [0 ],
271- _sessionState.stage ()->GetRootLayer ()->GetIdentifier ())
269+ const auto * call = _sessionState._commandHookImpl .lastCallOf (" addAnonymousSubLayer" );
270+ ASSERT_NE (call, nullptr ) << " addAnonymousSubLayer should be called on the parent when adding a sibling" ;
271+ EXPECT_EQ (call->args [0 ], _sessionState.stage ()->GetRootLayer ()->GetIdentifier ())
272272 << " parent should be the root layer when a direct sublayer of root is selected" ;
273273}
274274
@@ -284,6 +284,7 @@ TEST_F(LayerEditorTestFixture, ToolbarButtons_HaveObjectNames)
284284// With a file-backed (non-anonymous), clean stage the Save button starts disabled.
285285// Making the stage dirty must enable it — the transition proves the button actually
286286// tracks needsSaving() rather than being permanently enabled by isAnonymous().
287+ #ifndef MAYAUSD_OLD_LAYER_EDITOR
287288TEST_F (SaveStageCleanNonAnonFixture, SaveStageButton_DisabledInitially_EnabledWhenDirty)
288289{
289290 QPushButton* btn = TestUtils::findButtonByTooltip (_widget, " Save all edits in the Layer Stack" );
@@ -298,6 +299,7 @@ TEST_F(SaveStageCleanNonAnonFixture, SaveStageButton_DisabledInitially_EnabledWh
298299
299300 EXPECT_TRUE (btn->isEnabled ()) << " Save Stage button should be enabled after stage becomes dirty" ;
300301}
302+ #endif
301303
302304// ── New Layer button: disabled → enabled transition ───────────────────────────
303305
0 commit comments