# Copyright (c) 2010 Philip Taylor # Released under the BSD license and W3C Test Suite License: see LICENSE.txt framed: | Canvas test: %(name)s %(fonts)s

%(name_wrapped)s

[show output] %(fonthack)s

Actual output:

%(fallback)s %(expected)s %(images)s standalone: | Canvas test: %(name)s %(fonts)s

< [index] >

%(backrefs)s

%(desc)s

References:
%(notes)s %(fonthack)s

Actual output:

%(fallback)s %(expected)s %(images)s minimal: | Canvas test: %(name)s %(fonts)s

Pass

Fail

%(fonthack)s

These images should be identical:

%(fallback)s %(expected)s %(images)s w3c: | Canvas test: %(name)s %(fonts)s

%(name)s

%(desc)s

%(notes)s %(fonthack)s

Actual output:

%(fallback)s %(expected)s %(scripts)s%(images)s mochitest: | %(mochi_name_fn)s %(mochi_desc)s %(fonts)s

Canvas test: %(mochi_name)s

%(mochi_desc)s%(fonthack)s%(fallback)s %(mochi_images)s mochitest.isPixel: | function isPixel(ctx, x,y, r,g,b,a, pos, colour, d) { var pixel = ctx.getImageData(x, y, 1, 1); var pr = pixel.data[0], pg = pixel.data[1], pb = pixel.data[2], pa = pixel.data[3]; ok(r-d <= pr && pr <= r+d && g-d <= pg && pg <= g+d && b-d <= pb && pb <= b+d && a-d <= pa && pa <= a+d, "pixel "+pos+" is "+pr+","+pg+","+pb+","+pa+"; expected "+colour+" +/- "+d); } mochitest.todo_isPixel: | function todo_isPixel(ctx, x,y, r,g,b,a, pos, colour, d) { var pixel = ctx.getImageData(x, y, 1, 1); var pr = pixel.data[0], pg = pixel.data[1], pb = pixel.data[2], pa = pixel.data[3]; todo(r-d <= pr && pr <= r+d && g-d <= pg && pg <= g+d && b-d <= pb && pb <= b+d && a-d <= pa && pa <= a+d, "pixel "+pos+" is "+pr+","+pg+","+pb+","+pa+"; expected "+colour+" +/- "+d); } mochitest.deferTest: | function deferTest() { _deferred = true; } mochitest.wrapFunction: | function wrapFunction(f) { return function () { f.apply(null, arguments); SimpleTest.finish(); } } mochitest.exception: | var _thrown_outer = false; try { %s } catch (e) { _thrown_outer = true; } todo(!_thrown_outer, 'should not throw exception'); mochitest.Makefile: | # # ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Mozilla Corporation. # Portions created by the Initial Developer are Copyright (C) 2007 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Philip Taylor # # Alternatively, the contents of this file may be used under the terms of # either of the GNU General Public License Version 2 or later (the "GPL"), # or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ***** END LICENSE BLOCK ***** DEPTH = ../../.. topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ relativesrcdir = content/canvas/test include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk index.frame: | Canvas tests - %(category)s.*

[index]

%(backrefs)s.*

# FF trunk doesn't do onload in object, so use iframe instead #index.frame.item: |- # (object fallback) index.frame.item: |- index.w3c.frame: | Canvas tests - %(category)s.*

[index]

%(backrefs)s.*

index.w3c.frame.item: |- index: | Canvas tests - index

<canvas> tests

Developed by Philip Taylor. Last updated %(updated)s.

Based on the HTML Draft Standard — 22 February 2010. See also the annotated specification.

See test results for some browsers. (Generated semi-automatically via the report generator.)

You may want to download the source code/data (e.g. to create an offline copy of the tests).

Test cases

For each test, a green background indicates success, red indicates failure, blue indicates a need to manually confirm the output is as expected.

The versions in the report generator are the most visually minimalist. The category links below show the actual and expected renderings, and any error messages. The individual test pages have links to relevant parts of the specification and extra notes.

There may be many inaccuracies: tests that do not notice when part of the output is incorrect; tests that are too intolerant of acceptable renderings differences, or make other unreasonable assumptions; tests that were written for an outdated version of the specification, and tests that are just wrong. Also a number of features are not tested, most notably text rendering. Please contact me (email, IRC, etc) if you find any problems. index.w3c: | Canvas tests - index

<canvas> tests

index.category.item: |
  • %s.*

    %d test%s expand

    index.w3c.category.item: |
  • %s.*

    %d test%s

    reportgen: | Canvas tests - report generator

    This is mainly for my own use, so it is not designed to be user-friendly. If anyone else wants to use it for some reason, just wait until "tests not yet loaded" and "tests not yet completed" get down to zero, then click the pass/fail button for any test it shows where it cannot work out the answer (or use the y/n keys to choose for the magenta-highlighted case), then use the buttons at the bottom to collect all the results.



    Test name Test case Pass? Fail? Notes



    (Submissions will tend to be ignored unless there is a good reason why they won't be, so don't use this form unless there is such a reason.)
    results: | Canvas tests - results
    Test