From 96631783ef1acee68826d06e55c0dd1071e5376e Mon Sep 17 00:00:00 2001 From: WoodNeck Date: Tue, 19 Jan 2021 16:17:20 +0900 Subject: [PATCH] test: add test that video is keep updated by default --- package-lock.json | 2 +- .../PanoImageRenderer.spec.js | 30 ++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2f1df1f7b..fb0d302f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@egjs/view360", - "version": "3.4.2", + "version": "3.4.2-snapshot", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/test/unit/PanoImageRenderer/PanoImageRenderer.spec.js b/test/unit/PanoImageRenderer/PanoImageRenderer.spec.js index ca82a4488..f2b367311 100644 --- a/test/unit/PanoImageRenderer/PanoImageRenderer.spec.js +++ b/test/unit/PanoImageRenderer/PanoImageRenderer.spec.js @@ -1020,7 +1020,35 @@ describe("PanoImageRenderer", () => { expect(isDrawCalled).to.be.equal(false); done(); }); - }); + }); + + IT("should update video texture by default", async () => { + // Given + const thresholdMargin = 4; // Some test cases are fail on TRAVIS CI. So make it margin. + const srcVideo = document.createElement("video"); + + srcVideo.src = "./images/PanoViewer/pano.mp4"; + srcVideo.muted = true; + const inst = createPanoImageRenderer(srcVideo, true, "equirectangular"); + + await isVideoLoaded(srcVideo); + await inst.bindTexture(); + + // When + srcVideo.currentTime = 1; + + // Video frame is updated very slowly on CI Evironment(Ubuntu 14). So apply moderately large timeout. + await TestHelper.wait(1000); + + // Then + /** + * following image is not exactly captured on 1 sec. It's 'about' time. + * It is captured on this test case after following render test. + */ + await renderAndCompareSequentially( + inst, [[0, 0, 65, `./images/PanoViewer/pano_1sec_0_0_65${suffix}`, threshold + thresholdMargin]] + ); + }); IT("should not update video texture when keepUpdate(false) although it is playing", async () => { // Given