Diff
Modified: trunk/LayoutTests/ChangeLog (258699 => 258700)
--- trunk/LayoutTests/ChangeLog 2020-03-19 15:24:52 UTC (rev 258699)
+++ trunk/LayoutTests/ChangeLog 2020-03-19 15:34:06 UTC (rev 258700)
@@ -1,3 +1,22 @@
+2020-03-19 Eric Carlson <[email protected]>
+
+ Allow for some tolerance when checking canvas pixels in fast/mediastream tests
+ https://bugs.webkit.org/show_bug.cgi?id=209259
+ <rdar://problem/60609789>
+
+ Reviewed by Youenn Fablet.
+
+ * fast/mediastream/MediaStream-video-element-displays-buffer.html:
+ * fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html:
+ * fast/mediastream/media-stream-renders-first-frame.html:
+ * fast/mediastream/resize-trim.html:
+ * resources/platform-helper.js:
+ (checkPixelColorWithTolerance):
+ (isPixelBlack):
+ (isPixelTransparent):
+ (isPixelWhite):
+ (isPixelGray):
+
2020-03-19 Antoine Quint <[email protected]>
onwebkit{animation, transition}XX handlers missing from Document
Modified: trunk/LayoutTests/fast/mediastream/MediaStream-video-element-displays-buffer.html (258699 => 258700)
--- trunk/LayoutTests/fast/mediastream/MediaStream-video-element-displays-buffer.html 2020-03-19 15:24:52 UTC (rev 258699)
+++ trunk/LayoutTests/fast/mediastream/MediaStream-video-element-displays-buffer.html 2020-03-19 15:34:06 UTC (rev 258700)
@@ -2,6 +2,7 @@
<html>
<head>
<script src=""
+ <script src=""
</head>
<body _onload_="start()">
<p id="description"></p>
@@ -15,21 +16,6 @@
let buffer;
let currentTest = 0;
- function isPixelTransparent(pixel)
- {
- return pixel[0] === 0 && pixel[1] === 0 && pixel[2] === 0 && pixel[3] === 0;
- }
-
- function isPixelBlack(pixel)
- {
- return pixel[0] === 0 && pixel[1] === 0 && pixel[2] === 0 && pixel[3] === 255;
- }
-
- function isPixelGray(pixel)
- {
- return pixel[0] === 128 && pixel[1] === 128 && pixel[2] === 128 && pixel[3] === 255;
- }
-
function checkPixels(x, y, test, expectedToBeTrue)
{
buffer = context.getImageData(x, y, 1, 1).data;
Modified: trunk/LayoutTests/fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html (258699 => 258700)
--- trunk/LayoutTests/fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html 2020-03-19 15:24:52 UTC (rev 258699)
+++ trunk/LayoutTests/fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html 2020-03-19 15:34:06 UTC (rev 258700)
@@ -2,6 +2,7 @@
<html>
<head>
<script src=""
+ <script src=""
</head>
<body _onload_="start()">
<p id="description"></p>
@@ -28,21 +29,6 @@
}, 30000);
}
- function isPixelBlack(pixel)
- {
- return pixel[0] === 0 && pixel[1] === 0 && pixel[2] === 0 && pixel[3] === 255;
- }
-
- function isPixelTransparent(pixel)
- {
- return pixel[0] === 0 && pixel[1] === 0 && pixel[2] === 0 && pixel[3] === 0;
- }
-
- function isPixelWhite(pixel)
- {
- return pixel[0] === 255 && pixel[1] === 255 && pixel[2] === 255 && pixel[3] === 255;
- }
-
function canvasShouldBeBlack()
{
return !mediaStream.getVideoTracks()[0].enabled;
Modified: trunk/LayoutTests/fast/mediastream/media-stream-renders-first-frame.html (258699 => 258700)
--- trunk/LayoutTests/fast/mediastream/media-stream-renders-first-frame.html 2020-03-19 15:24:52 UTC (rev 258699)
+++ trunk/LayoutTests/fast/mediastream/media-stream-renders-first-frame.html 2020-03-19 15:34:06 UTC (rev 258700)
@@ -5,16 +5,12 @@
<canvas id="canvas" width=640px height=480px></canvas>
<script src=""
<script src=""
+ <script src=""
<script>
const canvas = document.getElementById("canvas");
const video = document.getElementById("video");
-function isPixelBlack(pixel)
-{
- return pixel[0] === 0 && pixel[1] === 0 && pixel[2] === 0 && pixel[3] === 255;
-}
-
function logPixel(name, pixel)
{
console.log(`${name}: ${pixel[0]}, ${pixel[1]}, ${pixel[2]}, ${pixel[3]}`);
Modified: trunk/LayoutTests/fast/mediastream/resize-trim.html (258699 => 258700)
--- trunk/LayoutTests/fast/mediastream/resize-trim.html 2020-03-19 15:24:52 UTC (rev 258699)
+++ trunk/LayoutTests/fast/mediastream/resize-trim.html 2020-03-19 15:34:06 UTC (rev 258700)
@@ -3,15 +3,11 @@
<head>
<video id="video" autoplay width=480px height=480px controls ></video>
<canvas id="canvas" width=480px height=480px></canvas>
+ <script src=""
<script src=""
<script src=""
<script>
-function isPixelGray(pixel)
-{
- return pixel[0] === 128 && pixel[1] === 128 && pixel[2] === 128 && pixel[3] === 255;
-}
-
promise_test(async () => {
let stream = await navigator.mediaDevices.getUserMedia({ video: true });
stream = null;
Modified: trunk/LayoutTests/resources/platform-helper.js (258699 => 258700)
--- trunk/LayoutTests/resources/platform-helper.js 2020-03-19 15:24:52 UTC (rev 258699)
+++ trunk/LayoutTests/resources/platform-helper.js 2020-03-19 15:34:06 UTC (rev 258700)
@@ -15,3 +15,32 @@
return 2;
}
+
+function checkPixelColorWithTolerance(pixel, r, g, b, a)
+{
+ const tolerance = videoCanvasPixelComparisonTolerance();
+ return Math.abs(pixel[0] - r) < tolerance
+ && Math.abs(pixel[1] - g) < tolerance
+ && Math.abs(pixel[2] - b) < tolerance
+ && Math.abs(pixel[3] - a) < tolerance;
+}
+
+function isPixelBlack(pixel)
+{
+ return checkPixelColorWithTolerance(pixel, 0, 0, 0, 255);
+}
+
+function isPixelTransparent(pixel)
+{
+ return checkPixelColorWithTolerance(pixel, 0, 0, 0, 0);
+}
+
+function isPixelWhite(pixel)
+{
+ return checkPixelColorWithTolerance(pixel, 255, 255, 255, 255);
+}
+
+function isPixelGray(pixel)
+{
+ return checkPixelColorWithTolerance(pixel, 128, 128, 128, 255);
+}