OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src=../media-file.js></script> |
| 3 <script src=../video-test.js></script> |
| 4 <script src=../media-controls.js></script> |
| 5 <style> |
| 6 /* Author settings for the cues */ |
| 7 video::cue(c) { |
| 8 color: red; |
| 9 background-color: green; |
| 10 text-shadow: 3px 3px #00ff00; |
| 11 font-size: 20px; |
| 12 font-family: arial; |
| 13 font-style: normal; |
| 14 font-variant: normal; |
| 15 } |
| 16 </style> |
| 17 <script> |
| 18 |
| 19 function applyUserOverrideSettings() { |
| 20 if (window.internals) { |
| 21 internals.settings.setTextTrackTextColor("cyan"); |
| 22 internals.settings.setTextTrackBackgroundColor("green"); |
| 23 internals.settings.setTextTrackTextShadow("2px 2px #ff0000") |
| 24 internals.settings.setTextTrackTextSize("14px"); |
| 25 internals.settings.setTextTrackFontFamily("fantasy"); |
| 26 internals.settings.setTextTrackFontStyle("italic"); |
| 27 internals.settings.setTextTrackFontVariant("small-caps"); |
| 28 } |
| 29 } |
| 30 |
| 31 function verifyAuthorSettings() { |
| 32 consoleWrite(""); |
| 33 cue = textTrackDisplayElement(video, 'cue').firstElementChild; |
| 34 testExpected("getComputedStyle(cue).color", "rgb(255, 0, 0)"); |
| 35 testExpected("getComputedStyle(cue).backgroundColor", "rgb(0, 128, 0)"); |
| 36 testExpected("getComputedStyle(cue).textShadow", "rgb(0, 255, 0) 3px 3px
0px"); |
| 37 testExpected("getComputedStyle(cue).fontSize", "20px"); |
| 38 testExpected("getComputedStyle(cue).fontFamily", "arial"); |
| 39 testExpected("getComputedStyle(cue).fontStyle", "normal"); |
| 40 testExpected("getComputedStyle(cue).fontVariant", "normal"); |
| 41 // Apply user settings and verify they override author-specified setting
s |
| 42 applyUserOverrideSettings(); |
| 43 run("video.currentTime = 0.3"); |
| 44 verifyUserOverrideSettings(); |
| 45 } |
| 46 |
| 47 function verifyUserOverrideSettings() { |
| 48 consoleWrite(""); |
| 49 cue = textTrackDisplayElement(video, 'cue').firstElementChild; |
| 50 testExpected("getComputedStyle(cue).color", "rgb(0, 255, 255)"); |
| 51 testExpected("getComputedStyle(cue).backgroundColor", "rgb(0, 128, 0)"); |
| 52 testExpected("getComputedStyle(cue).textShadow", "rgb(255, 0, 0) 2px 2px
0px"); |
| 53 testExpected("getComputedStyle(cue).fontSize", "14px"); |
| 54 testExpected("getComputedStyle(cue).fontFamily", "fantasy"); |
| 55 testExpected("getComputedStyle(cue).fontStyle", "italic"); |
| 56 testExpected("getComputedStyle(cue).fontVariant", "small-caps"); |
| 57 endTest(); |
| 58 } |
| 59 |
| 60 window.onload = function() { |
| 61 consoleWrite("Test that WebVTT objects are being styled correctly based
on user settings that should override author settings."); |
| 62 findMediaElement(); |
| 63 video.src = findMediaFile('video', '../content/test'); |
| 64 video.currentTime = 0.1; |
| 65 waitForEvent('canplaythrough', verifyAuthorSettings); |
| 66 } |
| 67 |
| 68 </script> |
| 69 <video> |
| 70 <track src="captions-webvtt/styling.vtt" kind="captions" default> |
| 71 </video> |
OLD | NEW |