| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <title>TextTrack.cues</title> | 2 <title>TextTrack.cues</title> |
| 3 <script src=../../../../../resources/testharness.js></script> | 3 <script src=../../../../../resources/testharness.js></script> |
| 4 <script src=../../../../../resources/testharnessreport.js></script> | 4 <script src=../../../../../resources/testharnessreport.js></script> |
| 5 <div id=log></div> | 5 <div id=log></div> |
| 6 <script> | 6 <script> |
| 7 setup(function(){ | 7 setup(function(){ |
| 8 window.video = document.createElement('video'); | 8 window.video = document.createElement('video'); |
| 9 window.t1 = video.addTextTrack('subtitles'); | 9 window.t1 = video.addTextTrack('subtitles'); |
| 10 window.track = document.createElement('track'); | 10 window.track = document.createElement('track'); |
| 11 track['default'] = true; | 11 video.appendChild(track); // queues a task to "honor user preferences...", m
edia element event task source |
| 12 video.appendChild(track); | |
| 13 window.t2 = track.track; | 12 window.t2 = track.track; |
| 14 window.t1_cues = t1.cues | 13 window.t1_cues = t1.cues |
| 15 window.t2_cues = t2.cues | 14 window.t2_cues = t2.cues |
| 16 }); | 15 }); |
| 17 // Skipping this test due to https://www.w3.org/Bugs/Public/show_bug.cgi?id=2006
6, | |
| 18 // tracking uncommenting this when test is fixed with webkit.org/b/104255 | |
| 19 // test(function(){ | |
| 20 // assert_equals(t1.cues, t1_cues, 't1.cues should return same object'); | |
| 21 // assert_equals(t2.cues, t2_cues, 't2.cues should return same object'); | |
| 22 // assert_not_equals(t1.cues, t2.cues, 't1.cues and t2.cues should be differ
ent objects'); | |
| 23 // assert_not_equals(t1.cues, null, 't1.cues should not be null'); | |
| 24 // assert_not_equals(t2.cues, null, 't2.cues should not be null'); | |
| 25 // assert_equals(t1.cues.length, 0, 't1.cues should have length 0'); | |
| 26 // assert_equals(t2.cues.length, 0, 't2.cues should have length 0'); | |
| 27 // }, document.title+', empty list'); | |
| 28 test(function(){ | 16 test(function(){ |
| 29 var c = new TextTrackCue(0, 1, "text"); | 17 assert_equals(t1.cues, t1_cues, 't1.cues should return same object'); |
| 18 assert_not_equals(t1.cues, null, 't1.cues should not be null'); |
| 19 assert_equals(t1.cues.length, 0, 't1.cues should have length 0'); |
| 20 }, document.title+', empty list'); |
| 21 test(function(){ |
| 22 var c = new VTTCue(0, 1, "text"); |
| 30 c.id = "id"; | 23 c.id = "id"; |
| 31 t1.addCue(c); | 24 t1.addCue(c); |
| 32 assert_equals(t1.cues, t1_cues, "t1.cues should return same object"); | 25 assert_equals(t1.cues, t1_cues, "t1.cues should return same object"); |
| 33 assert_equals(t1.cues.length, 1, "t1.cues.length"); | 26 assert_equals(t1.cues.length, 1, "t1.cues.length"); |
| 34 var c2 = new TextTrackCue(1, 2, "text2"); | 27 var c2 = new VTTCue(1, 2, "text2"); |
| 35 c2.id = "id2"; | 28 c2.id = "id2"; |
| 36 t1.addCue(c2); | 29 t1.addCue(c2); |
| 37 assert_equals(t1.cues, t1_cues, "t1.cues should return the same object after
adding a second cue"); | 30 assert_equals(t1.cues, t1_cues, "t1.cues should return the same object after
adding a second cue"); |
| 38 assert_equals(t1.cues.length, 2, "t1.cues.length after adding a second cue")
; | 31 assert_equals(t1.cues.length, 2, "t1.cues.length after adding a second cue")
; |
| 39 assert_equals(t1.cues[0].id, "id"); | 32 assert_equals(t1.cues[0].id, "id"); |
| 40 assert_equals(t1.cues[1].id, "id2"); | 33 assert_equals(t1.cues[1].id, "id2"); |
| 41 }, document.title+', after addCue()'); | 34 }, document.title+', after addCue()'); |
| 42 test(function(){ | 35 test(function(){ |
| 43 t1.mode = 'showing'; | 36 t1.mode = 'showing'; |
| 44 assert_equals(t1.cues, t1_cues, "t1.cues should return the same object after
setting mode to 'showing'"); | 37 assert_equals(t1.cues, t1_cues, "t1.cues should return the same object after
setting mode to 'showing'"); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 62 test(function(){ | 55 test(function(){ |
| 63 t1.mode = 'showing'; | 56 t1.mode = 'showing'; |
| 64 t1.cues[1].startTime = 0; // this should change the text track cue order | 57 t1.cues[1].startTime = 0; // this should change the text track cue order |
| 65 assert_equals(t1.cues[0].id, 'id2'); | 58 assert_equals(t1.cues[0].id, 'id2'); |
| 66 assert_equals(t1.cues[1].id, 'id'); | 59 assert_equals(t1.cues[1].id, 'id'); |
| 67 t1.cues[0].startTime = 0.5; // this should change it back | 60 t1.cues[0].startTime = 0.5; // this should change it back |
| 68 assert_equals(t1.cues[0].id, 'id'); | 61 assert_equals(t1.cues[0].id, 'id'); |
| 69 assert_equals(t1.cues[1].id, 'id2'); | 62 assert_equals(t1.cues[1].id, 'id2'); |
| 70 }, document.title+', changing order'); | 63 }, document.title+', changing order'); |
| 71 </script> | 64 </script> |
| OLD | NEW |