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 video::cue { |
| 7 color: lime; |
| 8 background-color: yellow; |
| 9 text-shadow: 4px 4px #ff0000; |
| 10 font-size: 10px; |
| 11 font-family: serif; |
| 12 font-style: normal; |
| 13 font-variant: normal; |
| 14 } |
| 15 </style> |
| 16 <script> |
| 17 |
| 18 function initUserSettings() { |
| 19 if (window.internals) { |
| 20 internals.settings.setTextTrackTextColor("cyan"); |
| 21 internals.settings.setTextTrackBackgroundColor("green"); |
| 22 internals.settings.setTextTrackTextShadow("2px 2px #ff0000") |
| 23 internals.settings.setTextTrackTextSize("14px"); |
| 24 internals.settings.setTextTrackFontFamily("fantasy"); |
| 25 internals.settings.setTextTrackFontStyle("italic"); |
| 26 internals.settings.setTextTrackFontVariant("small-caps"); |
| 27 } |
| 28 } |
| 29 |
| 30 function resetUserSettings() { |
| 31 if (window.internals) { |
| 32 internals.settings.setTextTrackTextColor(""); |
| 33 internals.settings.setTextTrackBackgroundColor(""); |
| 34 internals.settings.setTextTrackTextShadow("") |
| 35 internals.settings.setTextTrackTextSize(""); |
| 36 internals.settings.setTextTrackFontFamily(""); |
| 37 internals.settings.setTextTrackFontStyle(""); |
| 38 internals.settings.setTextTrackFontVariant(""); |
| 39 } |
| 40 } |
| 41 |
| 42 function checkExpected() { |
| 43 cue = textTrackDisplayElement(video, 'cue'); |
| 44 testExpected("getComputedStyle(cue).color", "rgb(0, 255, 0)"); |
| 45 testExpected("getComputedStyle(cue).backgroundColor", "rgb(255, 255, 0)"
); |
| 46 testExpected("getComputedStyle(cue).textShadow", "rgb(255, 0, 0) 4px 4px
0px"); |
| 47 testExpected("getComputedStyle(cue).fontSize", "10px"); |
| 48 testExpected("getComputedStyle(cue).fontFamily", "serif"); |
| 49 testExpected("getComputedStyle(cue).fontStyle", "normal"); |
| 50 testExpected("getComputedStyle(cue).fontVariant", "normal"); |
| 51 endTest(); |
| 52 } |
| 53 |
| 54 window.onload = function() { |
| 55 initUserSettings(); |
| 56 // reset should make the text tracks use the settings specified in the s
tylesheet |
| 57 resetUserSettings(); |
| 58 consoleWrite("Test that WebVTT objects user override styles when reset,
refer to css specified styles."); |
| 59 findMediaElement(); |
| 60 video.src = findMediaFile('video', '../content/test'); |
| 61 waitForEvent('canplaythrough', checkExpected); |
| 62 } |
| 63 |
| 64 </script> |
| 65 <video> |
| 66 <track src="captions-webvtt/styling.vtt" kind="captions" default> |
| 67 </video> |
OLD | NEW |