diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
commit | fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch) | |
tree | 4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /testing/web-platform/tests/orientation-event/resources | |
parent | Releasing progress-linux version 124.0.1-1~progress7.99u1. (diff) | |
download | firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/orientation-event/resources')
-rw-r--r-- | testing/web-platform/tests/orientation-event/resources/orientation-event-helpers.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/testing/web-platform/tests/orientation-event/resources/orientation-event-helpers.js b/testing/web-platform/tests/orientation-event/resources/orientation-event-helpers.js index 01e91c62ae..dab876fc6a 100644 --- a/testing/web-platform/tests/orientation-event/resources/orientation-event-helpers.js +++ b/testing/web-platform/tests/orientation-event/resources/orientation-event-helpers.js @@ -203,6 +203,17 @@ function generateOrientationData(alpha, beta, gamma, absolute) { return orientationData; } +function assertValueIsCoarsened(value) { + // Checks that the precision of the value is at most 0.1. + // https://www.w3.org/TR/orientation-event/ specification defines that all + // measurements are required to be coarsened to 0.1 degrees, 0.1 m/s^2 or + // 0.1 deg/s. + const resolution = 0.1; + const coarsenedValue = Math.round(value / resolution) * resolution; + assert_approx_equals(value, coarsenedValue, Number.EPSILON, + `Expected ${value}'s precision to be at most ${resolution}`); +} + function assertEventEquals(actualEvent, expectedEvent) { // If two doubles differ by less than this amount, we can consider them // to be effectively equal. |