Skip to content

Truly independent web browser

Tests: Import VTTCue position and size WPT tests

Shannon Booth0a1427a1dc9e
diff --git a/Tests/LibWeb/Text/expected/wpt-import/webvtt/api/VTTCue/position.txt b/Tests/LibWeb/Text/expected/wpt-import/webvtt/api/VTTCue/position.txt
new file mode 100644
index 00000000000..0a80f278bc1
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/webvtt/api/VTTCue/position.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail VTTCue.position, script-created cue
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/webvtt/api/VTTCue/size.txt b/Tests/LibWeb/Text/expected/wpt-import/webvtt/api/VTTCue/size.txt
new file mode 100644
index 00000000000..1bd5940794f
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/webvtt/api/VTTCue/size.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail VTTCue.size, script-created cue
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/wpt-import/webvtt/api/VTTCue/position.html b/Tests/LibWeb/Text/input/wpt-import/webvtt/api/VTTCue/position.html
new file mode 100644
index 00000000000..f6fa839097e
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/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/Tests/LibWeb/Text/input/wpt-import/webvtt/api/VTTCue/size.html b/Tests/LibWeb/Text/input/wpt-import/webvtt/api/VTTCue/size.html
new file mode 100644
index 00000000000..c91254d54c1
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/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>