Update web-platform-tests to revision 346d5b51a122f7bb1c7747064499ef281a0200f7

This commit is contained in:
Ms2ger 2016-06-24 10:13:49 +02:00
parent 581c8ba1c8
commit 79b1e6c40c
1728 changed files with 20243 additions and 5349 deletions

View file

@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<head>
<title>DeviceMotionEvent: A device in free-fall, with the screen horizontal and upmost</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author' title='Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-14 -->
</head>
<body>
<p>Free fall the device to run the test, with the screen horizontal and upmost.</p>
<div id="log"></div>
<script>
var t = async_test(document.title);
var run = false;
/*
* A device in free-fall, with the screen horizontal and upmost,
* has an accelerationIncludingGravity of zero and
* the following value for acceleration:
* {
* x: 0,
* y: 0,
* z: -9.81
* };
*/
window.addEventListener("devicemotion", function(e) {
if (!run) {
run = true;
t.step(function() {
var gvt = e.accelerationIncludingGravity;
var acc = e.acceleration;
assert_approx_equals(gvt.x, 0, 1);
assert_approx_equals(gvt.y, 0, 1);
assert_approx_equals(gvt.z, 0, 1);
assert_approx_equals(acc.x, 0, 1);
assert_approx_equals(acc.y, 0, 1);
assert_approx_equals(acc.z, -9.81, 1.5);
});
t.done();
}
}, false);
</script>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<title>DeviceOrientationEvent: A device lying flat on a horizontal surface</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author' title='Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-12 -->
</head>
<body>
<p>Put the device on a horizontal surface to run the test.</p>
<div id="log"></div>
<script>
var gamma, beta;
var run = false;
window.addEventListener("deviceorientation", function(e) {
if (!run) {
run = true;
gamma = e.gamma; // Gamma : angle par rapport a x
beta = e.beta; // Beta : angle par rapport a y
}
}, false);
test(function() {
assert_approx_equals(gamma, 0, 2);
}, "X angle");
test(function() {
assert_approx_equals(beta, 0, 2);
}, "Y angle");
</script>
</body>
</html>

View file

@ -0,0 +1,84 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>DeviceOrientation Event IDL tests</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="http://dev.w3.org/geo/api/spec-source-orientation.html">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
<style>
pre {
display: none;
}
</style>
<div id="log"></div>
<pre id="untested_idl">
interface Event {
};
dictionary EventInit {
};
</pre>
<pre id='idl'>
[Constructor(DOMString type, optional DeviceOrientationEventInit eventInitDict)]
interface DeviceOrientationEvent : Event {
readonly attribute double? alpha;
readonly attribute double? beta;
readonly attribute double? gamma;
readonly attribute boolean absolute;
};
dictionary DeviceOrientationEventInit : EventInit {
double? alpha;
double? beta;
double? gamma;
boolean absolute;
};
[Callback, NoInterfaceObject]
interface DeviceAcceleration {
readonly attribute double? x;
readonly attribute double? y;
readonly attribute double? z;
};
[Callback, NoInterfaceObject]
interface DeviceRotationRate {
readonly attribute double? alpha;
readonly attribute double? beta;
readonly attribute double? gamma;
};
[Constructor(DOMString type, optional DeviceMotionEventInit eventInitDict)]
interface DeviceMotionEvent : Event {
readonly attribute DeviceAcceleration? acceleration;
readonly attribute DeviceAcceleration? accelerationIncludingGravity;
readonly attribute DeviceRotationRate? rotationRate;
readonly attribute double? interval;
};
dictionary DeviceMotionEventInit : EventInit {
DeviceAcceleration? acceleration;
DeviceAcceleration? accelerationIncludingGravity;
DeviceRotationRate? rotationRate;
double? interval;
};
</pre>
<script>
"use strict";
var idl_array = new IdlArray();
idl_array.add_untested_idls(document.getElementById("untested_idl").textContent);
idl_array.add_idls(document.getElementById("idl").textContent);
idl_array.add_objects({
DeviceOrientationEvent: ['new DeviceOrientationEvent("foo")'],
DeviceMotionEvent: ['new DeviceMotionEvent("foo")'],
});
idl_array.test();
</script>

View file

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<title>DeviceMotionEvent: A device lying flat on a horizontal surface with the screen upmost</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author' title='Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-14 -->
</head>
<body>
<p>Put the device on a horizontal surface with the screen upmost.</p>
<div id="log"></div>
<script>
var t = async_test(document.title);
var run = false;
/*
* A device lying flat on a horizontal surface with the screen upmost
* has an acceleration of zero and the following value for
* accelerationIncludingGravity:
* {
* x: 0,
* y: 0,
* z: 9.81
* };
*/
window.addEventListener("devicemotion", function(e) {
if (!run) {
run = true;
t.step(function() {
var gvt = e.accelerationIncludingGravity;
var acc = e.acceleration;
var rot = e.rotationRate;
assert_approx_equals(gvt.x, 0, 1);
assert_approx_equals(gvt.y, 0, 1);
assert_approx_equals(gvt.z, 9.81, 1.5);
assert_approx_equals(acc.x, 0, 1);
assert_approx_equals(acc.y, 0, 1);
assert_approx_equals(acc.z, 0, 1);
assert_equals(rot, null);
});
t.done();
}
}, false);
</script>
</body>
</html>

