<!DOCTYPE html>
<html>
<head>
    <script src="../../resources/js-test-pre.js"></script>
    <script src="../../media/media-file.js"></script>
    <script src="../../media/utilities.js"></script>
    <script src="../../resources/platform-helper.js"></script>
</head>
<body>
<script>
    description("Tests that modifying the video used in createPattern does not affect the pattern rendered.");

    var buffer;
    var canvas, context;
    var expectedResults = [
        // Each entry is formatted as [x, y, r, g, b].
        [40, 165, 200, 200, 0], // Represents yellow north west tile.
        [355, 165, 200, 200, 0], // Represents yellow north east tile.
        [40, 403, 200, 200, 0], // Represents yellow south west tile.
        [355, 403, 200, 200, 0], // Represents yellow south east tile.
    ];

    var video = document.createElement("video");

    waitForVideoFrame(video, firstframe);
    video.src = findMediaFile("video", "../../media/content/test");

    async function firstframe()
    {
        canvas = document.createElement("canvas");
        canvas.width = 2.5 * video.videoWidth;
        canvas.height = 2.5 * video.videoHeight;
        document.body.appendChild(canvas);

        context = canvas.getContext("2d");
        context.fillStyle = context.createPattern(video, "repeat");

        video.src = findMediaFile("video", "../../media/content/counting");

        await waitForVideoFrame(video);

        context.fillRect(0, 0, canvas.width, canvas.height);
        expectedResults.forEach(function(element) {
            checkPixels(context, element[0], element[1], element[2], element[3], element[4], videoCanvasPixelComparisonTolerance());
        });

        finishJSTest();
    }

    function checkPixels(context, x, y, r, g, b, tolerance)
    {
        buffer = context.getImageData(x, y, 1, 1).data;
        shouldBeCloseTo("buffer[0]", r, tolerance);
        shouldBeCloseTo("buffer[1]", g, tolerance);
        shouldBeCloseTo("buffer[2]", b, tolerance);
    }

    window.jsTestIsAsync = true;
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
