Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit ec7dd22

Browse files
committed
Add Generic Sensors
1 parent db51dd8 commit ec7dd22

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

scripts/9/data.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,56 @@ var tests = [
11111111
]
11121112
}
11131113
]
1114+
}, {
1115+
id: 'sensors',
1116+
name: 'Sensors',
1117+
status: 'experimental',
1118+
items: [
1119+
{
1120+
id: 'api',
1121+
name: 'Generic Sensor API',
1122+
value: 5,
1123+
urls: [
1124+
[ 'w3c', 'https://www.w3.org/TR/generic-sensor/' ]
1125+
]
1126+
},
1127+
1128+
'<strong>Low level sensors</strong>',
1129+
1130+
{
1131+
id: 'low.accelerometer',
1132+
name: 'Accelerometer',
1133+
value: 0
1134+
}, {
1135+
id: 'low.gyroscope',
1136+
name: 'Gyroscope',
1137+
value: 0
1138+
}, {
1139+
id: 'low.magnetometer',
1140+
name: 'Magnetometer',
1141+
value: 0
1142+
},
1143+
1144+
'<strong>High level sensors</strong>',
1145+
1146+
{
1147+
id: 'high.linearacceleration',
1148+
name: 'Linear Acceleration',
1149+
value: 0
1150+
}, {
1151+
id: 'high.absoluteorientation',
1152+
name: 'Absolute Orientation',
1153+
value: 0
1154+
}, {
1155+
id: 'high.relativeorientation',
1156+
name: 'Relative Orientation',
1157+
value: 0
1158+
}, {
1159+
id: 'high.ambientlight',
1160+
name: 'Ambient Light',
1161+
value: 0
1162+
},
1163+
]
11141164
}, {
11151165
id: 'hardware',
11161166
name: 'Hardware',

scripts/9/engine.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,6 +1447,53 @@ Test9 = (function () {
14471447
},
14481448

14491449

1450+
/* generic sensor api */
1451+
1452+
function (results) {
1453+
results.addItem({
1454+
key: 'sensors.api',
1455+
passed: "Sensor" in window
1456+
});
1457+
1458+
1459+
results.addItem({
1460+
key: 'sensors.low.accelerometer',
1461+
passed: "Sensor" in window && "Accelerometer" in window
1462+
});
1463+
1464+
results.addItem({
1465+
key: 'sensors.low.gyroscope',
1466+
passed: "Sensor" in window && "Gyroscope" in window
1467+
});
1468+
1469+
results.addItem({
1470+
key: 'sensors.low.magnetometer',
1471+
passed: "Sensor" in window && "Magnetometer" in window
1472+
});
1473+
1474+
1475+
results.addItem({
1476+
key: 'sensors.high.linearacceleration',
1477+
passed: "Sensor" in window && "LinearAccelerationSensor" in window
1478+
});
1479+
1480+
results.addItem({
1481+
key: 'sensors.high.absoluteorientation',
1482+
passed: "Sensor" in window && "AbsoluteOrientationSensor" in window
1483+
});
1484+
1485+
results.addItem({
1486+
key: 'sensors.high.relativeorientation',
1487+
passed: "Sensor" in window && "RelativeOrientationSensor" in window
1488+
});
1489+
1490+
results.addItem({
1491+
key: 'sensors.high.ambientlight',
1492+
passed: "Sensor" in window && "AmbientLightSensor" in window
1493+
});
1494+
},
1495+
1496+
14501497
/* web bluetooth */
14511498

14521499
function (results) {

0 commit comments

Comments
 (0)