mirror of
https://github.com/servo/servo.git
synced 2025-08-18 11:55:39 +01:00
Update web-platform-tests to revision 0313d9f383d954ef401e79f3b669a5781aa3441a
This commit is contained in:
parent
aa61200eca
commit
b28a41ac85
55 changed files with 970 additions and 156 deletions
|
@ -0,0 +1,21 @@
|
|||
<!doctype html>
|
||||
<title>CSS Test Reference</title>
|
||||
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
|
||||
<link rel="author" href="https://www.mozilla.org" title="Mozilla">
|
||||
<style>
|
||||
div {
|
||||
width: 10ch;
|
||||
white-space: nowrap;
|
||||
font-family: monospace;
|
||||
}
|
||||
span {
|
||||
float: right;
|
||||
width: 5ch;
|
||||
height: 5ch;
|
||||
background: blue;
|
||||
}
|
||||
</style>
|
||||
<div>
|
||||
<span></span>
|
||||
Some text that overflows my parent.
|
||||
</div>
|
|
@ -0,0 +1,24 @@
|
|||
<!doctype html>
|
||||
<title>CSS Test: Floats in nowrap context</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/visuren.html#float-position">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=488725">
|
||||
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
|
||||
<link rel="author" href="https://www.mozilla.org" title="Mozilla">
|
||||
<link rel="mismatch" href="float-nowrap-1-notref.html">
|
||||
<style>
|
||||
div {
|
||||
width: 10ch;
|
||||
white-space: nowrap;
|
||||
font-family: monospace;
|
||||
}
|
||||
span {
|
||||
float: right;
|
||||
width: 5ch;
|
||||
height: 5ch;
|
||||
background: blue;
|
||||
}
|
||||
</style>
|
||||
<div>
|
||||
Some text that overflows my parent.
|
||||
<span></span>
|
||||
</div>
|
|
@ -0,0 +1,25 @@
|
|||
<!doctype html>
|
||||
<title>CSS Test: Floats in nowrap context</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/visuren.html#float-position">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=488725">
|
||||
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
|
||||
<link rel="author" href="https://www.mozilla.org" title="Mozilla">
|
||||
<link rel="match" href="float-nowrap-1.html">
|
||||
<style>
|
||||
div {
|
||||
width: 10ch;
|
||||
white-space: nowrap;
|
||||
font-family: monospace;
|
||||
}
|
||||
span {
|
||||
float: right;
|
||||
width: 5ch;
|
||||
height: 5ch;
|
||||
background: blue;
|
||||
}
|
||||
</style>
|
||||
<div>
|
||||
Some text that
|
||||
<span></span>
|
||||
overflows my parent.
|
||||
</div>
|
|
@ -0,0 +1,29 @@
|
|||
<!doctype html>
|
||||
<title>CSS Test: Floats in nowrap context</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/visuren.html#float-position">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=488725">
|
||||
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
|
||||
<link rel="author" href="https://www.mozilla.org" title="Mozilla">
|
||||
<link rel="mismatch" href="float-nowrap-4.html">
|
||||
<style>
|
||||
div {
|
||||
width: 10ch;
|
||||
font-family: monospace;
|
||||
}
|
||||
.float {
|
||||
float: right;
|
||||
width: 5ch;
|
||||
height: 5ch;
|
||||
background: blue;
|
||||
}
|
||||
.nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
<div>
|
||||
Some
|
||||
<span class="nowrap">
|
||||
text that overflows my parent.
|
||||
</span>
|
||||
<span class="float"></span>
|
||||
</div>
|
|
@ -0,0 +1,28 @@
|
|||
<!doctype html>
|
||||
<title>CSS Test: Floats in nowrap context</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/visuren.html#float-position">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=488725">
|
||||
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
|
||||
<link rel="author" href="https://www.mozilla.org" title="Mozilla">
|
||||
<link rel="match" href="float-nowrap-3-ref.html">
|
||||
<style>
|
||||
div {
|
||||
width: 10ch;
|
||||
font-family: monospace;
|
||||
}
|
||||
.float {
|
||||
float: right;
|
||||
width: 5ch;
|
||||
height: 5ch;
|
||||
background: blue;
|
||||
}
|
||||
.nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
<div>
|
||||
Some
|
||||
<span class="nowrap">
|
||||
text that overflows <span class="float"></span> my parent.
|
||||
</span>
|
||||
</div>
|
|
@ -0,0 +1,26 @@
|
|||
<!doctype html>
|
||||
<title>CSS Test Reference</title>
|
||||
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
|
||||
<link rel="author" href="https://www.mozilla.org" title="Mozilla">
|
||||
<style>
|
||||
div {
|
||||
width: 10ch;
|
||||
font-family: monospace;
|
||||
}
|
||||
.float {
|
||||
float: right;
|
||||
width: 5ch;
|
||||
height: 5ch;
|
||||
background: blue;
|
||||
}
|
||||
.nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
<div>
|
||||
Some
|
||||
<span class="float"></span>
|
||||
<span class="nowrap">
|
||||
text that overflows my parent.
|
||||
</span>
|
||||
</div>
|
|
@ -0,0 +1,28 @@
|
|||
<!doctype html>
|
||||
<title>CSS Test: Floats in nowrap context</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/visuren.html#float-position">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=488725">
|
||||
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
|
||||
<link rel="author" href="https://www.mozilla.org" title="Mozilla">
|
||||
<link rel="match" href="float-nowrap-4-ref.html">
|
||||
<style>
|
||||
div {
|
||||
width: 10ch;
|
||||
font-family: monospace;
|
||||
}
|
||||
.float {
|
||||
float: right;
|
||||
width: 5ch;
|
||||
height: 5ch;
|
||||
background: blue;
|
||||
}
|
||||
.nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
<div>
|
||||
Some
|
||||
<span class="nowrap">
|
||||
<span class="float"></span> text that overflows my parent.
|
||||
</span>
|
||||
</div>
|
|
@ -0,0 +1,5 @@
|
|||
<!doctype html>
|
||||
<title>CSS Test Reference</title>
|
||||
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
|
||||
<link rel="author" href="https://www.mozilla.org" title="Mozilla">
|
||||
<div>Hello Kittie
|
|
@ -0,0 +1,16 @@
|
|||
<!doctype html>
|
||||
<title>CSS Test: Floats in nowrap context</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/visuren.html#float-position">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=488725">
|
||||
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
|
||||
<link rel="author" href="https://www.mozilla.org" title="Mozilla">
|
||||
<link rel="match" href="float-nowrap-5-ref.html">
|
||||
<style>
|
||||
div {
|
||||
white-space: nowrap;
|
||||
}
|
||||
span {
|
||||
float: left;
|
||||
}
|
||||
</style>
|
||||
<div>Kittie<span>Hello </span>
|
|
@ -0,0 +1,16 @@
|
|||
<!doctype html>
|
||||
<title>CSS Test: Floats in nowrap context</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/visuren.html#float-position">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=488725">
|
||||
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
|
||||
<link rel="author" href="https://www.mozilla.org" title="Mozilla">
|
||||
<link rel="match" href="float-nowrap-5-ref.html">
|
||||
<style>
|
||||
div {
|
||||
white-space: nowrap;
|
||||
}
|
||||
span {
|
||||
float: left;
|
||||
}
|
||||
</style>
|
||||
<div><span>Hello </span>Kittie
|
|
@ -0,0 +1,26 @@
|
|||
<!doctype html>
|
||||
<title>CSS Test: Floats in nowrap context</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/visuren.html#float-position">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=488725">
|
||||
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
|
||||
<link rel="author" href="https://www.mozilla.org" title="Mozilla">
|
||||
<link rel="match" href="float-nowrap-1.html">
|
||||
<style>
|
||||
div {
|
||||
width: 10ch;
|
||||
white-space: nowrap;
|
||||
font-family: monospace;
|
||||
}
|
||||
.nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.float {
|
||||
float: right;
|
||||
width: 5ch;
|
||||
height: 5ch;
|
||||
background: blue;
|
||||
}
|
||||
</style>
|
||||
<div>
|
||||
<span class="nowrap">S<div class="float"></div><span>ome</span> text that overflows my parent.</span>
|
||||
</div>
|
|
@ -0,0 +1,24 @@
|
|||
<!doctype html>
|
||||
<title>CSS Test: Floats in nowrap context</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/visuren.html#float-position">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=488725">
|
||||
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
|
||||
<link rel="author" href="https://www.mozilla.org" title="Mozilla">
|
||||
<link rel="match" href="float-nowrap-1.html">
|
||||
<style>
|
||||
div {
|
||||
width: 10ch;
|
||||
white-space: nowrap;
|
||||
font-family: monospace;
|
||||
}
|
||||
span {
|
||||
float: right;
|
||||
width: 5ch;
|
||||
height: 5ch;
|
||||
background: blue;
|
||||
}
|
||||
</style>
|
||||
<div>
|
||||
Some <span></span>
|
||||
text that overflows my parent.
|
||||
</div>
|
|
@ -0,0 +1,28 @@
|
|||
<!doctype html>
|
||||
<title>CSS Test: Floats in nowrap context</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/visuren.html#float-position">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=488725">
|
||||
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
|
||||
<link rel="author" href="https://www.mozilla.org" title="Mozilla">
|
||||
<link rel="match" href="float-nowrap-3-ref.html">
|
||||
<style>
|
||||
div {
|
||||
width: 10ch;
|
||||
font-family: monospace;
|
||||
}
|
||||
.float {
|
||||
float: right;
|
||||
width: 5ch;
|
||||
height: 5ch;
|
||||
background: blue;
|
||||
}
|
||||
.nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
<div>
|
||||
Some
|
||||
<span class="nowrap">
|
||||
text <span class="float"></span> that overflows my parent.
|
||||
</span>
|
||||
</div>
|
|
@ -5,7 +5,6 @@
|
|||
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
|
||||
<title> CSS Transitions: Animatable CSS properties </title>
|
||||
<meta name="assert" content="Check that all animatable CSS properties are animatable and then accepted by the 'transition-property' property">
|
||||
<meta name="timeout" content="long">
|
||||
<link rel="author" title="Daniel Glazman" href="mailto:daniel.glazman@disruptive-innovations.com">
|
||||
<link rel="help" href="http://www.w3.org/TR/css3-transitions/#transitions">
|
||||
<link rel="help" href="http://www.w3.org/TR/css3-transitions/#animatable-properties">
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<body style="overflow: scroll">
|
||||
<div style="position: absolute; top: 50px; left: 50px; width: 200px; height: 200px; background: green"></div>
|
||||
</body>
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<title>CSSOM View - 6.1 - getBoundingClientRect tests</title>
|
||||
<link rel="help" href="http://www.w3.org/TR/cssom-view/#dom-element-getboundingclientrect">
|
||||
<link rel=match href="cssom-getBoundingClientRect-vertical-rl-ref.html">
|
||||
<meta name="flags" content="dom">
|
||||
<body style="writing-mode: vertical-rl; overflow: scroll">
|
||||
<div id="target" style="position: absolute; top: 50px; left: 50px; width: 200px; height: 200px; background: red"></div>
|
||||
<div id="overlay" style="position: absolute; background: green"></div>
|
||||
<script>
|
||||
var r = document.getElementById('target').getBoundingClientRect();
|
||||
var overlay = document.getElementById('overlay');
|
||||
overlay.style.top = r.top + 'px';
|
||||
overlay.style.left = r.left + 'px';
|
||||
overlay.style.width = r.width + 'px';
|
||||
overlay.style.height = r.height + 'px';
|
||||
</script>
|
||||
</body>
|
|
@ -24,7 +24,7 @@ with testharness.js. See also the [general guidelines][] for all test types.
|
|||
A test file can have multiple variants by including `meta` elements,
|
||||
for example:
|
||||
|
||||
```
|
||||
```html
|
||||
<meta name="variant" content="">
|
||||
<meta name="variant" content="?wss">
|
||||
```
|
||||
|
@ -36,7 +36,7 @@ There are two utility scripts in that work well together with variants,
|
|||
a test that would otherwise have too many tests to be useful can be
|
||||
split up in ranges of subtests. For example:
|
||||
|
||||
```
|
||||
```html
|
||||
<!doctype html>
|
||||
<title>Testing variants</title>
|
||||
<meta name="variant" content="?1-1000">
|
||||
|
@ -60,7 +60,7 @@ With `subsetTestByKey`, the key is given as the first argument, and the
|
|||
query string can include or exclude a key (will be matched as a regular
|
||||
expression).
|
||||
|
||||
```
|
||||
```html
|
||||
<!doctype html>
|
||||
<title>Testing variants by key</title>
|
||||
<meta name="variant" content="?include=Foo">
|
||||
|
@ -103,13 +103,15 @@ JavaScript file with the `.js` removed.
|
|||
For example, one could write a test for the `FileReaderSync` API by
|
||||
creating a `FileAPI/FileReaderSync.worker.js` as follows:
|
||||
|
||||
importScripts("/resources/testharness.js");
|
||||
test(function () {
|
||||
var blob = new Blob(["Hello"]);
|
||||
var fr = new FileReaderSync();
|
||||
assert_equals(fr.readAsText(blob), "Hello");
|
||||
}, "FileReaderSync#readAsText.");
|
||||
done();
|
||||
```js
|
||||
importScripts("/resources/testharness.js");
|
||||
test(function () {
|
||||
var blob = new Blob(["Hello"]);
|
||||
var fr = new FileReaderSync();
|
||||
assert_equals(fr.readAsText(blob), "Hello");
|
||||
}, "FileReaderSync#readAsText.");
|
||||
done();
|
||||
```
|
||||
|
||||
This test could then be run from `FileAPI/FileReaderSync.worker.html`.
|
||||
|
||||
|
@ -124,29 +126,33 @@ By default, the test runs in a window scope and a dedicated worker scope.
|
|||
For example, one could write a test for the `Blob` constructor by
|
||||
creating a `FileAPI/Blob-constructor.any.js` as follows:
|
||||
|
||||
test(function () {
|
||||
var blob = new Blob();
|
||||
assert_equals(blob.size, 0);
|
||||
assert_equals(blob.type, "");
|
||||
assert_false(blob.isClosed);
|
||||
}, "The Blob constructor.");
|
||||
```js
|
||||
test(function () {
|
||||
var blob = new Blob();
|
||||
assert_equals(blob.size, 0);
|
||||
assert_equals(blob.type, "");
|
||||
assert_false(blob.isClosed);
|
||||
}, "The Blob constructor.");
|
||||
```
|
||||
|
||||
This test could then be run from `FileAPI/Blob-constructor.any.worker.html` as well
|
||||
as `FileAPI/Blob-constructor.any.html`.
|
||||
|
||||
It is possible to customize the set of scopes with a metadata comment, such as
|
||||
|
||||
// META: global=sharedworker
|
||||
// ==> would run in the default window and dedicated worker scopes,
|
||||
// as well as the shared worker scope
|
||||
// META: global=!default,serviceworker
|
||||
// ==> would only run in the service worker scope
|
||||
// META: global=!window
|
||||
// ==> would run in the default dedicated worker scope, but not the
|
||||
// window scope
|
||||
// META: global=worker
|
||||
// ==> would run in the default window scope, as well as in the
|
||||
// dedicated, shared and service worker scopes
|
||||
```
|
||||
// META: global=sharedworker
|
||||
// ==> would run in the default window and dedicated worker scopes,
|
||||
// as well as the shared worker scope
|
||||
// META: global=!default,serviceworker
|
||||
// ==> would only run in the service worker scope
|
||||
// META: global=!window
|
||||
// ==> would run in the default dedicated worker scope, but not the
|
||||
// window scope
|
||||
// META: global=worker
|
||||
// ==> would run in the default window scope, as well as in the
|
||||
// dedicated, shared and service worker scopes
|
||||
```
|
||||
|
||||
For a test file <code><var>x</var>.any.js</code>, the available scope keywords
|
||||
are:
|
||||
|
@ -172,8 +178,10 @@ Use `// META: title=This is the title of the test` at the beginning of the resou
|
|||
|
||||
Use `// META: script=link/to/resource.js` at the beginning of the resource. For example,
|
||||
|
||||
// META: script=/common/utils.js
|
||||
// META: script=resources/utils.js
|
||||
```
|
||||
// META: script=/common/utils.js
|
||||
// META: script=resources/utils.js
|
||||
```
|
||||
|
||||
can be used to include both the global and a local `utils.js` in a test.
|
||||
|
||||
|
@ -185,8 +193,10 @@ Use `// META: timeout=long` at the beginning of the resource.
|
|||
|
||||
Use `// META: variant=url-suffix` at the beginning of the resource. For example,
|
||||
|
||||
// META: variant=
|
||||
// META: variant=?wss
|
||||
```
|
||||
// META: variant=
|
||||
// META: variant=?wss
|
||||
```
|
||||
|
||||
|
||||
[general guidelines]: {{ site.baseurl }}{% link _writing-tests/general-guidelines.md %}
|
||||
|
|
|
@ -18,6 +18,7 @@ test(function() {
|
|||
assert_true(supported_constraints.contrast);
|
||||
assert_true(supported_constraints.saturation);
|
||||
assert_true(supported_constraints.sharpness);
|
||||
assert_true(supported_constraints.focusDistance);
|
||||
assert_true(supported_constraints.zoom);
|
||||
assert_true(supported_constraints.torch);
|
||||
}, 'Image Capture supported constraints');
|
||||
|
|
|
@ -31,6 +31,7 @@ image_capture_test(async t => {
|
|||
contrast : 4,
|
||||
saturation : 5,
|
||||
sharpness : 6,
|
||||
focusDistance : 7,
|
||||
|
||||
zoom : 3.141592,
|
||||
|
||||
|
@ -82,6 +83,8 @@ image_capture_test(async t => {
|
|||
assert_equals(constraints.advanced[0].sharpness, settings.sharpness,
|
||||
'sharpness');
|
||||
|
||||
assert_equals(constraints.advanced[0].focusDistance, settings.focusDistance,
|
||||
'focusDistance');
|
||||
assert_equals(constraints.advanced[0].zoom, settings.zoom, 'zoom');
|
||||
|
||||
assert_equals(constraints.advanced[0].torch, settings.torch, 'torch');
|
||||
|
|
|
@ -33,6 +33,7 @@ image_capture_test(async (t, imageCaptureTest) => {
|
|||
contrast : 4,
|
||||
saturation : 5,
|
||||
sharpness : 6,
|
||||
focusDistance : 7,
|
||||
|
||||
zoom : 3.141592,
|
||||
|
||||
|
@ -101,6 +102,9 @@ image_capture_test(async (t, imageCaptureTest) => {
|
|||
'saturation');
|
||||
assert_equals(constraintsDict.sharpness, theMock.options().sharpness,
|
||||
'sharpness');
|
||||
assert_equals(constraintsDict.focusDistance, theMock.options().focusDistance
|
||||
,'focusDistance');
|
||||
|
||||
|
||||
assert_equals(constraintsDict.torch, theMock.options().torch, 'torch');
|
||||
|
||||
|
|
|
@ -124,6 +124,14 @@ image_capture_test(async (t, imageCaptureTest) => {
|
|||
assert_equals(capabilities.sharpness.step,
|
||||
mockCapabilities.sharpness.step);
|
||||
|
||||
assert_true(capabilities.focusDistance instanceof MediaSettingsRange);
|
||||
assert_equals(capabilities.focusDistance.max,
|
||||
mockCapabilities.focusDistance.max);
|
||||
assert_equals(capabilities.focusDistance.min,
|
||||
mockCapabilities.focusDistance.min);
|
||||
assert_equals(capabilities.focusDistance.step,
|
||||
mockCapabilities.focusDistance.step);
|
||||
|
||||
assert_true(capabilities.zoom instanceof MediaSettingsRange);
|
||||
assert_equals(capabilities.zoom.max, mockCapabilities.zoom.max);
|
||||
assert_equals(capabilities.zoom.min, mockCapabilities.zoom.min);
|
||||
|
|
|
@ -18,6 +18,7 @@ const constraints = { whiteBalanceMode : "manual",
|
|||
contrast : 4,
|
||||
saturation : 5,
|
||||
sharpness : 6,
|
||||
focusDistance : 7,
|
||||
|
||||
zoom : 3.141592
|
||||
// TODO: torch https://crbug.com/700607.
|
||||
|
|
|
@ -58,6 +58,7 @@ image_capture_test(async (t, imageCaptureTest) => {
|
|||
assert_equals(settings.saturation, mockSettings.saturation.current);
|
||||
assert_equals(settings.sharpness, mockSettings.sharpness.current);
|
||||
|
||||
assert_equals(settings.focusDistance, mockSettings.focusDistance.current);
|
||||
assert_equals(settings.zoom, mockSettings.zoom.current);
|
||||
|
||||
assert_equals(settings.torch, mockSettings.torch, 'torch');
|
||||
|
|
|
@ -173,6 +173,7 @@
|
|||
this.contrast = null;
|
||||
this.saturation = null;
|
||||
this.sharpness = null;
|
||||
this.focusDistance = null;
|
||||
this.zoom = null;
|
||||
this.redEyeReduction = 0;
|
||||
this.height = null;
|
||||
|
@ -193,7 +194,7 @@
|
|||
return err;
|
||||
|
||||
var kVersionSizes = [
|
||||
{version: 0, numBytes: 152}
|
||||
{version: 0, numBytes: 160}
|
||||
];
|
||||
err = messageValidator.validateStructVersion(offset, kVersionSizes);
|
||||
if (err !== validator.validationError.NONE)
|
||||
|
@ -284,41 +285,47 @@
|
|||
return err;
|
||||
|
||||
|
||||
// validate PhotoState.zoom
|
||||
// validate PhotoState.focusDistance
|
||||
err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 104, Range, false);
|
||||
if (err !== validator.validationError.NONE)
|
||||
return err;
|
||||
|
||||
|
||||
// validate PhotoState.zoom
|
||||
err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 112, Range, false);
|
||||
if (err !== validator.validationError.NONE)
|
||||
return err;
|
||||
|
||||
|
||||
|
||||
|
||||
// validate PhotoState.redEyeReduction
|
||||
err = messageValidator.validateEnum(offset + codec.kStructHeaderSize + 112, RedEyeReduction);
|
||||
err = messageValidator.validateEnum(offset + codec.kStructHeaderSize + 120, RedEyeReduction);
|
||||
if (err !== validator.validationError.NONE)
|
||||
return err;
|
||||
|
||||
|
||||
// validate PhotoState.height
|
||||
err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 120, Range, false);
|
||||
if (err !== validator.validationError.NONE)
|
||||
return err;
|
||||
|
||||
|
||||
// validate PhotoState.width
|
||||
err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 128, Range, false);
|
||||
if (err !== validator.validationError.NONE)
|
||||
return err;
|
||||
|
||||
|
||||
// validate PhotoState.width
|
||||
err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 136, Range, false);
|
||||
if (err !== validator.validationError.NONE)
|
||||
return err;
|
||||
|
||||
|
||||
// validate PhotoState.fillLightMode
|
||||
err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 136, 4, new codec.Enum(FillLightMode), false, [0], 0);
|
||||
err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 144, 4, new codec.Enum(FillLightMode), false, [0], 0);
|
||||
if (err !== validator.validationError.NONE)
|
||||
return err;
|
||||
|
||||
return validator.validationError.NONE;
|
||||
};
|
||||
|
||||
PhotoState.encodedSize = codec.kStructHeaderSize + 144;
|
||||
PhotoState.encodedSize = codec.kStructHeaderSize + 152;
|
||||
|
||||
PhotoState.decode = function(decoder) {
|
||||
var packed;
|
||||
|
@ -345,6 +352,7 @@
|
|||
val.contrast = decoder.decodeStructPointer(Range);
|
||||
val.saturation = decoder.decodeStructPointer(Range);
|
||||
val.sharpness = decoder.decodeStructPointer(Range);
|
||||
val.focusDistance = decoder.decodeStructPointer(Range);
|
||||
val.zoom = decoder.decodeStructPointer(Range);
|
||||
val.redEyeReduction = decoder.decodeStruct(codec.Int32);
|
||||
decoder.skip(1);
|
||||
|
@ -382,6 +390,7 @@
|
|||
encoder.encodeStructPointer(Range, val.contrast);
|
||||
encoder.encodeStructPointer(Range, val.saturation);
|
||||
encoder.encodeStructPointer(Range, val.sharpness);
|
||||
encoder.encodeStructPointer(Range, val.focusDistance);
|
||||
encoder.encodeStructPointer(Range, val.zoom);
|
||||
encoder.encodeStruct(codec.Int32, val.redEyeReduction);
|
||||
encoder.skip(1);
|
||||
|
@ -463,6 +472,7 @@
|
|||
this.hasContrast = false;
|
||||
this.hasSaturation = false;
|
||||
this.hasSharpness = false;
|
||||
this.hasFocusDistance = false;
|
||||
this.hasZoom = false;
|
||||
this.hasTorch = false;
|
||||
this.torch = false;
|
||||
|
@ -482,6 +492,7 @@
|
|||
this.contrast = 0;
|
||||
this.saturation = 0;
|
||||
this.sharpness = 0;
|
||||
this.focusDistance = 0;
|
||||
this.zoom = 0;
|
||||
this.fillLightMode = 0;
|
||||
this.width = 0;
|
||||
|
@ -501,7 +512,7 @@
|
|||
return err;
|
||||
|
||||
var kVersionSizes = [
|
||||
{version: 0, numBytes: 120}
|
||||
{version: 0, numBytes: 128}
|
||||
];
|
||||
err = messageValidator.validateStructVersion(offset, kVersionSizes);
|
||||
if (err !== validator.validationError.NONE)
|
||||
|
@ -551,11 +562,13 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// validate PhotoSettings.fillLightMode
|
||||
err = messageValidator.validateEnum(offset + codec.kStructHeaderSize + 88, FillLightMode);
|
||||
err = messageValidator.validateEnum(offset + codec.kStructHeaderSize + 96, FillLightMode);
|
||||
if (err !== validator.validationError.NONE)
|
||||
return err;
|
||||
|
||||
|
@ -568,7 +581,7 @@
|
|||
return validator.validationError.NONE;
|
||||
};
|
||||
|
||||
PhotoSettings.encodedSize = codec.kStructHeaderSize + 112;
|
||||
PhotoSettings.encodedSize = codec.kStructHeaderSize + 120;
|
||||
|
||||
PhotoSettings.decode = function(decoder) {
|
||||
var packed;
|
||||
|
@ -587,15 +600,16 @@
|
|||
packed = decoder.readUint8();
|
||||
val.hasSaturation = (packed >> 0) & 1 ? true : false;
|
||||
val.hasSharpness = (packed >> 1) & 1 ? true : false;
|
||||
val.hasZoom = (packed >> 2) & 1 ? true : false;
|
||||
val.hasTorch = (packed >> 3) & 1 ? true : false;
|
||||
val.torch = (packed >> 4) & 1 ? true : false;
|
||||
val.hasFillLightMode = (packed >> 5) & 1 ? true : false;
|
||||
val.hasWidth = (packed >> 6) & 1 ? true : false;
|
||||
val.hasHeight = (packed >> 7) & 1 ? true : false;
|
||||
val.hasFocusDistance = (packed >> 2) & 1 ? true : false;
|
||||
val.hasZoom = (packed >> 3) & 1 ? true : false;
|
||||
val.hasTorch = (packed >> 4) & 1 ? true : false;
|
||||
val.torch = (packed >> 5) & 1 ? true : false;
|
||||
val.hasFillLightMode = (packed >> 6) & 1 ? true : false;
|
||||
val.hasWidth = (packed >> 7) & 1 ? true : false;
|
||||
packed = decoder.readUint8();
|
||||
val.hasRedEyeReduction = (packed >> 0) & 1 ? true : false;
|
||||
val.redEyeReduction = (packed >> 1) & 1 ? true : false;
|
||||
val.hasHeight = (packed >> 0) & 1 ? true : false;
|
||||
val.hasRedEyeReduction = (packed >> 1) & 1 ? true : false;
|
||||
val.redEyeReduction = (packed >> 2) & 1 ? true : false;
|
||||
decoder.skip(1);
|
||||
val.whiteBalanceMode = decoder.decodeStruct(codec.Int32);
|
||||
val.exposureMode = decoder.decodeStruct(codec.Int32);
|
||||
|
@ -608,6 +622,7 @@
|
|||
val.contrast = decoder.decodeStruct(codec.Double);
|
||||
val.saturation = decoder.decodeStruct(codec.Double);
|
||||
val.sharpness = decoder.decodeStruct(codec.Double);
|
||||
val.focusDistance = decoder.decodeStruct(codec.Double);
|
||||
val.zoom = decoder.decodeStruct(codec.Double);
|
||||
val.fillLightMode = decoder.decodeStruct(codec.Int32);
|
||||
decoder.skip(1);
|
||||
|
@ -636,16 +651,17 @@
|
|||
packed = 0;
|
||||
packed |= (val.hasSaturation & 1) << 0
|
||||
packed |= (val.hasSharpness & 1) << 1
|
||||
packed |= (val.hasZoom & 1) << 2
|
||||
packed |= (val.hasTorch & 1) << 3
|
||||
packed |= (val.torch & 1) << 4
|
||||
packed |= (val.hasFillLightMode & 1) << 5
|
||||
packed |= (val.hasWidth & 1) << 6
|
||||
packed |= (val.hasHeight & 1) << 7
|
||||
packed |= (val.hasFocusDistance & 1) << 2
|
||||
packed |= (val.hasZoom & 1) << 3
|
||||
packed |= (val.hasTorch & 1) << 4
|
||||
packed |= (val.torch & 1) << 5
|
||||
packed |= (val.hasFillLightMode & 1) << 6
|
||||
packed |= (val.hasWidth & 1) << 7
|
||||
encoder.writeUint8(packed);
|
||||
packed = 0;
|
||||
packed |= (val.hasRedEyeReduction & 1) << 0
|
||||
packed |= (val.redEyeReduction & 1) << 1
|
||||
packed |= (val.hasHeight & 1) << 0
|
||||
packed |= (val.hasRedEyeReduction & 1) << 1
|
||||
packed |= (val.redEyeReduction & 1) << 2
|
||||
encoder.writeUint8(packed);
|
||||
encoder.skip(1);
|
||||
encoder.encodeStruct(codec.Int32, val.whiteBalanceMode);
|
||||
|
@ -659,6 +675,7 @@
|
|||
encoder.encodeStruct(codec.Double, val.contrast);
|
||||
encoder.encodeStruct(codec.Double, val.saturation);
|
||||
encoder.encodeStruct(codec.Double, val.sharpness);
|
||||
encoder.encodeStruct(codec.Double, val.focusDistance);
|
||||
encoder.encodeStruct(codec.Double, val.zoom);
|
||||
encoder.encodeStruct(codec.Int32, val.fillLightMode);
|
||||
encoder.skip(1);
|
||||
|
|
|
@ -77,6 +77,13 @@ var ImageCaptureTest = (() => {
|
|||
step: 1.0
|
||||
},
|
||||
|
||||
focusDistance: {
|
||||
min: 1.0,
|
||||
max: 10.0,
|
||||
current: 3.0,
|
||||
step: 1.0
|
||||
},
|
||||
|
||||
zoom: {
|
||||
min: 0.0,
|
||||
max: 10.0,
|
||||
|
@ -130,6 +137,8 @@ var ImageCaptureTest = (() => {
|
|||
this.state_.state.zoom.current = settings.zoom;
|
||||
if (settings.hasFocusMode)
|
||||
this.state_.state.currentFocusMode = settings.focusMode;
|
||||
if (settings.hasFocusDistance)
|
||||
this.state_.state.focusDistance.current = settings.focusDistance;
|
||||
|
||||
if (settings.pointsOfInterest.length > 0) {
|
||||
this.state_.state.pointsOfInterest =
|
||||
|
|
|
@ -192,6 +192,67 @@
|
|||
'new PannerNode(c, ' + JSON.stringify(options) + ')')
|
||||
.throw(TypeError);
|
||||
|
||||
// Test maxDistance
|
||||
options = {maxDistance: -1};
|
||||
should(
|
||||
() => {
|
||||
node = new PannerNode(context, options);
|
||||
},
|
||||
'new PannerNode(c, ' + JSON.stringify(options) + ')')
|
||||
.throw(RangeError);
|
||||
options = {maxDistance: 100};
|
||||
should(
|
||||
() => {
|
||||
node = new PannerNode(context, options);
|
||||
},
|
||||
'node7 = new PannerNode(c, ' + JSON.stringify(options) + ')')
|
||||
.notThrow();
|
||||
should(node.maxDistance, 'node7.maxDistance')
|
||||
.beEqualTo(options.maxDistance);
|
||||
|
||||
// Test rolloffFactor
|
||||
options = {rolloffFactor: -1};
|
||||
should(
|
||||
() => {
|
||||
node = new PannerNode(context, options);
|
||||
},
|
||||
'new PannerNode(c, ' + JSON.stringify(options) + ')')
|
||||
.throw(RangeError);
|
||||
options = {rolloffFactor: 0.5};
|
||||
should(
|
||||
() => {
|
||||
node = new PannerNode(context, options);
|
||||
},
|
||||
'node8 = new PannerNode(c, ' + JSON.stringify(options) + ')')
|
||||
.notThrow();
|
||||
should(node.rolloffFactor, 'node8.rolloffFactor')
|
||||
.beEqualTo(options.rolloffFactor);
|
||||
|
||||
// Test coneOuterGain
|
||||
options = {coneOuterGain: -1};
|
||||
should(
|
||||
() => {
|
||||
node = new PannerNode(context, options);
|
||||
},
|
||||
'new PannerNode(c, ' + JSON.stringify(options) + ')')
|
||||
.throw('InvalidStateError');
|
||||
options = {coneOuterGain: 1.1};
|
||||
should(
|
||||
() => {
|
||||
node = new PannerNode(context, options);
|
||||
},
|
||||
'new PannerNode(c, ' + JSON.stringify(options) + ')')
|
||||
.throw('InvalidStateError');
|
||||
options = {coneOuterGain: 0.5};
|
||||
should(
|
||||
() => {
|
||||
node = new PannerNode(context, options);
|
||||
},
|
||||
'node9 = new PannerNode(c, ' + JSON.stringify(options) + ')')
|
||||
.notThrow();
|
||||
should(node.coneOuterGain, 'node9.coneOuterGain')
|
||||
.beEqualTo(options.coneOuterGain);
|
||||
|
||||
task.done();
|
||||
});
|
||||
|
||||
|
@ -218,7 +279,7 @@
|
|||
rolloffFactor: 3 * Math.PI,
|
||||
coneInnerAngle: 4 * Math.PI,
|
||||
coneOuterAngle: 5 * Math.PI,
|
||||
coneOuterGain: 6 * Math.PI
|
||||
coneOuterGain: 0.1 * Math.PI
|
||||
};
|
||||
|
||||
should(
|
||||
|
|
|
@ -83,19 +83,6 @@
|
|||
makePc({ iceServers: [{}] }));
|
||||
}, '{ iceServers: [{}] } should throw TypeError');
|
||||
|
||||
config_test(makePc => {
|
||||
const pc = makePc({ iceServers: [{
|
||||
urls: []
|
||||
}] });
|
||||
|
||||
const { iceServers } = pc.getConfiguration();
|
||||
assert_equals(iceServers.length, 1);
|
||||
|
||||
const server = iceServers[0];
|
||||
assert_array_equals(server.urls, []);
|
||||
assert_equals(server.credentialType, 'password');
|
||||
}, 'with empty list urls should succeed');
|
||||
|
||||
config_test(makePc => {
|
||||
const pc = makePc({ iceServers: [{
|
||||
urls: 'stun:stun1.example.net'
|
||||
|
@ -322,32 +309,11 @@
|
|||
}, 'with invalid stun url should throw SyntaxError');
|
||||
|
||||
config_test(makePc => {
|
||||
const pc = makePc({ iceServers: [{
|
||||
urls: [],
|
||||
credentialType: 'password'
|
||||
}] });
|
||||
|
||||
const { iceServers } = pc.getConfiguration();
|
||||
assert_equals(iceServers.length, 1);
|
||||
|
||||
const server = iceServers[0];
|
||||
assert_array_equals(server.urls, []);
|
||||
assert_equals(server.credentialType, 'password');
|
||||
}, `with empty urls and credentialType password should succeed`);
|
||||
|
||||
config_test(makePc => {
|
||||
const pc = makePc({ iceServers: [{
|
||||
urls: [],
|
||||
credentialType: 'oauth'
|
||||
}] });
|
||||
|
||||
const { iceServers } = pc.getConfiguration();
|
||||
assert_equals(iceServers.length, 1);
|
||||
|
||||
const server = iceServers[0];
|
||||
assert_array_equals(server.urls, []);
|
||||
assert_equals(server.credentialType, 'oauth');
|
||||
}, `with empty urls and credentialType oauth should succeed`);
|
||||
assert_throws('SyntaxError', () =>
|
||||
makePc({ iceServers: [{
|
||||
urls: []
|
||||
}] }));
|
||||
}, `with empty urls should throw SyntaxError`);
|
||||
|
||||
config_test(makePc => {
|
||||
assert_throws(new TypeError(), () =>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue