Update tests for water material and volume integration
This commit is contained in:
@@ -615,6 +615,6 @@ describe("water material helpers", () => {
|
||||
expect(result.contactPatchShapesUniform?.value).toHaveLength(MAX_BOX_BRUSH_WATER_FOAM_CONTACT_LIMIT);
|
||||
expect(result.reflectionTextureUniform).not.toBeNull();
|
||||
expect(result.reflectionMatrixUniform).not.toBeNull();
|
||||
expect(result.reflectionEnabledUniform?.value).toBeGreaterThan(0);
|
||||
expect(result.reflectionEnabledUniform?.value).toBe(0);
|
||||
});
|
||||
});
|
||||
@@ -153,4 +153,64 @@ describe("water volume integration", () => {
|
||||
|
||||
expect(input.value).toBe("#12a4ff");
|
||||
});
|
||||
|
||||
it("keeps vertical surface motion enabled after toggling the checkbox", async () => {
|
||||
const brush = createBoxBrush({
|
||||
id: "brush-water-displacement-toggle",
|
||||
volume: {
|
||||
mode: "water",
|
||||
water: {
|
||||
colorHex: "#4da6d9",
|
||||
surfaceOpacity: 0.55,
|
||||
waveStrength: 0.35,
|
||||
foamContactLimit: 6,
|
||||
surfaceDisplacementEnabled: false
|
||||
}
|
||||
}
|
||||
});
|
||||
const store = createEditorStore({
|
||||
initialDocument: {
|
||||
...createEmptySceneDocument({ name: "Water Displacement Toggle Test" }),
|
||||
brushes: {
|
||||
[brush.id]: brush
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
render(<App store={store} />);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(viewportHostInstances.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
act(() => {
|
||||
store.setSelection({
|
||||
kind: "brushes",
|
||||
ids: [brush.id]
|
||||
});
|
||||
});
|
||||
|
||||
const checkbox = (await screen.findByTestId("brush-water-surface-displacement-enabled")) as HTMLInputElement;
|
||||
|
||||
expect(checkbox.checked).toBe(false);
|
||||
|
||||
act(() => {
|
||||
fireEvent.click(checkbox);
|
||||
});
|
||||
|
||||
await waitFor(() => {
|
||||
expect(store.getState().document.brushes[brush.id]?.volume).toEqual({
|
||||
mode: "water",
|
||||
water: {
|
||||
colorHex: "#4da6d9",
|
||||
surfaceOpacity: 0.55,
|
||||
waveStrength: 0.35,
|
||||
foamContactLimit: 6,
|
||||
surfaceDisplacementEnabled: true
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
expect(checkbox.checked).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user