summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webvtt/api/VTTCue
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
commit0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/webvtt/api/VTTCue
parentInitial commit. (diff)
downloadfirefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz
firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/webvtt/api/VTTCue')
-rw-r--r--testing/web-platform/tests/webvtt/api/VTTCue/align.html67
-rw-r--r--testing/web-platform/tests/webvtt/api/VTTCue/categories.json3
-rw-r--r--testing/web-platform/tests/webvtt/api/VTTCue/common.js8
-rw-r--r--testing/web-platform/tests/webvtt/api/VTTCue/constructor-exceptions.html25
-rw-r--r--testing/web-platform/tests/webvtt/api/VTTCue/constructor.html56
-rw-r--r--testing/web-platform/tests/webvtt/api/VTTCue/getCueAsHTML.html93
-rw-r--r--testing/web-platform/tests/webvtt/api/VTTCue/line.html65
-rw-r--r--testing/web-platform/tests/webvtt/api/VTTCue/lineAlign.html39
-rw-r--r--testing/web-platform/tests/webvtt/api/VTTCue/position.html32
-rw-r--r--testing/web-platform/tests/webvtt/api/VTTCue/positionAlign.html23
-rw-r--r--testing/web-platform/tests/webvtt/api/VTTCue/region.html38
-rw-r--r--testing/web-platform/tests/webvtt/api/VTTCue/size.html26
-rw-r--r--testing/web-platform/tests/webvtt/api/VTTCue/snapToLines.html100
-rw-r--r--testing/web-platform/tests/webvtt/api/VTTCue/text.html41
-rw-r--r--testing/web-platform/tests/webvtt/api/VTTCue/vertical.html57
15 files changed, 673 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webvtt/api/VTTCue/align.html b/testing/web-platform/tests/webvtt/api/VTTCue/align.html
new file mode 100644
index 0000000000..e3a920ae94
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/api/VTTCue/align.html
@@ -0,0 +1,67 @@
+<!doctype html>
+<title>VTTCue.align</title>
+<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-align">
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=common.js></script>
+<div id=log></div>
+<script>
+test(function(){
+ var video = document.createElement('video');
+ document.body.appendChild(video);
+
+ var cue = new VTTCue(0, 1, 'text');
+ assert_true('align' in cue, 'align is not supported');
+ assert_equals(cue.align, 'center');
+
+ var track = document.createElement('track');
+ var t = track.track;
+ t.addCue(cue);
+
+ assert_equals(cue.align, 'center');
+
+ video.appendChild(track);
+ assert_equals(cue.align, 'center');
+
+ t.mode = 'showing';
+ assert_equals(cue.align, 'center');
+
+ cue.align = 'start';
+ assert_equals(cue.align, 'start');
+
+ cue.align = 'end';
+ assert_equals(cue.align, 'end');
+
+ ['start\u0000', 'centre', 'middle'].forEach(function(invalid) {
+ cue.align = invalid;
+ assert_equals(cue.align, 'end');
+ });
+}, document.title+', script-created cue');
+
+var t_parsed = async_test(document.title+', parsed cue');
+t_parsed.step(function(){
+ var video = document.createElement('video');
+ document.body.appendChild(video);
+ var t = document.createElement('track');
+ t.onload = this.step_func(function(){
+ var c1 = t.track.cues[0];
+ var c2 = t.track.cues[1];
+ var c3 = t.track.cues[2];
+ var c4 = t.track.cues[3];
+ assert_equals(c1.align, 'center');
+ assert_equals(c2.align, 'start');
+ assert_equals(c3.align, 'center');
+ assert_equals(c4.align, 'end');
+ this.done();
+ });
+ t.onerror = this.step_func(function() {
+ assert_unreached('got error event');
+ });
+ t.src = make_vtt_track('WEBVTT\n\n00:00:00.000 --> 00:00:00.001\ntest\n\n'+
+ '00:00:00.000 --> 00:00:00.001 align:start\ntest\n\n'+
+ '00:00:00.000 --> 00:00:00.001 align:center\ntest\n\n'+
+ '00:00:00.000 --> 00:00:00.001 align:end\ntest', this);
+ t.track.mode = 'showing';
+ video.appendChild(t);
+});
+</script>
diff --git a/testing/web-platform/tests/webvtt/api/VTTCue/categories.json b/testing/web-platform/tests/webvtt/api/VTTCue/categories.json
new file mode 100644
index 0000000000..eaa5ef17fc
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/api/VTTCue/categories.json
@@ -0,0 +1,3 @@
+{
+ "region.html": "regions"
+}
diff --git a/testing/web-platform/tests/webvtt/api/VTTCue/common.js b/testing/web-platform/tests/webvtt/api/VTTCue/common.js
new file mode 100644
index 0000000000..2c39352a84
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/api/VTTCue/common.js
@@ -0,0 +1,8 @@
+function make_vtt_track(contents, test) {
+ var track_blob = new Blob([contents], { type: 'text/vtt' });
+ var track_url = URL.createObjectURL(track_blob);
+ test.add_cleanup(function() {
+ URL.revokeObjectURL(track_url);
+ });
+ return track_url;
+}
diff --git a/testing/web-platform/tests/webvtt/api/VTTCue/constructor-exceptions.html b/testing/web-platform/tests/webvtt/api/VTTCue/constructor-exceptions.html
new file mode 100644
index 0000000000..06ad7f041c
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/api/VTTCue/constructor-exceptions.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<title>VTTCue constructor exceptions</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+test(function() {
+ assert_throws_js(TypeError, function() { new VTTCue(NaN, 0, 'foo'); });
+ assert_throws_js(TypeError, function() { new VTTCue(Infinity, 0, 'foo'); });
+ assert_throws_js(TypeError, function() { new VTTCue('tomorrow', 0, 'foo'); });
+}, document.title+', invalid start time');
+test(function() {
+ assert_throws_js(TypeError, function() { new VTTCue(0, NaN, 'foo'); });
+ assert_throws_js(TypeError, function() { new VTTCue(0, -Infinity, 'foo'); });
+ assert_throws_js(TypeError, function() { new VTTCue(0, 'tomorrow', 'foo'); });
+}, document.title+', invalid end time');
+test(function() {
+ var start = { valueOf: function() { return 42; } };
+ var end = { valueOf: function() { return 84; } };
+ var cue = new VTTCue(start, end, 'bar');
+ assert_equals(cue.startTime, 42);
+ assert_equals(cue.endTime, 84);
+ assert_equals(cue.text, 'bar');
+}, document.title+', valueOf');
+</script>
diff --git a/testing/web-platform/tests/webvtt/api/VTTCue/constructor.html b/testing/web-platform/tests/webvtt/api/VTTCue/constructor.html
new file mode 100644
index 0000000000..2937f0cecb
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/api/VTTCue/constructor.html
@@ -0,0 +1,56 @@
+<!doctype html>
+<title>VTTCue()</title>
+<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-vttcue">
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<div id=log></div>
+<script>
+test(function() {
+ var cue = new VTTCue(3, 12, 'foo bar');
+
+ assert_equals(cue.startTime, 3);
+ assert_equals(cue.endTime, 12);
+ assert_equals(cue.text, 'foo bar');
+ assert_equals(cue.id, '');
+ assert_equals(cue.region, null);
+ assert_equals(cue.pauseOnExit, false);
+ assert_equals(cue.snapToLines, true);
+ assert_equals(cue.line, 'auto');
+ assert_equals(cue.lineAlign, 'start');
+ assert_equals(cue.position, 'auto');
+ assert_equals(cue.positionAlign, 'auto');
+ assert_equals(cue.size, 100);
+ assert_equals(cue.align, 'center');
+}, document.title + ', initial values');
+
+test(function() {
+ var cue = new VTTCue(-1, 12, 'foo bar');
+
+ assert_equals(cue.startTime, -1);
+ assert_equals(cue.endTime, 12);
+}, document.title + ', bad start time');
+
+
+test(function() {
+ var cue = new VTTCue(2, -1, 'foo bar');
+
+ assert_equals(cue.startTime, 2);
+ assert_equals(cue.endTime, -1);
+}, document.title + ', bad end time');
+
+test(function() {
+ var cue = new VTTCue(2, +Infinity, 'foo bar');
+
+ assert_equals(cue.startTime, 2);
+ assert_equals(cue.endTime, +Infinity);
+}, document.title + ', unbounded end time');
+
+test(function() {
+ var cue = new VTTCue(3, 12, '<i>foo bar</i>');
+
+ var frag = cue.getCueAsHTML();
+ assert_equals(frag.childNodes.length, 1);
+ assert_equals(frag.childNodes[0].localName, 'i');
+ assert_equals(frag.childNodes[0].textContent, 'foo bar');
+}, document.title + ', text formatting');
+</script>
diff --git a/testing/web-platform/tests/webvtt/api/VTTCue/getCueAsHTML.html b/testing/web-platform/tests/webvtt/api/VTTCue/getCueAsHTML.html
new file mode 100644
index 0000000000..2f07d3aa0a
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/api/VTTCue/getCueAsHTML.html
@@ -0,0 +1,93 @@
+<!doctype html>
+<title>VTTCue.getCueAsHTML()</title>
+<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-getcueashtml">
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<div id=log></div>
+<script>
+test(function(){
+ var video = document.createElement('video');
+ var t1 = video.addTextTrack('subtitles');
+ document.body.appendChild(video);
+ var c1 = new VTTCue(0, 1, '<c></c><c.a.b></c><i></i><b></b><u></u><ruby><rt></rt></ruby><v></v><v a b></v><1:00:00.500>x\0');
+ t1.addCue(c1);
+ window.frag = c1.getCueAsHTML();
+ assert_equals(frag.childNodes.length, 10, 'childNodes.length');
+ assert_true(frag instanceof DocumentFragment, 'getCueAsHTML() should return DocumentFragment');
+}, document.title+', creating the cue');
+test(function(){
+ assert_equals(frag.childNodes[0].namespaceURI, 'http://www.w3.org/1999/xhtml', 'namespaceURI');
+ assert_equals(frag.childNodes[0].localName, 'span', 'localName');
+ assert_equals(frag.childNodes[0].attributes.length, 0, 'attributes');
+ assert_false(frag.childNodes[0].hasChildNodes(), 'hasChildNodes()');
+ assert_true(frag.childNodes[0] instanceof HTMLElement, 'instanceof');
+}, document.title+', <c>');
+test(function(){
+ assert_equals(frag.childNodes[1].namespaceURI, 'http://www.w3.org/1999/xhtml', 'namespaceURI');
+ assert_equals(frag.childNodes[1].localName, 'span', 'localName');
+ assert_equals(frag.childNodes[1].attributes.length, 1, 'attributes');
+ assert_equals(frag.childNodes[1].getAttributeNS('', 'class'), 'a b', 'class attribute');
+ assert_false(frag.childNodes[1].hasChildNodes(), 'hasChildNodes()');
+ assert_true(frag.childNodes[1] instanceof HTMLElement, 'instanceof');
+}, document.title+', <c.a.b>');
+test(function(){
+ assert_equals(frag.childNodes[2].namespaceURI, 'http://www.w3.org/1999/xhtml', 'namespaceURI');
+ assert_equals(frag.childNodes[2].localName, 'i', 'localName');
+ assert_equals(frag.childNodes[2].attributes.length, 0, 'attributes');
+ assert_false(frag.childNodes[2].hasChildNodes(), 'hasChildNodes()');
+ assert_true(frag.childNodes[2] instanceof HTMLElement, 'instanceof');
+}, document.title+', <i>');
+test(function(){
+ assert_equals(frag.childNodes[3].namespaceURI, 'http://www.w3.org/1999/xhtml', 'namespaceURI');
+ assert_equals(frag.childNodes[3].localName, 'b', 'localName');
+ assert_equals(frag.childNodes[3].attributes.length, 0, 'attributes');
+ assert_false(frag.childNodes[3].hasChildNodes(), 'hasChildNodes()');
+ assert_true(frag.childNodes[3] instanceof HTMLElement, 'instanceof');
+}, document.title+', <b>');
+test(function(){
+ assert_equals(frag.childNodes[4].namespaceURI, 'http://www.w3.org/1999/xhtml', 'namespaceURI');
+ assert_equals(frag.childNodes[4].localName, 'u', 'localName');
+ assert_equals(frag.childNodes[4].attributes.length, 0, 'attributes');
+ assert_false(frag.childNodes[4].hasChildNodes(), 'hasChildNodes()');
+ assert_true(frag.childNodes[4] instanceof HTMLElement, 'instanceof');
+}, document.title+', <u>');
+test(function(){
+ assert_equals(frag.childNodes[5].namespaceURI, 'http://www.w3.org/1999/xhtml', 'namespaceURI');
+ assert_equals(frag.childNodes[5].localName, 'ruby', 'localName');
+ assert_equals(frag.childNodes[5].attributes.length, 0, 'attributes');
+ assert_true(frag.childNodes[5].hasChildNodes(), 'hasChildNodes()');
+ assert_true(frag.childNodes[5] instanceof HTMLElement, 'instanceof');
+}, document.title+', <ruby>');
+test(function(){
+ assert_equals(frag.childNodes[5].firstChild.namespaceURI, 'http://www.w3.org/1999/xhtml', 'namespaceURI');
+ assert_equals(frag.childNodes[5].firstChild.localName, 'rt', 'localName');
+ assert_equals(frag.childNodes[5].firstChild.attributes.length, 0, 'attributes');
+ assert_false(frag.childNodes[5].firstChild.hasChildNodes(), 'hasChildNodes()');
+ assert_true(frag.childNodes[5].firstChild instanceof HTMLElement, 'instanceof');
+}, document.title+', <rt>');
+test(function(){
+ assert_equals(frag.childNodes[6].namespaceURI, 'http://www.w3.org/1999/xhtml', 'namespaceURI');
+ assert_equals(frag.childNodes[6].localName, 'span', 'localName');
+ assert_equals(frag.childNodes[6].attributes.length, 1, 'attributes');
+ assert_equals(frag.childNodes[6].getAttributeNS('', 'title'), '', 'title attribute');
+ assert_false(frag.childNodes[6].hasChildNodes(), 'hasChildNodes()');
+ assert_true(frag.childNodes[6] instanceof HTMLElement, 'instanceof');
+}, document.title+', <v>');
+test(function(){
+ assert_equals(frag.childNodes[7].namespaceURI, 'http://www.w3.org/1999/xhtml', 'namespaceURI');
+ assert_equals(frag.childNodes[7].localName, 'span', 'localName');
+ assert_equals(frag.childNodes[7].attributes.length, 1, 'attributes');
+ assert_equals(frag.childNodes[7].getAttributeNS('', 'title'), 'a b', 'title attribute');
+ assert_false(frag.childNodes[7].hasChildNodes(), 'hasChildNodes()');
+ assert_true(frag.childNodes[7] instanceof HTMLElement, 'instanceof');
+}, document.title+', <v a b>');
+test(function(){
+ assert_equals(frag.childNodes[8].target, 'timestamp', 'target');
+ assert_equals(frag.childNodes[8].data, '01:00:00.500', 'data');
+ assert_true(frag.childNodes[8] instanceof ProcessingInstruction, 'instanceof');
+}, document.title+', <1:00:00.500>');
+test(function(){
+ assert_equals(frag.childNodes[9].data, 'x\0', 'data');
+ assert_true(frag.childNodes[9] instanceof Text, 'instanceof');
+}, document.title+', x\\0');
+</script>
diff --git a/testing/web-platform/tests/webvtt/api/VTTCue/line.html b/testing/web-platform/tests/webvtt/api/VTTCue/line.html
new file mode 100644
index 0000000000..dcf46db052
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/api/VTTCue/line.html
@@ -0,0 +1,65 @@
+<!doctype html>
+<title>VTTCue.line</title>
+<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-line">
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=common.js></script>
+<div id=log></div>
+<script>
+test(function(){
+ var video = document.createElement('video');
+ document.body.appendChild(video);
+ var c1 = new VTTCue(0, 1, 'text1');
+ assert_true('line' in c1, 'line is not supported');
+ assert_equals(c1.line, "auto");
+ var track = document.createElement('track');
+ var t = track.track;
+ t.addCue(c1);
+ assert_equals(c1.line, "auto");
+ video.appendChild(track);
+ assert_equals(c1.line, "auto");
+ t.mode = 'showing';
+ assert_equals(c1.line, "auto");
+ var c2 = new VTTCue(0, 1, 'text2');
+ var track2 = document.createElement('track');
+ var t2 = track2.track;
+ t2.addCue(c2);
+ assert_equals(c2.line, "auto");
+ video.appendChild(track2);
+ t2.mode = 'showing';
+ assert_equals(c2.line, "auto");
+ assert_equals(c1.line, "auto");
+ c1.line = -5;
+ assert_equals(c1.line, -5);
+ assert_equals(c2.line, "auto");
+ c1.line = 0;
+ c1.snapToLines = false;
+ assert_equals(c1.line, 0);
+ assert_equals(c2.line, "auto");
+}, document.title+', script-created cue');
+
+var t_parsed = async_test(document.title+', parsed cue');
+t_parsed.step(function(){
+ var video = document.createElement('video');
+ document.body.appendChild(video);
+ var t = document.createElement('track');
+ t.onload = this.step_func(function(){
+ var c1 = t.track.cues[0];
+ var c2 = t.track.cues[1];
+ var c3 = t.track.cues[2];
+ assert_equals(c1.line, "auto");
+ assert_equals(c2.line, 0);
+ assert_equals(c3.line, 0);
+
+ this.done();
+ });
+ t.onerror = this.step_func(function() {
+ assert_unreached('got error event');
+ });
+ t.src = make_vtt_track('WEBVTT\n\n00:00:00.000 --> 00:00:00.001\ntest\n\n'+
+ '00:00:00.000 --> 00:00:00.001 line:0\ntest\n\n'+
+ '00:00:00.000 --> 00:00:00.001 line:0%\ntest', this);
+ t.track.mode = 'showing';
+ video.appendChild(t);
+});
+</script>
diff --git a/testing/web-platform/tests/webvtt/api/VTTCue/lineAlign.html b/testing/web-platform/tests/webvtt/api/VTTCue/lineAlign.html
new file mode 100644
index 0000000000..7be0d540e1
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/api/VTTCue/lineAlign.html
@@ -0,0 +1,39 @@
+<!doctype html>
+<title>VTTCue.lineAlign</title>
+<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-linealign">
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<div id=log></div>
+<script>
+test(function(){
+ var video = document.createElement('video');
+ document.body.appendChild(video);
+
+ var cue = new VTTCue(0, 1, 'text');
+ assert_true('lineAlign' in cue, 'lineAlign is not supported');
+ assert_equals(cue.lineAlign, 'start');
+
+ var track = document.createElement('track');
+ var t = track.track;
+ t.addCue(cue);
+
+ assert_equals(cue.lineAlign, 'start');
+
+ video.appendChild(track);
+ assert_equals(cue.lineAlign, 'start');
+
+ t.mode = 'showing';
+ assert_equals(cue.lineAlign, 'start');
+
+ cue.lineAlign = 'center';
+ assert_equals(cue.lineAlign, 'center');
+
+ cue.lineAlign = 'end';
+ assert_equals(cue.lineAlign, 'end');
+
+ ['start\u0000', 'centre', 'middle'].forEach(function(invalid) {
+ cue.lineAlign = invalid;
+ assert_equals(cue.lineAlign, 'end');
+ });
+}, document.title+', script-created cue');
+</script>
diff --git a/testing/web-platform/tests/webvtt/api/VTTCue/position.html b/testing/web-platform/tests/webvtt/api/VTTCue/position.html
new file mode 100644
index 0000000000..c0485e7a79
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/api/VTTCue/position.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<title>VTTCue.position</title>
+<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-position">
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<div id=log></div>
+<script>
+test(function(){
+ var cue = new VTTCue(0, 1, 'text');
+ assert_true('position' in cue, 'position is not supported');
+
+ cue.position = 'auto';
+ assert_equals(cue.position, 'auto');
+
+ for (i = 0; i <= 100; i++) {
+ cue.position = i;
+ assert_equals(cue.position, i);
+ }
+
+ [-1, -100, -101, 101, 200, 201].forEach(function(invalid) {
+ assert_throws_dom('IndexSizeError', function() {
+ cue.position = invalid;
+ });
+ });
+
+ cue.position = 1.5;
+ assert_equals(cue.position, 1.5);
+
+ cue.position = 'auto';
+ assert_equals(cue.position, 'auto');
+}, document.title+', script-created cue');
+</script>
diff --git a/testing/web-platform/tests/webvtt/api/VTTCue/positionAlign.html b/testing/web-platform/tests/webvtt/api/VTTCue/positionAlign.html
new file mode 100644
index 0000000000..bde1c6eee7
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/api/VTTCue/positionAlign.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<title>VTTCue.positionAlign</title>
+<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-positionalign">
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<div id=log></div>
+<script>
+test(function(){
+ var cue = new VTTCue(0, 1, 'text');
+ assert_true('positionAlign' in cue, 'positionAlign is not supported');
+
+ ['line-left', 'center', 'line-right', 'auto'].forEach(function(valid) {
+ cue.positionAlign = valid;
+ assert_equals(cue.positionAlign, valid);
+ });
+
+ cue.positionAlign = 'center';
+ ['auto\u0000', 'centre', 'middle'].forEach(function(invalid) {
+ cue.positionAlign = invalid;
+ assert_equals(cue.positionAlign, 'center');
+ });
+}, document.title+', script-created cue');
+</script>
diff --git a/testing/web-platform/tests/webvtt/api/VTTCue/region.html b/testing/web-platform/tests/webvtt/api/VTTCue/region.html
new file mode 100644
index 0000000000..ae51c5f603
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/api/VTTCue/region.html
@@ -0,0 +1,38 @@
+<!doctype html>
+<title>VTTCue.region</title>
+<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-region">
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<div id=log></div>
+<script>
+test(function(){
+ var video = document.createElement('video');
+ document.body.appendChild(video);
+
+ var cue = new VTTCue(0, 1, 'text');
+ assert_true('region' in cue, 'region is not supported');
+ assert_equals(cue.region, null);
+
+ var track = document.createElement('track');
+ var t = track.track;
+ t.addCue(cue);
+
+ assert_equals(cue.region, null);
+
+ video.appendChild(track);
+ assert_equals(cue.region, null);
+
+ t.mode = 'showing';
+ assert_equals(cue.region, null);
+
+ var region = new VTTRegion();
+ cue.region = region;
+ assert_equals(cue.region, region);
+
+ cue.region = 'foo';
+ assert_equals(cue.region, region);
+
+ cue.region = null;
+ assert_equals(cue.region, null);
+}, document.title+', script-created cue');
+</script>
diff --git a/testing/web-platform/tests/webvtt/api/VTTCue/size.html b/testing/web-platform/tests/webvtt/api/VTTCue/size.html
new file mode 100644
index 0000000000..fdb8059c72
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/api/VTTCue/size.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<title>VTTCue.size</title>
+<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-size">
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<div id=log></div>
+<script>
+test(function(){
+ var cue = new VTTCue(0, 1, 'text');
+ assert_true('size' in cue, 'size is not supported');
+
+ for (i = 0; i <= 100; i++) {
+ cue.size = i;
+ assert_equals(cue.size, i);
+ }
+
+ [-1, -100, -101, 101, 200, 201].forEach(function(invalid) {
+ assert_throws_dom('IndexSizeError', function() {
+ cue.size = invalid;
+ });
+ });
+
+ cue.size = 1.5;
+ assert_equals(cue.size, 1.5);
+}, document.title+', script-created cue');
+</script>
diff --git a/testing/web-platform/tests/webvtt/api/VTTCue/snapToLines.html b/testing/web-platform/tests/webvtt/api/VTTCue/snapToLines.html
new file mode 100644
index 0000000000..b3f9f34f10
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/api/VTTCue/snapToLines.html
@@ -0,0 +1,100 @@
+<!doctype html>
+<title>VTTCue.snapToLines</title>
+<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-snaptolines">
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=common.js></script>
+<div id=log></div>
+<script>
+setup(function(){
+ window.video = document.createElement('video');
+ window.t1 = video.addTextTrack('subtitles');
+ document.body.appendChild(video);
+});
+test(function(){
+ var c1 = new VTTCue(0, 1, 'text1');
+ assert_true('snapToLines' in c1, 'snapToLines is not supported');
+ assert_true(c1.snapToLines);
+ c1.line = 101;
+ c1.snapToLines = false;
+ assert_false(c1.snapToLines);
+ c1.snapToLines = true;
+ assert_true(c1.snapToLines);
+ c1.line = -1;
+ c1.snapToLines = false;
+ assert_false(c1.snapToLines);
+ c1.snapToLines = true;
+ assert_true(c1.snapToLines);
+ c1.line = 0;
+ c1.snapToLines = false;
+ assert_false(c1.snapToLines);
+}, document.title+', script-created cue');
+
+var t_parsed = async_test(document.title+', parsed cue');
+t_parsed.step(function(){
+ var t = document.createElement('track');
+ t.onload = this.step_func(function(){
+ var c1 = t.track.cues[0];
+ assert_true(c1.snapToLines);
+ c1.line = 101;
+ c1.snapToLines = false;
+ assert_false(c1.snapToLines);
+ c1.snapToLines = true;
+ assert_true(c1.snapToLines);
+ c1.line = -1;
+ c1.snapToLines = false;
+ assert_false(c1.snapToLines);
+ c1.snapToLines = true;
+ assert_true(c1.snapToLines);
+ c1.line = 0;
+ c1.snapToLines = false;
+ assert_false(c1.snapToLines);
+
+ var c2 = t.track.cues[1];
+ assert_true(c2.snapToLines);
+ c2.line = 101;
+ c2.snapToLines = false;
+ assert_false(c2.snapToLines);
+ c2.snapToLines = true;
+ assert_true(c2.snapToLines);
+ c2.line = -1;
+ c2.snapToLines = false;
+ assert_false(c2.snapToLines);
+ c2.snapToLines = true;
+ assert_true(c2.snapToLines);
+ c2.line = 0;
+ c2.snapToLines = false;
+ assert_false(c2.snapToLines);
+
+ var c3 = t.track.cues[2];
+ assert_false(c3.snapToLines);
+ c3.snapToLines = false;
+ assert_false(c3.snapToLines);
+ c3.snapToLines = true;
+ assert_true(c3.snapToLines);
+ c3.line = 101;
+ c3.snapToLines = false;
+ assert_false(c3.snapToLines);
+ c3.snapToLines = true;
+ assert_true(c3.snapToLines);
+ c3.line = -1;
+ c3.snapToLines = false;
+ assert_false(c3.snapToLines);
+ c3.snapToLines = true;
+ assert_true(c3.snapToLines);
+ c3.line = 0;
+ c3.snapToLines = false;
+ assert_false(c3.snapToLines);
+
+ this.done();
+ });
+ t.onerror = this.step_func(function() {
+ assert_unreached('got error event');
+ });
+ t.src = make_vtt_track('WEBVTT\n\n00:00:00.000 --> 00:00:00.001\ntest\n\n'+
+ '00:00:00.000 --> 00:00:00.001 line:0\ntest\n\n'+
+ '00:00:00.000 --> 00:00:00.001 line:0%\ntest', this);
+ t.track.mode = 'showing';
+ video.appendChild(t);
+});
+</script>
diff --git a/testing/web-platform/tests/webvtt/api/VTTCue/text.html b/testing/web-platform/tests/webvtt/api/VTTCue/text.html
new file mode 100644
index 0000000000..a61c600db9
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/api/VTTCue/text.html
@@ -0,0 +1,41 @@
+<!doctype html>
+<title>VTTCue.text</title>
+<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-text">
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=common.js></script>
+<div id=log></div>
+<script>
+setup(function(){
+ window.video = document.createElement('video');
+ window.t1 = video.addTextTrack('subtitles');
+ document.body.appendChild(video);
+});
+test(function(){
+ var c1 = new VTTCue(0, 1, 'text1\r\n\n\u0000');
+ assert_true('text' in c1, 'text is not supported');
+ assert_equals(c1.text, 'text1\r\n\n\u0000');
+ c1.text = c1.text;
+ assert_equals(c1.text, 'text1\r\n\n\u0000');
+ c1.text = null;
+ assert_equals(c1.text, 'null');
+}, document.title+', script-created cue');
+
+var t_parsed = async_test(document.title+', parsed cue');
+t_parsed.step(function(){
+ var t = document.createElement('track');
+ t.onload = this.step_func(function(){
+ var c = t.track.cues;
+ assert_equals(c[0].text, '');
+ assert_equals(c[1].text, 'test');
+ this.done();
+ });
+ t.onerror = this.step_func(function() {
+ assert_unreached('got error event');
+ });
+ t.src = make_vtt_track('WEBVTT\n\n00:00:00.000 --> 00:00:00.001\n'+
+ '\n\nfoobar\n00:00:00.000 --> 00:00:00.001\ntest', this);
+ t.track.mode = 'showing';
+ video.appendChild(t);
+});
+</script>
diff --git a/testing/web-platform/tests/webvtt/api/VTTCue/vertical.html b/testing/web-platform/tests/webvtt/api/VTTCue/vertical.html
new file mode 100644
index 0000000000..8b93f6b003
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/api/VTTCue/vertical.html
@@ -0,0 +1,57 @@
+<!doctype html>
+<title>VTTCue.vertical</title>
+<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-vertical">
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=common.js></script>
+<div id=log></div>
+<script>
+setup(function(){
+ window.video = document.createElement('video');
+ window.t1 = video.addTextTrack('subtitles');
+ document.body.appendChild(video);
+});
+test(function(){
+ var video = document.createElement('video');
+ document.body.appendChild(video);
+ var c1 = new VTTCue(0, 1, 'text1');
+ assert_true('vertical' in c1, 'vertical is not supported');
+ assert_equals(c1.vertical, '');
+ var track = document.createElement('track');
+ var t = track.track;
+ t.addCue(c1);
+ assert_equals(c1.vertical, '');
+ video.appendChild(track);
+ assert_equals(c1.vertical, '');
+ t.mode = 'showing';
+ assert_equals(c1.vertical, '');
+ c1.vertical = 'rl';
+ assert_equals(c1.vertical, 'rl');
+ c1.vertical = 'lr';
+ assert_equals(c1.vertical, 'lr');
+ c1.vertical = 'rl\u0000';
+ assert_equals(c1.vertical, 'lr');
+}, document.title+', script-created cue');
+
+var t_parsed = async_test(document.title+', parsed cue');
+t_parsed.step(function(){
+ var t = document.createElement('track');
+ t.onload = this.step_func(function(){
+ var c1 = t.track.cues[0];
+ var c2 = t.track.cues[1];
+ var c3 = t.track.cues[2];
+ assert_equals(c1.vertical, '');
+ assert_equals(c2.vertical, 'rl');
+ assert_equals(c3.vertical, 'lr');
+ this.done();
+ });
+ t.onerror = this.step_func(function() {
+ assert_unreached('got error event');
+ });
+ t.src = make_vtt_track('WEBVTT\n\n00:00:00.000 --> 00:00:00.001\ntest\n\n'+
+ '00:00:00.000 --> 00:00:00.001 vertical:rl\ntest\n\n'+
+ '00:00:00.000 --> 00:00:00.001 vertical:lr\ntest', this);
+ t.track.mode = 'showing';
+ video.appendChild(t);
+});
+</script>