Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
test(editor): verify audio track live drafts are cleared on reset
EtienneLescot17b95904af9c
diff --git a/src/components/ai-edition/RightPanes.audioTrack.test.tsx b/src/components/ai-edition/RightPanes.audioTrack.test.tsxindex 214133a74..bcc534366 100644--- a/src/components/ai-edition/RightPanes.audioTrack.test.tsx+++ b/src/components/ai-edition/RightPanes.audioTrack.test.tsx@@ -55,12 +55,25 @@ describe("AudioTrackPane reset button", () => {updateAudioTrack,} as unknown as TimelineApi;- render(+ const { rerender } = render(<I18nProvider><AudioTrackPane tl={tl} /></I18nProvider>,);+ const gainSlider = screen.getByRole("slider", { name: "Output level" });+ const fadeInSlider = screen.getByRole("slider", { name: "Fade in" });+ const fadeOutSlider = screen.getByRole("slider", { name: "Fade out" });++ // Draft in-progress slider changes without committing+ fireEvent.change(gainSlider, { target: { value: "3" } });+ fireEvent.change(fadeInSlider, { target: { value: "1500" } });+ fireEvent.change(fadeOutSlider, { target: { value: "2000" } });++ expect(gainSlider).toHaveValue("3");+ expect(fadeInSlider).toHaveValue("1500");+ expect(fadeOutSlider).toHaveValue("2000");+const resetBtn = screen.getByRole("button", { name: /reset/i });fireEvent.click(resetBtn);@@ -72,6 +85,30 @@ describe("AudioTrackPane reset button", () => {muted: false,loop: false,});++ // Draft values are cleared; inputs no longer display the drafted values+ expect(gainSlider).not.toHaveValue("3");+ expect(fadeInSlider).not.toHaveValue("1500");+ expect(fadeOutSlider).not.toHaveValue("2000");++ // When re-rendered with the reset track state, sliders show zeroed defaults+ const resetTrack: AxcutAudioTrack = {+ ...mockTrack,+ gainDb: 0,+ fadeInMs: 0,+ fadeOutMs: 0,+ muted: false,+ loop: false,+ };+ rerender(+ <I18nProvider>+ <AudioTrackPane tl={{ ...tl, audioTracks: [resetTrack] } as unknown as TimelineApi} />+ </I18nProvider>,+ );++ expect(gainSlider).toHaveValue("0");+ expect(fadeInSlider).toHaveValue("0");+ expect(fadeOutSlider).toHaveValue("0");});it("resets all track parameters under French locale", () => {@@ -111,12 +148,24 @@ describe("AudioTrackPane reset button", () => {updateAudioTrack,} as unknown as TimelineApi;- render(+ const { rerender } = render(<I18nProvider><AudioTrackPane tl={tl} /></I18nProvider>,);+ const gainSlider = screen.getByRole("slider", { name: /niveau de sortie/i });+ const fadeInSlider = screen.getByRole("slider", { name: /fondu d['’]entrée/i });+ const fadeOutSlider = screen.getByRole("slider", { name: /fondu de sortie/i });++ fireEvent.change(gainSlider, { target: { value: "-12" } });+ fireEvent.change(fadeInSlider, { target: { value: "800" } });+ fireEvent.change(fadeOutSlider, { target: { value: "1200" } });++ expect(gainSlider).toHaveValue("-12");+ expect(fadeInSlider).toHaveValue("800");+ expect(fadeOutSlider).toHaveValue("1200");+// French label: "Réinitialiser l’audio"const resetBtn = screen.getByRole("button", { name: /réinitialiser l’audio/i });fireEvent.click(resetBtn);@@ -129,5 +178,27 @@ describe("AudioTrackPane reset button", () => {muted: false,loop: false,});++ expect(gainSlider).not.toHaveValue("-12");+ expect(fadeInSlider).not.toHaveValue("800");+ expect(fadeOutSlider).not.toHaveValue("1200");++ const resetTrack: AxcutAudioTrack = {+ ...mockTrack,+ gainDb: 0,+ fadeInMs: 0,+ fadeOutMs: 0,+ muted: false,+ loop: false,+ };+ rerender(+ <I18nProvider>+ <AudioTrackPane tl={{ ...tl, audioTracks: [resetTrack] } as unknown as TimelineApi} />+ </I18nProvider>,+ );++ expect(gainSlider).toHaveValue("0");+ expect(fadeInSlider).toHaveValue("0");+ expect(fadeOutSlider).toHaveValue("0");});});diff --git a/src/components/ai-edition/RightPanes.tsx b/src/components/ai-edition/RightPanes.tsxindex 0ed6c1a52..cb80a15d2 100644--- a/src/components/ai-edition/RightPanes.tsx+++ b/src/components/ai-edition/RightPanes.tsx@@ -3039,6 +3039,13 @@ type TimelineApi = ReturnType<typeof useTimeline>;// anyway (`resolveFadeSecs` reduces one that does not fit).const FADE_MAX_MS = 5000;+/**+ * Per-track controls for the selected imported audio track (issue #350). Shown by+ * the inspector in place of the facet when an audio track is selected (see+ * FloatingInspector). The header is the generic "Audio track"; the body leads+ * with the file name, then the volume, fade in/out, mute, and loop controls,+ * with actions to reset all parameters or delete the track.+ */export function AudioTrackPane({ tl }: { tl: TimelineApi }) {const ts = useScopedT("settings");const trackId = tl.selectedAudioTrackId;