View file

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<head>
<title>DeviceMotionEvent: A device with the screen upright</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author' title='Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-14 -->
</head>
<body>
<p>Put the device with the screen upright.</p>
<div id="log"></div>
<script>
var t = async_test(document.title);
var run = false;
/*
* A device with the screen upright has an acceleration of zero
* and the following value for accelerationIncludingGravity:
* {
* x: 0,
* y: -9.81,
* z: 0
* };
*/
window.addEventListener("devicemotion", function(e) {
if (!run) {
run = true;
t.step(function() {
var gvt = e.accelerationIncludingGravity;
var acc = e.acceleration;
var rot = e.rotationRate;
assert_approx_equals(gvt.x, 0, 1);
assert_approx_equals(gvt.y, -9.81, 1.5);
assert_approx_equals(gvt.z, 0, 1);
assert_approx_equals(acc.x, 0, 1);
assert_approx_equals(acc.y, 0, 1);
assert_approx_equals(acc.z, 0, 1);
assert_equals(rot, null);
});
t.done();
}
}, false);
</script>
</body>
</html>

View file

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>User agents implementing this specification must provide a new DOM event, named deviceorientation</title>
<meta name=viewport content="width=device-width, maximum-scale=1.0">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-12 -->
</head>
<body>
<p>Rotate the device to run the test.</p>
<div id="log"></div>
<script>
var t = async_test();
var run = false;
window.addEventListener("deviceorientation", function(e) {
if (!run) {
run = true;
t.done();
}
}, false);
</script>
</body>
</html>

View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<title>The corresponding event must be of type DeviceOrientationEvent and must fire on the window object.</title>
<meta name=viewport content="width=device-width, maximum-scale=1.0">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-12 -->
</head>
<body>
<p>Rotate the device to run the tests.</p>
<div id="log"></div>
<script>
var t1 = async_test("The corresponding event must be of type DeviceOrientationEvent");
var t2 = async_test("The corresponding event must fire on the window object");
var run = false;
window.addEventListener("deviceorientation", function(e) {
if (!run) {
run = true;
var _this = this;
t1.step(function() {
assert_equals(e.type, "deviceorientation");
});
t1.done();
t2.step(function() {
assert_equals(_this, window);
});
t2.done();
}
}, false);
</script>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<title>User agents must also provide an event handler IDL attribute [HTML5] named ondeviceorientation on the window object</title>
<meta name=viewport content="width=device-width, maximum-scale=1.0">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-12 -->
</head>
<body>
<p>Rotate the device to run the tests.</p>
<div id="log"></div>
<script>
var t1 = async_test("Provide an event handler IDL attribute [HTML5] named ondeviceorientation");
var t2 = async_test("The type of this event handler must be 'DeviceOrientationEvent'");
var run = false;
window.ondeviceorientation = function(e) {
if (!run) {
run = true;
t1.step(function() {
assert_equals(e.type, "deviceorientation");
});
t1.done();
t2.step(function() {
assert_true(e.constructor.lastIndexOf("DeviceOrientationEvent") != -1);
});
t2.done();
}
};
</script>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<title>Rotate the device frame around its z axis</title>
<meta name=viewport content="width=device-width, maximum-scale=1.0">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-12 -->
</head>
<body>
<p>Rotate the device frame around its z axis to run the test.</p>
<div id="log"></div>
<script>
var alpha = 0;
var run = false;
window.addEventListener("deviceorientation", function(e) {
if (!run) {
run = true;
alpha = e.alpha;
}
}, false);
test(function() {
assert_true(alpha > 0 && alpha < 360);
}, "Alpha is between 0 and 360");
test(function() {
assert_false(alpha > -2 && alpha < 2);
}, "Alpha is not around zero (between 0 and 2)");
</script>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<title>Rotate the device frame around its x axis</title>
<meta name=viewport content="width=device-width, maximum-scale=1.0">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-12 -->
</head>
<body>
<p>Rotate the device frame around its x axis to run the test.</p>
<div id="log"></div>
<script>
var beta = 180;
var run = false;
window.addEventListener("deviceorientation", function(e) {
if (!run) {
run = true;
beta = e.beta;
}
}, false);
test(function() {
assert_true(beta > -180 && beta < 180);
}, "Beta is between -180 and 180");
test(function() {
assert_false(beta > -2 && beta < 2);
}, "Beta is not around zero (between -2 and 2)");
</script>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<title>Rotate the device frame around its y axis</title>
<meta name=viewport content="width=device-width, maximum-scale=1.0">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-12 -->
</head>
<body>
<p>Rotate the device frame around its y axis to run the test.</p>
<div id="log"></div>
<script>
var gamma = 90;
var run = false;
window.addEventListener("deviceorientation", function(e) {
if (!run) {
run = true;
gamma = e.gamma;
}
}, false);
test(function() {
assert_true(gamma > -90 && gamma < 90);
}, "Gamma is between -90 and 90");
test(function() {
assert_false(gamma > -2 && gamma < 2);
}, "Gamma is not around zero (between -2 and 2)");
</script>
</body>
</html>

