| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Tests the constructor and mutation of VTTRegion.</title> | 2 <title>Tests the constructor and mutation of VTTRegion.</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 <script> | 5 <script> |
| 6 test(function() { | 6 test(function() { |
| 7 var region = new VTTRegion(); | 7 var region = new VTTRegion(); |
| 8 assert_true(region instanceof VTTRegion, "instanceof"); | 8 assert_true(region instanceof VTTRegion, "instanceof"); |
| 9 | 9 |
| 10 assert_equals(region.track, null); | |
| 11 assert_equals(region.scroll, ""); | 10 assert_equals(region.scroll, ""); |
| 12 assert_equals(region.viewportAnchorX, 0); | 11 assert_equals(region.viewportAnchorX, 0); |
| 13 assert_equals(region.viewportAnchorY, 100); | 12 assert_equals(region.viewportAnchorY, 100); |
| 14 assert_equals(region.regionAnchorX, 0); | 13 assert_equals(region.regionAnchorX, 0); |
| 15 assert_equals(region.regionAnchorY, 100); | 14 assert_equals(region.regionAnchorY, 100); |
| 16 assert_equals(region.height, 3); | 15 assert_equals(region.lines, 3); |
| 17 assert_equals(region.width, 100); | 16 assert_equals(region.width, 100); |
| 18 | 17 |
| 19 assert_throws(new SyntaxError, function() { region.scroll = "invalid-scroll-
value"; }); | 18 region.scroll = "invalid-scroll-value"; |
| 20 assert_equals(region.scroll, ""); | 19 assert_equals(region.scroll, ""); |
| 21 | 20 |
| 22 var invalidPercentageValues = [-1, 101]; | 21 var invalidPercentageValues = [-1, 101]; |
| 23 for (var value of invalidPercentageValues) { | 22 for (var value of invalidPercentageValues) { |
| 24 assert_throws("IndexSizeError", function() { region.viewportAnchorX = valu
e; }); | 23 assert_throws("IndexSizeError", function() { region.viewportAnchorX = valu
e; }); |
| 25 assert_equals(region.viewportAnchorX, 0); | 24 assert_equals(region.viewportAnchorX, 0); |
| 26 assert_throws("IndexSizeError", function() { region.viewportAnchorY = valu
e; }); | 25 assert_throws("IndexSizeError", function() { region.viewportAnchorY = valu
e; }); |
| 27 assert_equals(region.viewportAnchorY, 100); | 26 assert_equals(region.viewportAnchorY, 100); |
| 28 assert_throws("IndexSizeError", function() { region.regionAnchorX = value;
}); | 27 assert_throws("IndexSizeError", function() { region.regionAnchorX = value;
}); |
| 29 assert_equals(region.regionAnchorX, 0); | 28 assert_equals(region.regionAnchorX, 0); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 40 assert_throws(new TypeError, function() { region.viewportAnchorY = value;
}); | 39 assert_throws(new TypeError, function() { region.viewportAnchorY = value;
}); |
| 41 assert_equals(region.viewportAnchorY, 100); | 40 assert_equals(region.viewportAnchorY, 100); |
| 42 assert_throws(new TypeError, function() { region.regionAnchorX = value; })
; | 41 assert_throws(new TypeError, function() { region.regionAnchorX = value; })
; |
| 43 assert_equals(region.regionAnchorX, 0); | 42 assert_equals(region.regionAnchorX, 0); |
| 44 assert_throws(new TypeError, function() { region.regionAnchorY = value; })
; | 43 assert_throws(new TypeError, function() { region.regionAnchorY = value; })
; |
| 45 assert_equals(region.regionAnchorY, 100); | 44 assert_equals(region.regionAnchorY, 100); |
| 46 assert_throws(new TypeError, function() { region.width = value; }); | 45 assert_throws(new TypeError, function() { region.width = value; }); |
| 47 assert_equals(region.width, 100); | 46 assert_equals(region.width, 100); |
| 48 } | 47 } |
| 49 | 48 |
| 50 assert_throws("IndexSizeError", function() { region.height = -1; }); | 49 assert_throws("IndexSizeError", function() { region.lines = -1; }); |
| 51 assert_equals(region.height, 3); | 50 assert_equals(region.lines, 3); |
| 52 | 51 |
| 53 region.height = 130; | 52 region.lines = 130; |
| 54 assert_equals(region.height, 130); | 53 assert_equals(region.lines, 130); |
| 55 region.viewportAnchorX = 64; | 54 region.viewportAnchorX = 64; |
| 56 assert_equals(region.viewportAnchorX, 64); | 55 assert_equals(region.viewportAnchorX, 64); |
| 57 region.viewportAnchorY = 32; | 56 region.viewportAnchorY = 32; |
| 58 assert_equals(region.viewportAnchorY, 32); | 57 assert_equals(region.viewportAnchorY, 32); |
| 59 region.regionAnchorX = 16; | 58 region.regionAnchorX = 16; |
| 60 assert_equals(region.regionAnchorX, 16); | 59 assert_equals(region.regionAnchorX, 16); |
| 61 region.regionAnchorY = 8; | 60 region.regionAnchorY = 8; |
| 62 assert_equals(region.regionAnchorY, 8); | 61 assert_equals(region.regionAnchorY, 8); |
| 63 region.width = 42; | 62 region.width = 42; |
| 64 assert_equals(region.width, 42); | 63 assert_equals(region.width, 42); |
| 65 }); | 64 }); |
| 66 </script> | 65 </script> |
| OLD | NEW |