mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
test: cover sub-composition audio extraction
This commit is contained in:
@@ -494,6 +494,7 @@ describe("template-wrapped sub-composition media offsets", () => {
|
|||||||
function writeTemplateWrappedProject(
|
function writeTemplateWrappedProject(
|
||||||
hostAttrs: string,
|
hostAttrs: string,
|
||||||
mediaAttrs: string = 'data-start="0" data-duration="4"',
|
mediaAttrs: string = 'data-start="0" data-duration="4"',
|
||||||
|
extraMediaMarkup: string = "",
|
||||||
): {
|
): {
|
||||||
projectDir: string;
|
projectDir: string;
|
||||||
indexPath: string;
|
indexPath: string;
|
||||||
@@ -547,6 +548,7 @@ describe("template-wrapped sub-composition media offsets", () => {
|
|||||||
${mediaAttrs}
|
${mediaAttrs}
|
||||||
data-track-index="0"
|
data-track-index="0"
|
||||||
></video>
|
></video>
|
||||||
|
${extraMediaMarkup}
|
||||||
<script>
|
<script>
|
||||||
window.__timelines = window.__timelines || {};
|
window.__timelines = window.__timelines || {};
|
||||||
window.__timelines["scene"] = { duration: () => 4 };
|
window.__timelines["scene"] = { duration: () => 4 };
|
||||||
@@ -630,6 +632,30 @@ describe("template-wrapped sub-composition media offsets", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("includes explicit audio from template-wrapped sub-compositions", async () => {
|
||||||
|
const { projectDir, indexPath } = writeTemplateWrappedProject(
|
||||||
|
'data-start="5" data-duration="6" data-width="640" data-height="360"',
|
||||||
|
'data-start="1" data-duration="4"',
|
||||||
|
`<audio
|
||||||
|
id="scene-audio"
|
||||||
|
src="../assets/narration.wav"
|
||||||
|
data-start="2"
|
||||||
|
data-duration="3"
|
||||||
|
data-track-index="1"
|
||||||
|
></audio>`,
|
||||||
|
);
|
||||||
|
|
||||||
|
const compiled = await compileForRender(projectDir, indexPath, projectDir);
|
||||||
|
|
||||||
|
expect(compiled.audios).toContainEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
id: "scene-audio",
|
||||||
|
start: 7,
|
||||||
|
end: 10,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it("flattens the sub-composition root onto the host in compiled render HTML", async () => {
|
it("flattens the sub-composition root onto the host in compiled render HTML", async () => {
|
||||||
const { projectDir, indexPath } = writeTemplateWrappedProject(
|
const { projectDir, indexPath } = writeTemplateWrappedProject(
|
||||||
'data-start="20" data-duration="6" data-width="640" data-height="360"',
|
'data-start="20" data-duration="6" data-width="640" data-height="360"',
|
||||||
|
|||||||
Reference in New Issue
Block a user