View file

@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<title>Implementations that are unable to provide all three angles must set the values of the unknown angles to null</title>
<meta name=viewport content="width=device-width, maximum-scale=1.0">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-12 -->
</head>
<body>
<p>Precondition: implementation is unable to provide all three angles</p>
<p>Rotate the device to run the test.</p>
<div id="log"></div>
<script>
var gamma, beta, alpha;
var run = false;
window.addEventListener("deviceorientation", function(e) {
if (!run) {
run = true;
gamma = e.gamma; // Gamma : angle par rapport a x
beta = e.beta; // Beta : angle par rapport a y
alpha = e.alpha; // Alpha : orientation (N-S-E-O)
}
}, false);
test(function() {
assert_equals(gamma, null);
}, "Check if gamma is set to null");
test(function() {
assert_equals(beta, null);
}, "Check if beta is set to null");
test(function() {
assert_equals(alpha, null);
}, "Check if alpha is set to null");
</script>
</body>
</html>

View file

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>User agents implementing this specification must provide a new DOM event, named devicemotion</title>
<meta name=viewport content="width=device-width, maximum-scale=1.0">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-14 -->
</head>
<body>
<p>Move the device to run the test.</p>
<div id="log"></div>
<script>
var t = async_test();
var run = false;
window.addEventListener("devicemotion", function(e) {
if (!run) {
run = true;
t.done();
}
}, false);
</script>
</body>
</html>

View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<title>The corresponding event must be of type DeviceOrientationEvent and must fire on the window object</title>
<meta name=viewport content="width=device-width, maximum-scale=1.0">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-14 -->
</head>
<body>
<p>Move the device to run the test.</p>
<div id="log"></div>
<script>
var t1 = async_test("The corresponding event must be of type DeviceMotionEvent");
var t2 = async_test("The corresponding event must fire on the window object");
var run = false;
window.addEventListener("devicemotion", function(e) {
if (!run) {
run = true;
var _this = this;
t1.step(function() {
assert_equals(e.type, "devicemotion");
});
t1.done();
t2.step(function() {
assert_equals(_this, window);
});
t2.done();
}
}, false);
</script>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<title>User agents must also provide an event handler IDL attribute HTML5 named ondevicemotion on the window object</title>
<meta name=viewport content="width=device-width, maximum-scale=1.0">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-14 -->
</head>
<body>
<p>Move the device to run the test.</p>
<div id="log"></div>
<script>
var t1 = async_test("User agents provide an event handler IDL attribute HTML5 named ondevicemotion");
var t2 = async_test("The type of this event handler must be 'DeviceMotionEvent'");
var run = false;
window.ondevicemotion = function(e) {
if (!run) {
run = true;
t1.step(function() {
assert_equals(e.type, "devicemotion");
});
t1.done();
t2.step(function() {
assert_true(e.constructor.lastIndexOf("DeviceMotionEvent") != -1);
});
t2.done();
}
};
</script>
</body>
</html>

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<title>Implementations that are unable to provide acceleration data without the effect of gravity may instead supply the acceleration including the effect of gravity</title>
<meta name=viewport content="width=device-width, maximum-scale=1.0">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-14 -->
</head>
<body>
<p>Move the device to run the test.</p>
<div id="log"></div>
<script>
var t1 = async_test("Implementation is unable to provide 'acceleration' property");
var t2 = async_test("Implementation is able to provide 'acceleration IncludingGravity' property");
var run = false;
window.ondevicemotion = function(e) {
if (!run) {
run = true;
t1.step(function() {
assert_equals(e.acceleration, null);
});
t1.done();
t2.step(function() {
var eaccgvt = e.accelerationIncludingGravity;
assert_equals(typeof eaccgvt, "object");
assert_not_equals(eaccgvt.x, 0);
assert_not_equals(eaccgvt.y, 0);
assert_not_equals(eaccgvt.z, 0);
});
t2.done();
}
};
</script>
</body>
</html>

View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head>
<title>The interval property must be expressed in milliseconds. It must be a constant, to simplify filtering of the data by the Web application</title>
<meta name=viewport content="width=device-width, maximum-scale=1.0">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-14 -->
</head>
<body>
<p>Move the device to run the test.</p>
<div id="log"></div>
<script>
var t = async_test("The interval property must be different to zero and must be a constant");
var inter1 = 0;
var inter2 = 0;
var run = false;
window.addEventListener("devicemotion", function(e) {
if (!run) {
run = true;
t.step(function() {
if (inter1 == 0) {
inter2 = e.interval;
}
inter1 = e.interval;
assert_not_equals(inter1, 0);
assert_not_equals(inter1, inter2);
});
t.done();
}
}, false);
</script>
</body>
</html>