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 <script> |
| 6 |
| 7 function applyUserOverrideSettings() { |
| 8 if (window.internals) { |
| 9 internals.settings.setTextTrackTextColor("purple"); |
| 10 internals.settings.setTextTrackTextSize("14px"); |
| 11 } |
| 12 } |
| 13 |
| 14 function verifyDefaultSettings() { |
| 15 consoleWrite(""); |
| 16 cue = textTrackDisplayElement(video, 'cue'); |
| 17 // These are the expected default cue settings per spec |
| 18 // http://dev.w3.org/html5/webvtt/#applying-css-properties-to-webvtt-nod
e-objects |
| 19 testExpected("getComputedStyle(cue).color", "rgb(255, 255, 255)"); |
| 20 testExpected("getComputedStyle(cue).backgroundColor", "rgba(0, 0, 0, 0.8
)"); |
| 21 testExpected("getComputedStyle(cue).fontFamily", "sans-serif"); |
| 22 // Apply user settings for color and font-size and verify that the other
internal settings are retained. |
| 23 applyUserOverrideSettings(); |
| 24 run("video.currentTime = 0.3"); |
| 25 checkExpected(); |
| 26 } |
| 27 |
| 28 function checkExpected() { |
| 29 consoleWrite(""); |
| 30 cue = textTrackDisplayElement(video, 'cue'); |
| 31 testExpected("getComputedStyle(cue).color", "rgb(128, 0, 128)"); |
| 32 testExpected("getComputedStyle(cue).fontSize", "14px"); |
| 33 // When there is no user setting specified for background-color and font
-family, the internal settings are applied. |
| 34 testExpected("getComputedStyle(cue).backgroundColor", "rgba(0, 0, 0, 0.8
)"); |
| 35 testExpected("getComputedStyle(cue).fontFamily", "sans-serif"); |
| 36 endTest(); |
| 37 } |
| 38 |
| 39 window.onload = function() { |
| 40 consoleWrite("Test that WebVTT objects are being styled correctly based
on user settings that should override default settings."); |
| 41 findMediaElement(); |
| 42 video.src = findMediaFile('video', '../content/test'); |
| 43 video.currentTime = 0.1; |
| 44 waitForEvent('canplaythrough', verifyDefaultSettings); |
| 45 } |
| 46 |
| 47 </script> |
| 48 <video> |
| 49 <track src="captions-webvtt/styling.vtt" kind="captions" default> |
| 50 </video> |
OLD | NEW |