Skip to content

Commit 26e4f18

Browse files
bghgaryCopilot
andcommitted
Trim UpdateDevice throw-test to the throw contract
The post-Disable frame + GetPlatformInfo assertion was demonstrating the canonical UpdateDevice usage sequence, which is what TEST(Device, UpdateDevice) in BabylonJS#1687 does. The throw-test should focus on the throw contract only: - permitted pre-init - throws after EnableRendering - permitted again after DisableRendering [Created by Copilot on behalf of @bghgary] Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 5e25e2d commit 26e4f18

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

Apps/UnitTests/Source/Tests.Device.D3D11.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,26 +124,19 @@ TEST(Device, UpdateDeviceThrowsWhenRenderingEnabled)
124124

125125
Babylon::Graphics::Device device{config};
126126

127-
// Before EnableRendering: UpdateDevice should be permitted (init state has not been consumed
128-
// yet). This pattern is used by callers who deferred their device choice.
127+
// Pre-EnableRendering: UpdateDevice is permitted (init state has not been consumed yet).
128+
// This pattern is used by callers who deferred their device choice.
129129
EXPECT_NO_THROW(device.UpdateDevice(deviceA.get()));
130130

131-
// After EnableRendering (driven by StartRenderingCurrentFrame): UpdateDevice must throw.
131+
// After EnableRendering (driven by StartRenderingCurrentFrame): UpdateDevice throws.
132132
device.StartRenderingCurrentFrame();
133133
EXPECT_THROW(device.UpdateDevice(deviceB.get()), std::runtime_error);
134134
device.FinishRenderingCurrentFrame();
135135

136-
// Still initialized after the frame -- still throws.
136+
// Still initialized between frames -- still throws.
137137
EXPECT_THROW(device.UpdateDevice(deviceB.get()), std::runtime_error);
138138

139-
// After DisableRendering, UpdateDevice is permitted again. The next frame picks up the new device.
139+
// After DisableRendering: UpdateDevice is permitted again.
140140
device.DisableRendering();
141141
EXPECT_NO_THROW(device.UpdateDevice(deviceB.get()));
142-
143-
RenderTargetTexture rttB{CreateTestRenderTargetTexture(deviceB.get(), dimensions.cx, dimensions.cy)};
144-
device.UpdateBackBuffer(rttB.View.get());
145-
device.StartRenderingCurrentFrame();
146-
device.FinishRenderingCurrentFrame();
147-
148-
EXPECT_EQ(device.GetPlatformInfo().Device, deviceB.get());
149142
}

0 commit comments

Comments
 (0)