summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/orientation-event/orientation/rounding.https.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/orientation-event/orientation/rounding.https.html')
-rw-r--r--testing/web-platform/tests/orientation-event/orientation/rounding.https.html29
1 files changed, 29 insertions, 0 deletions
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 @@
+<!DOCTYPE html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/testdriver.js"></script>
+<script src="/resources/testdriver-vendor.js"></script>
+<script src="../resources/orientation-event-helpers.js"></script>
+<script>
+'use strict';
+
+promise_test(async (t) => {
+ const helper = new SensorTestHelper(t, 'deviceorientation');
+ await helper.grantSensorsPermissions();
+ await helper.initializeSensors();
+
+ const value = 1.23456789;
+ const orientationData = generateOrientationData(value, value, value, false);
+ await helper.setData(orientationData);
+
+ const event = await new Promise(resolve => {
+ window.addEventListener('deviceorientation', t.step_func(ev => {
+ resolve(ev);
+ }, { once: true }));
+ });
+
+ assertValueIsCoarsened(event.alpha);
+ assertValueIsCoarsened(event.beta);
+ assertValueIsCoarsened(event.gamma);
+}, 'Tests that deviceorientation values are correctly rounded.');
+</script>