Changeset 190912 in webkit


Ignore:
Timestamp:
Oct 12, 2015 6:11:45 PM (8 years ago)
Author:
jonlee@apple.com
Message:

Add basic canvas tests
https://bugs.webkit.org/show_bug.cgi?id=150066
rdar://problem/23081143

Reviewed by Dean Jackson.

This adds a new test suite that will cover all of the path-based canvas calls.
The patch will be divided up to cover tests with similar techniques.

The simplest version uses a SimpleCanvasStage.

  • Animometer/runner/resources/tests.js: Add tests for quadratic, bezier, arcTo,

arc, and rect segments. Also include arcTo, arc, and rect fills.

  • Animometer/tests/resources/stage.js:

(Stage.prototype.randomBool): Added for counterclockwise property for arc segments.
(Stage.prototype.randomInt): Fix how values are rounded, used by randomBool. It should
round instead of flooring everything.

  • Animometer/tests/simple/resources/simple-canvas.js: Added. Defines common classes

used by all simple canvas tests. The page reads best bottom to top.
(SimpleCanvasStage): Basic stage. Pass a canvasObject which will be used to create new
objects as needed in tune().
(SimpleCanvasStage.prototype.tune): Modeled on other tests. Adds and removed objects
as specified by the provided |count|.
(SimpleCanvasStage.prototype.animate): Iterate over all the objects and ask them to draw.
There is no "animating" of the objects; they will just paint statically on the canvas.
(SimpleCanvasAnimator): Basic animator clears the canvas prior to painting.
(SimpleCanvasBenchmark): Hard-code the feedback loop parameters instead of including
them in the query parameters to the test URLs.
(SimpleCanvasBenchmark.prototype.createAnimator):

  • Animometer/tests/simple/simple-canvas-paths.html: Added.
  • Animometer/tests/simple/resources/simple-canvas-paths.js: Added. There is no "animating"

of these objects--they just paint statically on the canvas.
(CanvasQuadraticSegment): Paint a quadratic segment stroke.
(CanvasBezierSegment): Paint a bezier segment stroke.
(CanvasArcToSegment): Paint an arcTo stroke.
(CanvasArcSegment): Paint an arc stroke.
(CanvasRect): Paint a rect.
(CanvasRectFill): Paint a filled rect.

(CanvasPathBenchmark):
(CanvasPathBenchmark.prototype.createStage): Look for the pathType and create the
stage using the right paint object.
(window.benchmarkClient.create):

Location:
trunk/PerformanceTests
Files:
5 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/PerformanceTests/Animometer/runner/resources/tests.js

    r190903 r190912  
    137137));
    138138
     139Suites.push(new Suite("Basic canvas path suite",
     140    [
     141        {
     142            url: "simple/simple-canvas-paths.html?pathType=quadratic",
     143            name: "Canvas quadratic segments"
     144        },
     145        {
     146            url: "simple/simple-canvas-paths.html?pathType=bezier",
     147            name: "Canvas bezier segments"
     148        },
     149        {
     150            url: "simple/simple-canvas-paths.html?&pathType=arcTo",
     151            name: "Canvas arcTo segments"
     152        },
     153        {
     154            url: "simple/simple-canvas-paths.html?pathType=arc",
     155            name: "Canvas arc segments"
     156        },
     157        {
     158            url: "simple/simple-canvas-paths.html?pathType=rect",
     159            name: "Canvas rects"
     160        },
     161        {
     162            url: "simple/simple-canvas-paths.html?&pathType=arcToFill",
     163            name: "Canvas arcTo segments, fill"
     164        },
     165        {
     166            url: "simple/simple-canvas-paths.html?pathType=arcFill",
     167            name: "Canvas arc segments, fill"
     168        },
     169        {
     170            url: "simple/simple-canvas-paths.html?pathType=rectFill",
     171            name: "Canvas rects, fill"
     172        }
     173    ]
     174));
     175
    139176Suites.push(new Suite("Complex examples",
    140177    [
  • trunk/PerformanceTests/Animometer/tests/resources/stage.js

    r190575 r190912  
    5656    },
    5757   
     58    randomBool: function()
     59    {
     60        return !!Math.round(this.random(0, 1));
     61    },
     62
    5863    randomInt: function(min, max)
    5964    {
    60         return Math.floor(this.random(min, max));
     65        return Math.round(this.random(min, max));
    6166    },
    6267   
  • trunk/PerformanceTests/ChangeLog

    r190908 r190912  
     12015-10-12  Jon Lee  <jonlee@apple.com>
     2
     3        Add basic canvas tests
     4        https://bugs.webkit.org/show_bug.cgi?id=150066
     5        rdar://problem/23081143
     6
     7        Reviewed by Dean Jackson.
     8
     9        This adds a new test suite that will cover all of the path-based canvas calls.
     10        The patch will be divided up to cover tests with similar techniques.
     11
     12        The simplest version uses a SimpleCanvasStage.
     13
     14        * Animometer/runner/resources/tests.js: Add tests for quadratic, bezier, arcTo,
     15        arc, and rect segments. Also include arcTo, arc, and rect fills.
     16        * Animometer/tests/resources/stage.js:
     17        (Stage.prototype.randomBool): Added for counterclockwise property for arc segments.
     18        (Stage.prototype.randomInt): Fix how values are rounded, used by randomBool. It should
     19        round instead of flooring everything.
     20        * Animometer/tests/simple/resources/simple-canvas.js: Added. Defines common classes
     21        used by all simple canvas tests. The page reads best bottom to top.
     22        (SimpleCanvasStage): Basic stage. Pass a canvasObject which will be used to create new
     23        objects as needed in tune().
     24        (SimpleCanvasStage.prototype.tune): Modeled on other tests. Adds and removed objects
     25        as specified by the provided |count|.
     26        (SimpleCanvasStage.prototype.animate): Iterate over all the objects and ask them to draw.
     27        There is no "animating" of the objects; they will just paint statically on the canvas.
     28        (SimpleCanvasAnimator): Basic animator clears the canvas prior to painting.
     29        (SimpleCanvasBenchmark): Hard-code the feedback loop parameters instead of including
     30        them in the query parameters to the test URLs.
     31        (SimpleCanvasBenchmark.prototype.createAnimator):
     32        * Animometer/tests/simple/simple-canvas-paths.html: Added.
     33
     34        * Animometer/tests/simple/resources/simple-canvas-paths.js: Added. There is no "animating"
     35        of these objects--they just paint statically on the canvas.
     36        (CanvasQuadraticSegment): Paint a quadratic segment stroke.
     37        (CanvasBezierSegment): Paint a bezier segment stroke.
     38        (CanvasArcToSegment): Paint an arcTo stroke.
     39        (CanvasArcSegment): Paint an arc stroke.
     40        (CanvasRect): Paint a rect.
     41        (CanvasRectFill): Paint a filled rect.
     42
     43        (CanvasPathBenchmark):
     44        (CanvasPathBenchmark.prototype.createStage): Look for the pathType and create the
     45        stage using the right paint object.
     46        (window.benchmarkClient.create):
     47
    1482015-10-12  Jon Lee  <jonlee@apple.com>
    249
Note: See TracChangeset for help on using the changeset viewer.