Title: [247207] trunk/LayoutTests
Revision
247207
Author
ctur...@igalia.com
Date
2019-07-08 04:47:13 -0700 (Mon, 08 Jul 2019)

Log Message

[GStreamer] media/video-volume.html broken after switching from cubic to linear scaling
https://bugs.webkit.org/show_bug.cgi?id=199505

Reviewed by Xabier Rodriguez-Calvar.

PulseAudio has a conversion process from volume's in
double-precision to uint32_t volumes. Depending on the environment
can introduce rounding errors. Be more lenient in our comparison
code.

* media/video-volume-expected.txt: Update baseline
* media/video-volume.html: Compare volume values within a
reasonable tolerance.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (247206 => 247207)


--- trunk/LayoutTests/ChangeLog	2019-07-08 11:26:24 UTC (rev 247206)
+++ trunk/LayoutTests/ChangeLog	2019-07-08 11:47:13 UTC (rev 247207)
@@ -1,3 +1,19 @@
+2019-07-08  Charlie Turner  <ctur...@igalia.com>
+
+        [GStreamer] media/video-volume.html broken after switching from cubic to linear scaling
+        https://bugs.webkit.org/show_bug.cgi?id=199505
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        PulseAudio has a conversion process from volume's in
+        double-precision to uint32_t volumes. Depending on the environment
+        can introduce rounding errors. Be more lenient in our comparison
+        code.
+
+        * media/video-volume-expected.txt: Update baseline
+        * media/video-volume.html: Compare volume values within a
+        reasonable tolerance.
+
 2019-07-08  Antoine Quint  <grao...@apple.com>
 
         [Pointer Events] Enable only on the most recent version of the supported iOS family

Modified: trunk/LayoutTests/media/video-volume-expected.txt (247206 => 247207)


--- trunk/LayoutTests/media/video-volume-expected.txt	2019-07-08 11:26:24 UTC (rev 247206)
+++ trunk/LayoutTests/media/video-volume-expected.txt	2019-07-08 11:47:13 UTC (rev 247207)
@@ -1,18 +1,18 @@
 
 Test 'volume' attribute
 
-EXPECTED (video.volume == '1') OK
+EXPECTED (compareWithTolerance(video.volume, 1.0) == 'true') OK
 RUN(video.volume = 0.5)
-EXPECTED (video.volume == '0.5') OK
+EXPECTED (compareWithTolerance(video.volume, 0.5) == 'true') OK
 RUN(video.volume = 0)
-EXPECTED (video.volume == '0') OK
+EXPECTED (compareWithTolerance(video.volume, 0) == 'true') OK
 TEST(video.volume = 1.5) THROWS(DOMException.INDEX_SIZE_ERR) OK
 TEST(video.volume = -0.5) THROWS(DOMException.INDEX_SIZE_ERR) OK
 RUN(video.load())
 EVENT(canplaythrough)
-EXPECTED (video.volume == '0') OK
+EXPECTED (compareWithTolerance(video.volume, 0) == 'true') OK
 RUN(video.volume = 0.5)
-EXPECTED (video.volume == '0.5') OK
+EXPECTED (compareWithTolerance(video.volume, 0.5) == 'true') OK
 TEST(video.volume = 1.5) THROWS(DOMException.INDEX_SIZE_ERR) OK
 TEST(video.volume = -0.5) THROWS(DOMException.INDEX_SIZE_ERR) OK
 END OF TEST

Modified: trunk/LayoutTests/media/video-volume.html (247206 => 247207)


--- trunk/LayoutTests/media/video-volume.html	2019-07-08 11:26:24 UTC (rev 247206)
+++ trunk/LayoutTests/media/video-volume.html	2019-07-08 11:47:13 UTC (rev 247207)
@@ -3,19 +3,23 @@
 <script src=""
 <script src=""
 <script>
-    testExpected("video.volume", 1.0);
+    function compareWithTolerance(a, b) {
+        tolerance = 0.00001;
+        return (Math.abs(a - b) < tolerance);
+    }
+    testExpected("compareWithTolerance(video.volume, 1.0)", true);
     run("video.volume = 0.5");
-    testExpected("video.volume", 0.5);
+    testExpected("compareWithTolerance(video.volume, 0.5)", true);
     run("video.volume = 0");
-    testExpected("video.volume", 0);
+    testExpected("compareWithTolerance(video.volume, 0)", true);
     testDOMException("video.volume = 1.5", "DOMException.INDEX_SIZE_ERR");
     testDOMException("video.volume = -0.5", "DOMException.INDEX_SIZE_ERR");
     video.src = "" "content/test");
     run("video.load()");
     waitForEvent("canplaythrough", function () {
-        testExpected("video.volume", 0);
+        testExpected("compareWithTolerance(video.volume, 0)", true);
         run("video.volume = 0.5");
-        testExpected("video.volume", 0.5);
+        testExpected("compareWithTolerance(video.volume, 0.5)", true);
         testDOMException("video.volume = 1.5", "DOMException.INDEX_SIZE_ERR");
         testDOMException("video.volume = -0.5", "DOMException.INDEX_SIZE_ERR");
         endTest();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to