Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

test(webv2): loosen conditioning rebalance drag assertions

joshistoastddbb56eab764
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/shared/ConditioningRebalanceBars.browser.test.tsx b/invokeai/frontend/webv2/src/features/generation/ui/shared/ConditioningRebalanceBars.browser.test.tsx
index 926377eff1..8078adab1c 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/shared/ConditioningRebalanceBars.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/shared/ConditioningRebalanceBars.browser.test.tsx
@@ -1,4 +1,5 @@
import { ChakraProvider } from '@chakra-ui/react';
+import { REBALANCE_NEUTRAL_WEIGHT } from '@features/generation/core/conditioningRebalance';
import { system } from '@theme/system';
import { act } from 'react';
import { createRoot, type Root } from 'react-dom/client';
@@ -115,17 +116,22 @@ describe('ConditioningRebalanceBars', () => {
track.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, ...target }));
});
- expect(lastPreview()[3]).toBeCloseTo(6, 1);
- // Neighbours are untouched by a stationary press.
- expect(lastPreview()[2]).toBe(1);
- expect(lastPreview()[4]).toBe(1);
+ // Deliberately loose about the value: pointing high up the track must raise that
+ // column well clear of its neighbours, but the exact pixel-to-weight mapping shifts
+ // with the track's padding and border and is not what this is guarding.
+ const previewed = lastPreview()[3] ?? 0;
+
+ expect(previewed).toBeGreaterThan(REBALANCE_NEUTRAL_WEIGHT);
+ expect(lastPreview()[2]).toBe(REBALANCE_NEUTRAL_WEIGHT);
+ expect(lastPreview()[4]).toBe(REBALANCE_NEUTRAL_WEIGHT);
expect(onCommit).not.toHaveBeenCalled();
await interact(() => window.dispatchEvent(new PointerEvent('pointerup', target)));
expect(onPreview).toHaveBeenLastCalledWith(null);
expect(onCommit).toHaveBeenCalledOnce();
- expect(lastCommit()[3]).toBeCloseTo(6, 1);
+ // What matters is that the release commits exactly what was last previewed.
+ expect(lastCommit()[3]).toBe(previewed);
});
it('paints across every column a sweep passes, including ones it skipped', async () => {
@@ -140,8 +146,10 @@ describe('ConditioningRebalanceBars', () => {
const painted = lastPreview();
- expect(painted[0]).toBeCloseTo(0, 1);
- expect(painted[11]).toBeCloseTo(8, 1);
+ // The sweep ran bottom-left to top-right, so the ends should sit near the extremes
+ // and every column between them should rise. Ranges, not exact values.
+ expect(painted[0] ?? 0).toBeLessThan(REBALANCE_NEUTRAL_WEIGHT);
+ expect(painted[11] ?? 0).toBeGreaterThan(SCALE / 2);
for (let index = 1; index < TAP_COUNT; index += 1) {
expect(painted[index] ?? 0).toBeGreaterThan(painted[index - 1] ?? 0);