From 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:33 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- .../web-platform/tests/orientation-event/README.md | 8 ----- .../orientation-event/motion/rounding.https.html | 38 ++++++++++++++++++++ .../orientation/null-values.https.html | 41 ++++++++++++++-------- .../orientation/rounding.https.html | 29 +++++++++++++++ .../resources/orientation-event-helpers.js | 11 ++++++ 5 files changed, 104 insertions(+), 23 deletions(-) delete mode 100644 testing/web-platform/tests/orientation-event/README.md create mode 100644 testing/web-platform/tests/orientation-event/motion/rounding.https.html create mode 100644 testing/web-platform/tests/orientation-event/orientation/rounding.https.html (limited to 'testing/web-platform/tests/orientation-event') diff --git a/testing/web-platform/tests/orientation-event/README.md b/testing/web-platform/tests/orientation-event/README.md deleted file mode 100644 index 14ea2f5117..0000000000 --- a/testing/web-platform/tests/orientation-event/README.md +++ /dev/null @@ -1,8 +0,0 @@ -The `resources/orientation-event-helpers.js` tests depend on the implementation of -the `GenericSensorTest` interface which is defined in [README.md](../generic-sensor/README.md). - -The Chromium implementation of the `GenericSensorTest` interface is located in -[generic_sensor_mocks.js](../resources/chromium/generic_sensor_mocks.js). - -Other browser vendors should provide their own implementations of -the `GenericSensorTest` interface. diff --git a/testing/web-platform/tests/orientation-event/motion/rounding.https.html b/testing/web-platform/tests/orientation-event/motion/rounding.https.html new file mode 100644 index 0000000000..846da79dfb --- /dev/null +++ b/testing/web-platform/tests/orientation-event/motion/rounding.https.html @@ -0,0 +1,38 @@ + + + + + + + diff --git a/testing/web-platform/tests/orientation-event/orientation/null-values.https.html b/testing/web-platform/tests/orientation-event/orientation/null-values.https.html index c54d73da50..9505e00954 100644 --- a/testing/web-platform/tests/orientation-event/orientation/null-values.https.html +++ b/testing/web-platform/tests/orientation-event/orientation/null-values.https.html @@ -7,21 +7,32 @@ diff --git a/testing/web-platform/tests/orientation-event/orientation/rounding.https.html b/testing/web-platform/tests/orientation-event/orientation/rounding.https.html new file mode 100644 index 0000000000..89bfa1d53c --- /dev/null +++ b/testing/web-platform/tests/orientation-event/orientation/rounding.https.html @@ -0,0 +1,29 @@ + + + + + + + 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. -- cgit v1.2.3