blob: 9a21144ffe4b90746eadab456ce466188e0b5d76 [file] [log] [blame]
commit-queue@webkit.org33f1bc52019-05-14 15:13:50 +00001<!DOCTYPE html><!-- webkit-test-runner [ additionalSupportedImageTypes=public.heic;public.heics ] -->
2<html>
3<head>
4<script src="../../resources/js-test-pre.js"></script>
5</head>
6<body>
7 <img id="image1" src="">
8 <img id="image2" src="">
9 <script>
10 function loadImage(image, src) {
11 return new Promise((resolve) => {
12 image.onload = (() => {
13 debug("The image " + src + " was loaded successfully.");
14 resolve();
15 });
16 image.src = src;
17 });
18 }
19
20 function verifyProperties()
21 {
22 if (!window.internals)
23 return;
24
25 debug("");
26 shouldBe("internals.imageFrameCount(image1)", "96");
27 shouldBe("Math.round(internals.imageFrameDurationAtIndex(image1, 0) * 1000)", "100");
28 shouldBe("Math.round(internals.imageFrameDurationAtIndex(image1, 48) * 1000)", "100");
29 shouldBe("Math.round(internals.imageFrameDurationAtIndex(image1, 95) * 1000)", "100");
30
31 debug("");
32 shouldBe("internals.imageFrameCount(image2)", "120");
33 shouldBe("Math.round(internals.imageFrameDurationAtIndex(image2, 0) * 1000)", "40");
34 shouldBe("Math.round(internals.imageFrameDurationAtIndex(image2, 60) * 1000)", "40");
35 shouldBe("Math.round(internals.imageFrameDurationAtIndex(image2, 119) * 1000)", "40");
36 }
37
38 (function() {
39 window.jsTestIsAsync = true;
40
41 description("Verify HEICS image properties can be retrieved.");
42
43 var promises = [];
44
45 promises.push(loadImage(image1, "resources/sticker.heics"));
46 promises.push(loadImage(image2, "resources/sea_animation.heics"));
47
48 Promise.all(promises).then(() => {
49 verifyProperties();
50 finishJSTest();
51 });
52 })();
53 </script>
54 <script src="../../resources/js-test-post.js"></script>
55</body>
56</html>