mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-28 03:18:41 +00:00
b=446534, Update canvas mochitests, code from Philip Taylor, patch by Eric Butler; r=vlad
This commit is contained in:
parent
4a312173f9
commit
b2fa66f6d4
@ -44,8 +44,7 @@ relativesrcdir = content/canvas/test
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TEST_FILES_A = \
|
||||
_TEST_FILES_0 = \
|
||||
test_fallback.basic.html \
|
||||
test_fallback.multiple.html \
|
||||
test_fallback.nested.html \
|
||||
@ -87,11 +86,26 @@ _TEST_FILES_A = \
|
||||
test_initial.reset.transform.html \
|
||||
test_initial.reset.gradient.html \
|
||||
test_initial.reset.pattern.html \
|
||||
test_context.emptystring.html \
|
||||
test_context.unrecognised.badname.html \
|
||||
test_context.unrecognised.badsuffix.html \
|
||||
test_context.unrecognised.nullsuffix.html \
|
||||
test_context.unrecognised.unicode.html \
|
||||
test_context.casesensitive.html \
|
||||
test_context.arguments.missing.html \
|
||||
test_context.arguments.extra.html \
|
||||
test_toDataURL.default.html \
|
||||
test_toDataURL.png.html \
|
||||
test_toDataURL.unrecognised.html \
|
||||
test_toDataURL.lowercase.html \
|
||||
test_toDataURL.arguments.1.html \
|
||||
test_toDataURL.arguments.2.html \
|
||||
test_toDataURL.arguments.3.html \
|
||||
test_toDataURL.nocontext.html \
|
||||
test_toDataURL.zerosize.html \
|
||||
test_toDataURL.primarycolours.html \
|
||||
test_toDataURL.complexcolours.html \
|
||||
test_2d.getcontext.exists.html \
|
||||
test_2d.type.name.html \
|
||||
test_2d.type.exists.html \
|
||||
test_2d.type.delete.html \
|
||||
test_2d.type.prototype.html \
|
||||
@ -100,6 +114,8 @@ _TEST_FILES_A = \
|
||||
test_2d.getcontext.unique.html \
|
||||
test_2d.getcontext.shared.html \
|
||||
test_2d.voidreturn.html \
|
||||
test_2d.missingargs.html \
|
||||
test_2d.scaled.html \
|
||||
test_2d.canvas.reference.html \
|
||||
test_2d.canvas.readonly.html \
|
||||
test_2d.state.saverestore.strokeStyle.html \
|
||||
@ -121,39 +137,40 @@ _TEST_FILES_A = \
|
||||
test_2d.state.saverestore.bitmap.html \
|
||||
test_2d.state.saverestore.stack.html \
|
||||
test_2d.state.saverestore.stackdepth.html \
|
||||
test_2d.state.saverestore.underflow.html \
|
||||
test_2d.transformation.order.html \
|
||||
test_2d.transformation.scale.basic.html \
|
||||
test_2d.transformation.scale.zero.html \
|
||||
test_2d.transformation.scale.negative.html \
|
||||
test_2d.transformation.scale.large.html \
|
||||
test_2d.transformation.scale.nonfinite.html \
|
||||
test_2d.transformation.scale.multiple.html \
|
||||
$(NULL)
|
||||
|
||||
_TEST_FILES_1 = \
|
||||
test_2d.transformation.rotate.zero.html \
|
||||
test_2d.transformation.rotate.radians.html \
|
||||
test_2d.transformation.rotate.direction.html \
|
||||
test_2d.transformation.rotate.wrap.html \
|
||||
test_2d.transformation.rotate.wrapnegative.html \
|
||||
test_2d.transformation.rotate.infinity.html \
|
||||
test_2d.transformation.rotate.neginfinity.html \
|
||||
test_2d.transformation.rotate.nan.html \
|
||||
test_2d.transformation.rotate.nonfinite.html \
|
||||
test_2d.transformation.translate.basic.html \
|
||||
test_2d.transformation.translate.nonfinite.html \
|
||||
test_2d.transformation.transform.identity.html \
|
||||
test_2d.transformation.transform.skewed.html \
|
||||
test_2d.transformation.transform.multiply.html \
|
||||
test_2d.transformation.transform.nonfinite.html \
|
||||
test_2d.transformation.setTransform.skewed.html \
|
||||
test_2d.transformation.setTransform.multiple.html \
|
||||
test_2d.transformation.setTransform.nonfinite.html \
|
||||
test_2d.composite.globalAlpha.range.html \
|
||||
test_2d.composite.globalAlpha.invalid.html \
|
||||
test_2d.composite.globalAlpha.default.html \
|
||||
test_2d.composite.globalAlpha.fill.html \
|
||||
test_2d.composite.globalAlpha.image.html \
|
||||
test_2d.composite.globalAlpha.canvas.html \
|
||||
test_2d.composite.globalAlpha.imagepattern.html \
|
||||
test_2d.composite.globalAlpha.canvaspattern.html \
|
||||
$(NULL)
|
||||
# The following two tests tend to fail randomly.
|
||||
# test_toDataURL.primarycolours.html
|
||||
# test_toDataURL.complexcolours.html
|
||||
|
||||
_TEST_FILES_B = \
|
||||
test_2d.composite.solid.source-over.html \
|
||||
test_2d.composite.solid.destination-over.html \
|
||||
test_2d.composite.solid.source-in.html \
|
||||
@ -162,6 +179,7 @@ _TEST_FILES_B = \
|
||||
test_2d.composite.solid.destination-out.html \
|
||||
test_2d.composite.solid.source-atop.html \
|
||||
test_2d.composite.solid.destination-atop.html \
|
||||
test_2d.composite.solid.xor.html \
|
||||
test_2d.composite.solid.copy.html \
|
||||
test_2d.composite.solid.lighter.html \
|
||||
test_2d.composite.transparent.source-over.html \
|
||||
@ -176,20 +194,56 @@ _TEST_FILES_B = \
|
||||
test_2d.composite.transparent.copy.html \
|
||||
test_2d.composite.transparent.lighter.html \
|
||||
test_2d.composite.image.source-over.html \
|
||||
test_2d.composite.image.source-in.html \
|
||||
test_2d.composite.image.source-out.html \
|
||||
test_2d.composite.image.source-atop.html \
|
||||
test_2d.composite.image.destination-over.html \
|
||||
test_2d.composite.image.source-in.html \
|
||||
test_2d.composite.image.destination-in.html \
|
||||
test_2d.composite.image.source-out.html \
|
||||
test_2d.composite.image.destination-out.html \
|
||||
test_2d.composite.image.source-atop.html \
|
||||
test_2d.composite.image.destination-atop.html \
|
||||
test_2d.composite.image.xor.html \
|
||||
test_2d.composite.image.copy.html \
|
||||
test_2d.composite.image.lighter.html \
|
||||
test_2d.composite.canvas.source-over.html \
|
||||
test_2d.composite.canvas.destination-over.html \
|
||||
test_2d.composite.canvas.source-in.html \
|
||||
test_2d.composite.canvas.destination-in.html \
|
||||
test_2d.composite.canvas.source-out.html \
|
||||
test_2d.composite.canvas.destination-out.html \
|
||||
test_2d.composite.canvas.source-atop.html \
|
||||
test_2d.composite.canvas.destination-atop.html \
|
||||
test_2d.composite.canvas.xor.html \
|
||||
test_2d.composite.canvas.copy.html \
|
||||
test_2d.composite.canvas.lighter.html \
|
||||
test_2d.composite.uncovered.fill.copy.html \
|
||||
test_2d.composite.uncovered.image.source-in.html \
|
||||
test_2d.composite.uncovered.image.destination-in.html \
|
||||
test_2d.composite.uncovered.image.source-out.html \
|
||||
test_2d.composite.uncovered.image.destination-atop.html \
|
||||
test_2d.composite.uncovered.image.copy.html \
|
||||
test_2d.composite.uncovered.pattern.copy.html \
|
||||
test_2d.composite.clip.source-over.html \
|
||||
test_2d.composite.clip.destination-over.html \
|
||||
test_2d.composite.clip.source-in.html \
|
||||
test_2d.composite.clip.destination-in.html \
|
||||
test_2d.composite.clip.source-out.html \
|
||||
test_2d.composite.clip.destination-out.html \
|
||||
test_2d.composite.clip.source-atop.html \
|
||||
test_2d.composite.clip.destination-atop.html \
|
||||
test_2d.composite.clip.xor.html \
|
||||
test_2d.composite.clip.copy.html \
|
||||
test_2d.composite.clip.lighter.html \
|
||||
test_2d.composite.operation.get.html \
|
||||
test_2d.composite.operation.unrecognised.html \
|
||||
test_2d.composite.operation.darker.html \
|
||||
test_2d.composite.operation.over.html \
|
||||
test_2d.composite.operation.clear.html \
|
||||
test_2d.composite.operation.highlight.html \
|
||||
test_2d.composite.operation.nullsuffix.html \
|
||||
$(NULL)
|
||||
|
||||
_TEST_FILES_2 = \
|
||||
test_2d.composite.operation.casesensitive.html \
|
||||
test_2d.composite.operation.default.html \
|
||||
test_2d.fillStyle.parse.html4.html \
|
||||
test_2d.fillStyle.parse.hex3.html \
|
||||
@ -197,6 +251,9 @@ _TEST_FILES_B = \
|
||||
test_2d.fillStyle.parse.rgb-num.html \
|
||||
test_2d.fillStyle.parse.rgb-clamp-1.html \
|
||||
test_2d.fillStyle.parse.rgb-clamp-2.html \
|
||||
test_2d.fillStyle.parse.rgb-clamp-3.html \
|
||||
test_2d.fillStyle.parse.rgb-clamp-4.html \
|
||||
test_2d.fillStyle.parse.rgb-clamp-5.html \
|
||||
test_2d.fillStyle.parse.rgb-percent.html \
|
||||
test_2d.fillStyle.parse.rgba-solid-1.html \
|
||||
test_2d.fillStyle.parse.rgba-solid-2.html \
|
||||
@ -212,8 +269,18 @@ _TEST_FILES_B = \
|
||||
test_2d.fillStyle.parse.hsl-3.html \
|
||||
test_2d.fillStyle.parse.hsl-4.html \
|
||||
test_2d.fillStyle.parse.hsl-5.html \
|
||||
test_2d.fillStyle.parse.hsl-clamp-1.html \
|
||||
test_2d.fillStyle.parse.hsl-clamp-2.html \
|
||||
test_2d.fillStyle.parse.hsl-clamp-3.html \
|
||||
test_2d.fillStyle.parse.hsl-clamp-4.html \
|
||||
test_2d.fillStyle.parse.hsla-1.html \
|
||||
test_2d.fillStyle.parse.hsla-2.html \
|
||||
test_2d.fillStyle.parse.hsla-clamp-1.html \
|
||||
test_2d.fillStyle.parse.hsla-clamp-2.html \
|
||||
test_2d.fillStyle.parse.hsla-clamp-3.html \
|
||||
test_2d.fillStyle.parse.hsla-clamp-4.html \
|
||||
test_2d.fillStyle.parse.hsla-clamp-5.html \
|
||||
test_2d.fillStyle.parse.hsla-clamp-6.html \
|
||||
test_2d.fillStyle.parse.svg-1.html \
|
||||
test_2d.fillStyle.parse.svg-2.html \
|
||||
test_2d.fillStyle.parse.invalid.hex3.html \
|
||||
@ -222,6 +289,9 @@ _TEST_FILES_B = \
|
||||
test_2d.fillStyle.parse.invalid.rgb-2.html \
|
||||
test_2d.fillStyle.parse.invalid.rgb-3.html \
|
||||
test_2d.fillStyle.parse.invalid.rgb-4.html \
|
||||
test_2d.fillStyle.parse.invalid.rgb-5.html \
|
||||
test_2d.fillStyle.parse.invalid.rgb-6.html \
|
||||
test_2d.fillStyle.parse.invalid.rgb-7.html \
|
||||
test_2d.fillStyle.parse.invalid.rgba-1.html \
|
||||
test_2d.fillStyle.parse.invalid.rgba-2.html \
|
||||
test_2d.fillStyle.parse.invalid.rgba-3.html \
|
||||
@ -231,8 +301,13 @@ _TEST_FILES_B = \
|
||||
test_2d.fillStyle.parse.invalid.hsl-2.html \
|
||||
test_2d.fillStyle.parse.invalid.hsl-3.html \
|
||||
test_2d.fillStyle.parse.invalid.hsl-4.html \
|
||||
test_2d.fillStyle.parse.invalid.hsl-5.html \
|
||||
test_2d.fillStyle.parse.invalid.hsla-1.html \
|
||||
test_2d.fillStyle.parse.invalid.hsla-2.html \
|
||||
test_2d.fillStyle.parse.system.html \
|
||||
test_2d.fillStyle.parse.flavor.html \
|
||||
test_2d.fillStyle.parse.current.basic.html \
|
||||
test_2d.fillStyle.parse.current.changed.html \
|
||||
test_2d.fillStyle.parse.current.removed.html \
|
||||
test_2d.fillStyle.invalidstring.html \
|
||||
test_2d.fillStyle.invalidtype.html \
|
||||
test_2d.fillStyle.get.solid.html \
|
||||
@ -240,6 +315,7 @@ _TEST_FILES_B = \
|
||||
test_2d.fillStyle.get.transparent.html \
|
||||
test_2d.fillStyle.default.html \
|
||||
test_2d.strokeStyle.default.html \
|
||||
test_2d.gradient.object.type.html \
|
||||
test_2d.gradient.object.return.html \
|
||||
test_2d.gradient.interpolate.solid.html \
|
||||
test_2d.gradient.interpolate.colour.html \
|
||||
@ -251,27 +327,32 @@ _TEST_FILES_B = \
|
||||
test_2d.gradient.interpolate.multiple.html \
|
||||
test_2d.gradient.interpolate.overlap.html \
|
||||
test_2d.gradient.interpolate.overlap2.html \
|
||||
test_2d.gradient.empty.html \
|
||||
test_2d.gradient.object.update.html \
|
||||
test_2d.gradient.object.compare.html \
|
||||
test_2d.gradient.object.crosscanvas.html \
|
||||
test_2d.gradient.object.invalidoffset.html \
|
||||
test_2d.gradient.object.invalidcolour.html \
|
||||
test_2d.gradient.linear.nonfinite.html \
|
||||
test_2d.gradient.linear.transform.1.html \
|
||||
test_2d.gradient.linear.transform.2.html \
|
||||
test_2d.gradient.linear.transform.3.html \
|
||||
test_2d.gradient.radial.negative.html \
|
||||
test_2d.gradient.radial.nonfinite.html \
|
||||
test_2d.gradient.radial.inside1.html \
|
||||
$(NULL)
|
||||
|
||||
_TEST_FILES_C = \
|
||||
test_2d.gradient.radial.negative.html \
|
||||
test_2d.gradient.radial.invalid.html \
|
||||
test_2d.gradient.radial.inside1.html \
|
||||
test_2d.gradient.radial.inside2.html \
|
||||
test_2d.gradient.radial.outside1.html \
|
||||
test_2d.gradient.radial.cone.front.html \
|
||||
_TEST_FILES_3 = \
|
||||
test_2d.gradient.radial.cone.bottom.html \
|
||||
test_2d.gradient.radial.cone.top.html \
|
||||
test_2d.gradient.radial.cone.cylinder.html \
|
||||
test_2d.gradient.radial.cone.shape1.html \
|
||||
test_2d.gradient.radial.transform.1.html \
|
||||
test_2d.gradient.radial.transform.2.html \
|
||||
test_2d.gradient.radial.transform.3.html \
|
||||
test_2d.pattern.basic.type.html \
|
||||
test_2d.pattern.basic.image.html \
|
||||
test_2d.pattern.basic.canvas.html \
|
||||
test_2d.pattern.basic.zerocanvas.html \
|
||||
test_2d.pattern.basic.nocontext.html \
|
||||
test_2d.pattern.image.undefined.html \
|
||||
test_2d.pattern.image.null.html \
|
||||
@ -281,7 +362,6 @@ _TEST_FILES_C = \
|
||||
test_2d.pattern.repeat.empty.html \
|
||||
test_2d.pattern.repeat.null.html \
|
||||
test_2d.pattern.repeat.undefined.html \
|
||||
test_2d.pattern.repeat.missing.html \
|
||||
test_2d.pattern.repeat.unrecognised.html \
|
||||
test_2d.pattern.repeat.case.html \
|
||||
test_2d.pattern.repeat.nullsuffix.html \
|
||||
@ -294,7 +374,7 @@ _TEST_FILES_C = \
|
||||
test_2d.pattern.paint.norepeat.outside.html \
|
||||
test_2d.pattern.paint.norepeat.coord1.html \
|
||||
test_2d.pattern.paint.norepeat.coord2.html \
|
||||
test_2d.pattern.paint.coord3.html \
|
||||
test_2d.pattern.paint.norepeat.coord3.html \
|
||||
test_2d.pattern.paint.repeat.basic.html \
|
||||
test_2d.pattern.paint.repeat.outside.html \
|
||||
test_2d.pattern.paint.repeat.coord1.html \
|
||||
@ -306,77 +386,106 @@ _TEST_FILES_C = \
|
||||
test_2d.pattern.paint.repeaty.basic.html \
|
||||
test_2d.pattern.paint.repeaty.outside.html \
|
||||
test_2d.pattern.paint.repeaty.coord1.html \
|
||||
test_2d.pattern.paint.orientation.image.html \
|
||||
test_2d.pattern.paint.orientation.canvas.html \
|
||||
test_2d.pattern.animated.gif.html \
|
||||
test_2d.line.defaults.html \
|
||||
test_2d.line.invalid.lineWidth.html \
|
||||
test_2d.line.invalid.miterLimit.html \
|
||||
test_2d.line.lineWidth.basic.html \
|
||||
test_2d.line.lineWidth.transformed.html \
|
||||
test_2d.line.lineCap.butt.html \
|
||||
test_2d.line.lineCap.round.html \
|
||||
test_2d.line.lineCap.square.html \
|
||||
test_2d.line.lineJoin.bevel.html \
|
||||
test_2d.line.lineJoin.round.html \
|
||||
test_2d.line.lineJoin.miter.html \
|
||||
test_2d.line.width.basic.html \
|
||||
test_2d.line.width.transformed.html \
|
||||
test_2d.line.width.invalid.html \
|
||||
test_2d.line.cap.butt.html \
|
||||
test_2d.line.cap.round.html \
|
||||
test_2d.line.cap.square.html \
|
||||
test_2d.line.cap.open.html \
|
||||
test_2d.line.cap.invalid.html \
|
||||
test_2d.line.join.bevel.html \
|
||||
test_2d.line.join.round.html \
|
||||
test_2d.line.join.miter.html \
|
||||
test_2d.line.join.open.html \
|
||||
test_2d.line.join.closed.html \
|
||||
test_2d.line.join.zeroline.join.html \
|
||||
test_2d.line.cap.open.html \
|
||||
test_2d.line.cap.zeroline.round.html \
|
||||
test_2d.line.cap.zeroline.square.html \
|
||||
test_2d.line.join.invalid.html \
|
||||
test_2d.line.miter.exceeded.html \
|
||||
test_2d.line.miter.acute.html \
|
||||
test_2d.line.miter.obtuse.html \
|
||||
test_2d.line.miter.rightangle.html \
|
||||
test_2d.line.miter.lineedge.html \
|
||||
test_2d.line.miter.within.html \
|
||||
test_2d.line.miter.invalid.html \
|
||||
test_2d.line.cross.html \
|
||||
test_2d.line.union.html \
|
||||
test_2d.clearRect.basic.html \
|
||||
test_2d.clearRect.path.html \
|
||||
test_2d.clearRect.zero.html \
|
||||
test_2d.clearRect.negative.html \
|
||||
test_2d.clearRect.transform.html \
|
||||
test_2d.clearRect.globalalpha.html \
|
||||
test_2d.clearRect.globalcomposite.html \
|
||||
test_2d.clearRect.clip.html \
|
||||
test_2d.clearRect.shadow.html \
|
||||
test_2d.fillRect.negative.html \
|
||||
test_2d.clearRect.nonfinite.html \
|
||||
test_2d.fillRect.basic.html \
|
||||
test_2d.fillRect.path.html \
|
||||
test_2d.fillRect.zero.html \
|
||||
test_2d.fillRect.negative.html \
|
||||
test_2d.fillRect.transform.html \
|
||||
test_2d.fillRect.clip.html \
|
||||
test_2d.fillRect.shadow.html \
|
||||
test_2d.strokeRect.negative.html \
|
||||
$(NULL)
|
||||
|
||||
_TEST_FILES_4 = \
|
||||
test_2d.fillRect.nonfinite.html \
|
||||
test_2d.strokeRect.basic.html \
|
||||
test_2d.strokeRect.path.html \
|
||||
test_2d.strokeRect.zero.1.html \
|
||||
test_2d.strokeRect.zero.2.html \
|
||||
test_2d.strokeRect.zero.3.html \
|
||||
test_2d.strokeRect.zero.4.html \
|
||||
test_2d.strokeRect.negative.html \
|
||||
test_2d.strokeRect.transform.html \
|
||||
test_2d.strokeRect.globalalpha.html \
|
||||
test_2d.strokeRect.globalcomposite.html \
|
||||
test_2d.strokeRect.clip.html \
|
||||
test_2d.strokeRect.shadow.html \
|
||||
$(NULL)
|
||||
|
||||
_TEST_FILES_D = \
|
||||
test_2d.strokeRect.nonfinite.html \
|
||||
test_2d.path.initial.html \
|
||||
test_2d.path.beginPath.html \
|
||||
test_2d.path.moveTo.basic.html \
|
||||
test_2d.path.moveTo.newsubpath.html \
|
||||
test_2d.path.moveTo.multiple.html \
|
||||
test_2d.path.moveTo.nonfinite.html \
|
||||
test_2d.path.closePath.empty.html \
|
||||
test_2d.path.closePath.newline.html \
|
||||
test_2d.path.closePath.nextpoint.html \
|
||||
test_2d.path.lineTo.emptysubpath.html \
|
||||
test_2d.path.lineTo.basic.html \
|
||||
test_2d.path.lineTo.nextpoint.html \
|
||||
test_2d.path.lineTo.nonfinite.html \
|
||||
test_2d.path.quadraticCurveTo.emptysubpath.html \
|
||||
test_2d.path.quadraticCurveTo.basic.html \
|
||||
test_2d.path.quadraticCurveTo.shape.html \
|
||||
test_2d.path.quadraticCurveTo.scaled.html \
|
||||
test_2d.path.quadraticCurveTo.nonfinite.html \
|
||||
test_2d.path.bezierCurveTo.emptysubpath.html \
|
||||
test_2d.path.bezierCurveTo.basic.html \
|
||||
test_2d.path.bezierCurveTo.shape.html \
|
||||
test_2d.path.bezierCurveTo.scaled.html \
|
||||
test_2d.path.bezierCurveTo.nonfinite.html \
|
||||
test_2d.path.arcTo.emptysubpath.html \
|
||||
test_2d.path.arcTo.coincide.1.html \
|
||||
test_2d.path.arcTo.coincide.2.html \
|
||||
test_2d.path.arcTo.collinear.1.html \
|
||||
test_2d.path.arcTo.collinear.2.html \
|
||||
test_2d.path.arcTo.collinear.3.html \
|
||||
test_2d.path.arcTo.shape.curve1.html \
|
||||
test_2d.path.arcTo.shape.curve2.html \
|
||||
test_2d.path.arcTo.shape.start.html \
|
||||
test_2d.path.arcTo.shape.end.html \
|
||||
test_2d.path.arcTo.negative.html \
|
||||
test_2d.path.arcTo.zero.1.html \
|
||||
test_2d.path.arcTo.zero.2.html \
|
||||
test_2d.path.arcTo.transformation.html \
|
||||
test_2d.path.arcTo.scale.html \
|
||||
test_2d.path.arcTo.nonfinite.html \
|
||||
test_2d.path.arc.empty.html \
|
||||
test_2d.path.arc.nonempty.html \
|
||||
test_2d.path.arc.end.html \
|
||||
@ -384,21 +493,25 @@ _TEST_FILES_D = \
|
||||
test_2d.path.arc.angle.2.html \
|
||||
test_2d.path.arc.angle.3.html \
|
||||
test_2d.path.arc.angle.4.html \
|
||||
test_2d.path.arc.angle.5.html \
|
||||
test_2d.path.arc.angle.6.html \
|
||||
test_2d.path.arc.zero.1.html \
|
||||
test_2d.path.arc.zero.2.html \
|
||||
test_2d.path.arc.zero.3.html \
|
||||
test_2d.path.arc.zero.4.html \
|
||||
test_2d.path.arc.zero.5.html \
|
||||
test_2d.path.arc.zero.6.html \
|
||||
test_2d.path.arc.twopie.1.html \
|
||||
test_2d.path.arc.twopie.2.html \
|
||||
test_2d.path.arc.twopie.3.html \
|
||||
test_2d.path.arc.twopie.4.html \
|
||||
test_2d.path.arc.shape.1.html \
|
||||
test_2d.path.arc.shape.2.html \
|
||||
test_2d.path.arc.shape.3.html \
|
||||
test_2d.path.arc.shape.4.html \
|
||||
test_2d.path.arc.shape.5.html \
|
||||
test_2d.path.arc.selfintersect.1.html \
|
||||
test_2d.path.arc.selfintersect.2.html \
|
||||
test_2d.path.arc.negative.html \
|
||||
test_2d.path.arc.zero.html \
|
||||
test_2d.path.arc.zeroradius.html \
|
||||
test_2d.path.arc.scale.1.html \
|
||||
test_2d.path.arc.scale.2.html \
|
||||
test_2d.path.arc.nonfinite.html \
|
||||
test_2d.path.rect.basic.html \
|
||||
test_2d.path.rect.newsubpath.html \
|
||||
test_2d.path.rect.closed.html \
|
||||
@ -410,18 +523,34 @@ _TEST_FILES_D = \
|
||||
test_2d.path.rect.zero.4.html \
|
||||
test_2d.path.rect.zero.5.html \
|
||||
test_2d.path.rect.negative.html \
|
||||
test_2d.path.rect.winding.html \
|
||||
test_2d.path.rect.nonfinite.html \
|
||||
test_2d.path.fill.overlap.html \
|
||||
test_2d.path.fill.winding.add.html \
|
||||
test_2d.path.fill.winding.subtract.1.html \
|
||||
test_2d.path.fill.winding.subtract.2.html \
|
||||
$(NULL)
|
||||
|
||||
_TEST_FILES_5 = \
|
||||
test_2d.path.fill.winding.subtract.3.html \
|
||||
test_2d.path.fill.closed.basic.html \
|
||||
test_2d.path.fill.closed.unaffected.html \
|
||||
test_2d.path.stroke.overlap.html \
|
||||
test_2d.path.stroke.union.html \
|
||||
test_2d.path.stroke.unaffected.html \
|
||||
test_2d.path.stroke.scale1.html \
|
||||
test_2d.path.stroke.scale2.html \
|
||||
test_2d.path.stroke.skew.html \
|
||||
test_2d.path.stroke.empty.html \
|
||||
test_2d.path.stroke.prune.line.html \
|
||||
test_2d.path.stroke.prune.closed.html \
|
||||
test_2d.path.stroke.prune.curve.html \
|
||||
test_2d.path.stroke.prune.arc.html \
|
||||
test_2d.path.stroke.prune.rect.html \
|
||||
test_2d.path.stroke.prune.corner.html \
|
||||
test_2d.path.transformation.basic.html \
|
||||
test_2d.path.transformation.multiple.1.html \
|
||||
test_2d.path.transformation.multiple.2.html \
|
||||
test_2d.path.transformation.multiple.3.html \
|
||||
test_2d.path.transformation.multiple.html \
|
||||
test_2d.path.transformation.changing.html \
|
||||
test_2d.path.clip.empty.html \
|
||||
test_2d.path.clip.basic.1.html \
|
||||
test_2d.path.clip.basic.2.html \
|
||||
@ -431,12 +560,19 @@ _TEST_FILES_D = \
|
||||
test_2d.path.clip.unaffected.html \
|
||||
test_2d.path.isPointInPath.basic.1.html \
|
||||
test_2d.path.isPointInPath.basic.2.html \
|
||||
test_2d.path.isPointInPath.edge.html \
|
||||
test_2d.path.isPointInPath.empty.html \
|
||||
test_2d.path.isPointInPath.subpath.html \
|
||||
test_2d.path.isPointInPath.outside.html \
|
||||
test_2d.path.isPointInPath.unclosed.html \
|
||||
test_2d.path.isPointInPath.arc.html \
|
||||
test_2d.path.isPointInPath.bigarc.html \
|
||||
test_2d.path.isPointInPath.bezier.html \
|
||||
test_2d.path.isPointInPath.winding.html \
|
||||
test_2d.path.isPointInPath.transform.1.html \
|
||||
test_2d.path.isPointInPath.transform.2.html \
|
||||
test_2d.path.isPointInPath.transform.3.html \
|
||||
test_2d.path.isPointInPath.nonfinite.html \
|
||||
test_2d.drawImage.3arg.html \
|
||||
test_2d.drawImage.5arg.html \
|
||||
test_2d.drawImage.9arg.basic.html \
|
||||
@ -444,6 +580,9 @@ _TEST_FILES_D = \
|
||||
test_2d.drawImage.9arg.sourcesize.html \
|
||||
test_2d.drawImage.9arg.destpos.html \
|
||||
test_2d.drawImage.9arg.destsize.html \
|
||||
test_2d.drawImage.canvas.html \
|
||||
test_2d.drawImage.self.1.html \
|
||||
test_2d.drawImage.self.2.html \
|
||||
test_2d.drawImage.null.html \
|
||||
test_2d.drawImage.wrongtype.html \
|
||||
test_2d.drawImage.floatsource.html \
|
||||
@ -453,116 +592,236 @@ _TEST_FILES_D = \
|
||||
test_2d.drawImage.outsidesource.html \
|
||||
test_2d.drawImage.incomplete.html \
|
||||
test_2d.drawImage.broken.html \
|
||||
test_2d.drawImage.animated.gif.html \
|
||||
test_2d.drawImage.animated.apng.html \
|
||||
test_2d.drawImage.animated.poster.html \
|
||||
test_2d.drawImage.path.html \
|
||||
test_2d.drawImage.transform.html \
|
||||
test_2d.drawImage.alpha.html \
|
||||
test_2d.drawImage.clip.html \
|
||||
test_2d.drawImage.composite.html \
|
||||
test_2d.drawImage.self.html \
|
||||
$(NULL)
|
||||
|
||||
_TEST_FILES_E = \
|
||||
test_2d.drawImage.nowrap.html \
|
||||
test_2d.drawImage.nonfinite.html \
|
||||
test_2d.imageData.create.basic.html \
|
||||
test_2d.imageData.create.type.html \
|
||||
test_2d.imageData.create.initial.html \
|
||||
test_2d.imageData.create.large.html \
|
||||
test_2d.imageData.create.tiny.html \
|
||||
test_2d.imageData.create.negative.html \
|
||||
test_2d.imageData.create.zero.html \
|
||||
test_2d.imageData.create.nonfinite.html \
|
||||
test_2d.imageData.create.round.html \
|
||||
test_2d.imageData.get.basic.html \
|
||||
test_2d.imageData.get.sourcepos.html \
|
||||
test_2d.imageData.get.values.html \
|
||||
test_2d.imageData.get.sourcesize.html \
|
||||
test_2d.imageData.get.properties.html \
|
||||
test_2d.imageData.get.type.html \
|
||||
test_2d.imageData.get.zero.html \
|
||||
test_2d.imageData.get.nonfinite.html \
|
||||
test_2d.imageData.get.source.outside.html \
|
||||
test_2d.imageData.get.source.negative.html \
|
||||
test_2d.imageData.get.source.size.html \
|
||||
test_2d.imageData.get.tiny.html \
|
||||
test_2d.imageData.get.nonpremul.html \
|
||||
test_2d.imageData.get.range.html \
|
||||
test_2d.imageData.get.clamp.html \
|
||||
test_2d.imageData.get.order.cols.html \
|
||||
test_2d.imageData.get.order.rows.html \
|
||||
test_2d.imageData.get.order.rgb.html \
|
||||
test_2d.imageData.get.order.alpha.html \
|
||||
test_2d.imageData.get.smallest.html \
|
||||
test_2d.imageData.get.nonpositive.html \
|
||||
test_2d.imageData.get.nonfinite.html \
|
||||
test_2d.imageData.get.unaffected.html \
|
||||
test_2d.imageData.object.properties.html \
|
||||
test_2d.imageData.object.readonly.html \
|
||||
test_2d.imageData.object.ctor.html \
|
||||
test_2d.imageData.object.set.html \
|
||||
test_2d.imageData.object.undefined.html \
|
||||
$(NULL)
|
||||
|
||||
_TEST_FILES_6 = \
|
||||
test_2d.imageData.object.nan.html \
|
||||
test_2d.imageData.object.string.html \
|
||||
test_2d.imageData.object.clamp.html \
|
||||
test_2d.imageData.object.round.html \
|
||||
test_2d.imageData.put.null.html \
|
||||
test_2d.imageData.put.nonfinite.html \
|
||||
test_2d.imageData.put.basic.html \
|
||||
test_2d.imageData.put.created.html \
|
||||
test_2d.imageData.put.wrongtype.html \
|
||||
test_2d.imageData.put.cross.html \
|
||||
test_2d.imageData.put.alpha.html \
|
||||
test_2d.imageData.put.modified.html \
|
||||
test_2d.imageData.put.type.correct.html \
|
||||
test_2d.imageData.put.type.onepixel.html \
|
||||
test_2d.imageData.put.type.extra.html \
|
||||
test_2d.imageData.put.type.missing.html \
|
||||
test_2d.imageData.put.type.invalidsize.html \
|
||||
test_2d.imageData.put.type.invalidvalues.html \
|
||||
test_2d.imageData.put.dirty.zero.html \
|
||||
test_2d.imageData.put.dirty.rect1.html \
|
||||
test_2d.imageData.put.dirty.rect2.html \
|
||||
test_2d.imageData.put.dirty.negative.html \
|
||||
test_2d.imageData.put.dirty.outside.html \
|
||||
test_2d.imageData.put.unchanged.html \
|
||||
test_2d.imageData.put.unaffected.html \
|
||||
test_2d.imageData.put.clip.html \
|
||||
test_2d.imageData.put.path.html \
|
||||
test_2d.shadow.attributes.shadowBlur.1.html \
|
||||
test_2d.shadow.attributes.shadowBlur.2.html \
|
||||
test_2d.shadow.attributes.shadowOffset.1.html \
|
||||
test_2d.shadow.attributes.shadowOffset.2.html \
|
||||
test_2d.shadow.attributes.shadowColor.1.html \
|
||||
test_2d.shadow.attributes.shadowColor.2.html \
|
||||
test_2d.shadow.basic.1.html \
|
||||
test_2d.shadow.basic.2.html \
|
||||
test_2d.shadow.offset.positiveX.html \
|
||||
test_2d.shadow.offset.negativeX.html \
|
||||
test_2d.shadow.offset.positiveY.html \
|
||||
test_2d.shadow.offset.negativeY.html \
|
||||
test_2d.shadow.outside.html \
|
||||
test_2d.shadow.clip.1.html \
|
||||
test_2d.shadow.clip.2.html \
|
||||
test_2d.shadow.clip.3.html \
|
||||
test_2d.shadow.stroke.basic.html \
|
||||
test_2d.shadow.stroke.cap.1.html \
|
||||
test_2d.shadow.stroke.cap.2.html \
|
||||
test_2d.shadow.stroke.join.1.html \
|
||||
test_2d.shadow.stroke.join.2.html \
|
||||
test_2d.shadow.stroke.join.3.html \
|
||||
test_2d.shadow.image.basic.html \
|
||||
test_2d.shadow.image.transparent.1.html \
|
||||
test_2d.shadow.image.transparent.2.html \
|
||||
test_2d.shadow.image.alpha.html \
|
||||
test_2d.shadow.image.section.html \
|
||||
test_2d.shadow.image.scale.html \
|
||||
test_2d.shadow.canvas.basic.html \
|
||||
test_2d.shadow.canvas.transparent.1.html \
|
||||
test_2d.shadow.canvas.transparent.2.html \
|
||||
test_2d.shadow.canvas.alpha.html \
|
||||
test_2d.shadow.pattern.basic.html \
|
||||
test_2d.shadow.pattern.transparent.1.html \
|
||||
test_2d.shadow.pattern.transparent.2.html \
|
||||
test_2d.shadow.pattern.alpha.html \
|
||||
test_2d.shadow.gradient.basic.html \
|
||||
test_2d.shadow.gradient.transparent.1.html \
|
||||
test_2d.shadow.gradient.transparent.2.html \
|
||||
test_2d.shadow.gradient.alpha.html \
|
||||
test_2d.shadow.transform.1.html \
|
||||
test_2d.shadow.transform.2.html \
|
||||
test_2d.shadow.blur.low.html \
|
||||
test_2d.shadow.blur.high.html \
|
||||
test_2d.shadow.alpha.1.html \
|
||||
test_2d.shadow.alpha.2.html \
|
||||
test_2d.shadow.alpha.3.html \
|
||||
test_2d.shadow.alpha.4.html \
|
||||
test_2d.shadow.alpha.5.html \
|
||||
test_2d.shadow.composite.1.html \
|
||||
test_2d.shadow.composite.2.html \
|
||||
test_2d.shadow.composite.3.html \
|
||||
test_2d.shadow.composite.4.html \
|
||||
test_bug397524.html \
|
||||
test_bug405982.html \
|
||||
image_transparent50.png \
|
||||
image_redtransparent.png \
|
||||
image_yellow.png \
|
||||
image_green-16x16.png \
|
||||
image_red-16x16.png \
|
||||
image_green-1x1.png \
|
||||
image_green-redirect \
|
||||
image_green-redirect^headers^ \
|
||||
image_ggrr-256x256.png \
|
||||
image_yellow75.png \
|
||||
image_broken.png \
|
||||
image_rgrg-256x256.png \
|
||||
image_red.png \
|
||||
image_transparent.png \
|
||||
image_green.png \
|
||||
test_text.font.html \
|
||||
test_text.textAlign.html \
|
||||
test_text.textBaseline.html \
|
||||
test_text.measure.html \
|
||||
test_text.space.replace.html \
|
||||
image_transparent50.png \
|
||||
image_redtransparent.png \
|
||||
image_yellow.png \
|
||||
image_anim-poster-gr.png \
|
||||
image_green-16x16.png \
|
||||
image_red-16x16.png \
|
||||
image_green-1x1.png \
|
||||
image_ggrr-256x256.png \
|
||||
image_yellow75.png \
|
||||
image_anim-gr.gif \
|
||||
image_rrgg-256x256.png \
|
||||
image_broken.png \
|
||||
image_anim-gr.png \
|
||||
image_rgrg-256x256.png \
|
||||
image_red.png \
|
||||
image_transparent.png \
|
||||
image_green.png \
|
||||
image_green-redirect \
|
||||
image_green-redirect^headers^ \
|
||||
$(NULL)
|
||||
|
||||
# This one test crashes Mac for now. Bug 407104
|
||||
ifneq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
||||
_TEST_FILES_E += \
|
||||
test_2d.gradient.empty.html \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
# Tests that fail on Mac (possibly because spec is underdefined?). Bug 407105
|
||||
ifneq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
||||
# XXX vlad don't test these anywhere, cairo behaviour changed
|
||||
#_TEST_FILES_E += \
|
||||
# test_2d.line.join.parallel.html \
|
||||
# test_2d.strokeRect.zero.5.html \
|
||||
# test_2d.line.join.zeroline.corner.html \
|
||||
# test_2d.line.miter.within.html \
|
||||
# $(NULL)
|
||||
_TEST_FILES_3 += \
|
||||
test_2d.line.join.parallel.html \
|
||||
test_2d.strokeRect.zero.5.html \
|
||||
$(NULL)
|
||||
|
||||
# This is an issue with Quartz's handling of radial gradients and some numeric
|
||||
# imprecision that results in errors here.
|
||||
_TEST_FILES_D += test_2d.gradient.radial.inside3.html
|
||||
_TEST_FILES_2 += \
|
||||
test_2d.gradient.radial.inside2.html \
|
||||
test_2d.gradient.radial.inside3.html \
|
||||
test_2d.gradient.radial.outside1.html \
|
||||
$(NULL)
|
||||
|
||||
_TEST_FILES_3 += \
|
||||
test_2d.gradient.radial.cone.front.html \
|
||||
test_2d.gradient.radial.cone.top.html \
|
||||
$(NULL)
|
||||
|
||||
# This is another Quartz bug -- closed paths that don't lie fully within the
|
||||
# destination bounds seem to have problems with the BEVEL/SQUARE join/cap combo.
|
||||
# The joins are rendered as if with MITER; the correct behaviour is also seen
|
||||
# if BUTT is used instead of SQUARE.
|
||||
_TEST_FILES_D += test_2d.line.cap.closed.html
|
||||
_TEST_FILES_4 += test_2d.line.cap.closed.html
|
||||
|
||||
# test_2d.line.cap.zerobezier.round.html disabled for now, from above
|
||||
endif
|
||||
|
||||
# Tests that fail on non-Mac (bug 407107)
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
||||
_TEST_FILES_E += \
|
||||
test_2d.path.rect.selfintersect.html \
|
||||
|
||||
# still need bug numbers
|
||||
_TEST_FILES_1 += \
|
||||
test_2d.composite.uncovered.fill.source-in.html \
|
||||
test_2d.composite.uncovered.fill.destination-in.html \
|
||||
test_2d.composite.uncovered.fill.source-out.html \
|
||||
test_2d.composite.uncovered.fill.destination-atop.html \
|
||||
test_2d.composite.uncovered.pattern.source-in.html \
|
||||
test_2d.composite.uncovered.pattern.destination-in.html \
|
||||
test_2d.composite.uncovered.pattern.source-out.html \
|
||||
test_2d.composite.uncovered.pattern.destination-atop.html \
|
||||
$(NULL)
|
||||
|
||||
# still need bug numbers
|
||||
_TEST_FILES_3 += \
|
||||
test_2d.gradient.radial.outside2.html \
|
||||
test_2d.gradient.radial.outside3.html \
|
||||
test_2d.gradient.radial.touch1.html \
|
||||
test_2d.gradient.radial.touch2.html \
|
||||
test_2d.gradient.radial.touch3.html \
|
||||
test_2d.gradient.radial.equal.html \
|
||||
test_2d.gradient.radial.cone.shape2.html \
|
||||
test_2d.gradient.radial.cone.behind.html \
|
||||
test_2d.gradient.radial.cone.beside.html \
|
||||
$(NULL)
|
||||
|
||||
# still need bug numbers
|
||||
_TEST_FILES_4 += test_2d.path.arc.shape.3.html
|
||||
|
||||
_TEST_FILES_5 += test_2d.path.rect.selfintersect.html
|
||||
endif
|
||||
|
||||
# This test is bogus according to the spec; see bug 407107
|
||||
# test_2d.path.rect.zero.6.html
|
||||
|
||||
# split up into groups to work around command-line length limits
|
||||
libs:: $(_TEST_FILES_A)
|
||||
libs:: $(_TEST_FILES_0)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
||||
libs:: $(_TEST_FILES_B)
|
||||
libs:: $(_TEST_FILES_1)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
||||
libs:: $(_TEST_FILES_C)
|
||||
libs:: $(_TEST_FILES_2)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
||||
libs:: $(_TEST_FILES_D)
|
||||
libs:: $(_TEST_FILES_3)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
||||
libs:: $(_TEST_FILES_E)
|
||||
libs:: $(_TEST_FILES_4)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
||||
libs:: $(_TEST_FILES_5)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
||||
libs:: $(_TEST_FILES_6)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
||||
|
BIN
content/canvas/test/image_anim-gr.gif
Normal file
BIN
content/canvas/test/image_anim-gr.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 241 B |
BIN
content/canvas/test/image_anim-gr.png
Normal file
BIN
content/canvas/test/image_anim-gr.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 460 B |
BIN
content/canvas/test/image_anim-poster-gr.png
Normal file
BIN
content/canvas/test/image_anim-poster-gr.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 422 B |
BIN
content/canvas/test/image_rrgg-256x256.png
Normal file
BIN
content/canvas/test/image_rrgg-256x256.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 120 B |
@ -1,12 +1,12 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.canvas.readonly</title>
|
||||
<!-- Testing: CanvasRenderingContext2D.canvas is readonly -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
@ -16,10 +16,12 @@ var ctx = canvas.getContext('2d');
|
||||
|
||||
var c = document.createElement('canvas');
|
||||
var d = ctx.canvas;
|
||||
try { ctx.canvas = c; } catch (e) {} // not specified whether this throws, I think
|
||||
ok(c !== d, "c !== d");
|
||||
try { ctx.canvas = c; } catch (e) {} // not sure whether this should throw or not...
|
||||
ok(ctx.canvas === d, "ctx.canvas === d");
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.canvas.reference</title>
|
||||
<!-- Testing: CanvasRenderingContext2D.canvas refers back to its canvas -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
@ -16,7 +16,8 @@ var ctx = canvas.getContext('2d');
|
||||
|
||||
ok(ctx.canvas === canvas, "ctx.canvas === canvas");
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.clearRect.basic</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -31,7 +30,8 @@ ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.clearRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,0,0,0, "50,25", "0,0,0,0", 0);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.clearRect.clip</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -40,7 +39,8 @@ ctx.fillRect(0, 0, 16, 16);
|
||||
|
||||
isPixel(ctx, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 0);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.clearRect.globalalpha</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -32,7 +31,8 @@ ctx.globalAlpha = 0.1;
|
||||
ctx.clearRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,0,0,0, "50,25", "0,0,0,0", 0);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.clearRect.globalcomposite</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -32,7 +31,8 @@ ctx.globalCompositeOperation = 'destination-atop';
|
||||
ctx.clearRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,0,0,0, "50,25", "0,0,0,0", 0);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
43
content/canvas/test/test_2d.clearRect.negative.html
Normal file
43
content/canvas/test/test_2d.clearRect.negative.html
Normal file
@ -0,0 +1,43 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.clearRect.negative</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.clearRect(0, 0, 50, 25);
|
||||
ctx.clearRect(100, 0, -50, 25);
|
||||
ctx.clearRect(0, 50, 50, -25);
|
||||
ctx.clearRect(100, 50, -50, -25);
|
||||
isPixel(ctx, 25,12, 0,0,0,0, "25,12", "0,0,0,0", 0);
|
||||
isPixel(ctx, 75,12, 0,0,0,0, "75,12", "0,0,0,0", 0);
|
||||
isPixel(ctx, 25,37, 0,0,0,0, "25,37", "0,0,0,0", 0);
|
||||
isPixel(ctx, 75,37, 0,0,0,0, "75,37", "0,0,0,0", 0);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
70
content/canvas/test/test_2d.clearRect.nonfinite.html
Normal file
70
content/canvas/test/test_2d.clearRect.nonfinite.html
Normal file
@ -0,0 +1,70 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.clearRect.nonfinite</title>
|
||||
<!-- Testing: clearRect() with Infinity/NaN is ignored -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
var _thrown_outer = false;
|
||||
try {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
ctx.clearRect(Infinity, 0, 100, 50);
|
||||
ctx.clearRect(-Infinity, 0, 100, 50);
|
||||
ctx.clearRect(NaN, 0, 100, 50);
|
||||
ctx.clearRect(0, Infinity, 100, 50);
|
||||
ctx.clearRect(0, -Infinity, 100, 50);
|
||||
ctx.clearRect(0, NaN, 100, 50);
|
||||
ctx.clearRect(0, 0, Infinity, 50);
|
||||
ctx.clearRect(0, 0, -Infinity, 50);
|
||||
ctx.clearRect(0, 0, NaN, 50);
|
||||
ctx.clearRect(0, 0, 100, Infinity);
|
||||
ctx.clearRect(0, 0, 100, -Infinity);
|
||||
ctx.clearRect(0, 0, 100, NaN);
|
||||
ctx.clearRect(Infinity, Infinity, 100, 50);
|
||||
ctx.clearRect(Infinity, Infinity, Infinity, 50);
|
||||
ctx.clearRect(Infinity, Infinity, Infinity, Infinity);
|
||||
ctx.clearRect(Infinity, Infinity, 100, Infinity);
|
||||
ctx.clearRect(Infinity, 0, Infinity, 50);
|
||||
ctx.clearRect(Infinity, 0, Infinity, Infinity);
|
||||
ctx.clearRect(Infinity, 0, 100, Infinity);
|
||||
ctx.clearRect(0, Infinity, Infinity, 50);
|
||||
ctx.clearRect(0, Infinity, Infinity, Infinity);
|
||||
ctx.clearRect(0, Infinity, 100, Infinity);
|
||||
ctx.clearRect(0, 0, Infinity, Infinity);
|
||||
|
||||
isPixel(ctx, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 0);
|
||||
|
||||
} catch (e) {
|
||||
_thrown_outer = true;
|
||||
}
|
||||
todo(!_thrown_outer, 'should not throw exception');
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.clearRect.path</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -33,7 +32,8 @@ ctx.clearRect(0, 0, 16, 16);
|
||||
ctx.fill();
|
||||
isPixel(ctx, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 0);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.clearRect.shadow</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -35,7 +34,8 @@ ctx.shadowOffsetY = 50;
|
||||
ctx.clearRect(0, -50, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 0);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.clearRect.transform</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -33,7 +32,8 @@ ctx.translate(0, 5);
|
||||
ctx.clearRect(0, -5, 10, 5);
|
||||
isPixel(ctx, 50,25, 0,0,0,0, "50,25", "0,0,0,0", 0);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.clearRect.zero</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -33,7 +32,8 @@ ctx.clearRect(0, 0, 0, 50);
|
||||
ctx.clearRect(0, 0, 0, 0);
|
||||
isPixel(ctx, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 0);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
45
content/canvas/test/test_2d.composite.canvas.copy.html
Normal file
45
content/canvas/test/test_2d.composite.canvas.copy.html
Normal file
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.canvas.copy</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
var canvas2 = document.createElement('canvas');
|
||||
canvas2.width = canvas.width;
|
||||
canvas2.height = canvas.height;
|
||||
var ctx2 = canvas2.getContext('2d');
|
||||
ctx2.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'copy';
|
||||
ctx.drawImage(canvas2, 0, 0);
|
||||
isPixel(ctx, 50,25, 255,255,0,191, "50,25", "255,255,0,191", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.canvas.destination-atop</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
var canvas2 = document.createElement('canvas');
|
||||
canvas2.width = canvas.width;
|
||||
canvas2.height = canvas.height;
|
||||
var ctx2 = canvas2.getContext('2d');
|
||||
ctx2.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'destination-atop';
|
||||
ctx.drawImage(canvas2, 0, 0);
|
||||
isPixel(ctx, 50,25, 127,255,127,191, "50,25", "127,255,127,191", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.canvas.destination-in</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
var canvas2 = document.createElement('canvas');
|
||||
canvas2.width = canvas.width;
|
||||
canvas2.height = canvas.height;
|
||||
var ctx2 = canvas2.getContext('2d');
|
||||
ctx2.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'destination-in';
|
||||
ctx.drawImage(canvas2, 0, 0);
|
||||
isPixel(ctx, 50,25, 0,255,255,95, "50,25", "0,255,255,95", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.canvas.destination-out</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
var canvas2 = document.createElement('canvas');
|
||||
canvas2.width = canvas.width;
|
||||
canvas2.height = canvas.height;
|
||||
var ctx2 = canvas2.getContext('2d');
|
||||
ctx2.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'destination-out';
|
||||
ctx.drawImage(canvas2, 0, 0);
|
||||
isPixel(ctx, 50,25, 0,255,255,31, "50,25", "0,255,255,31", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.canvas.destination-over</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
var canvas2 = document.createElement('canvas');
|
||||
canvas2.width = canvas.width;
|
||||
canvas2.height = canvas.height;
|
||||
var ctx2 = canvas2.getContext('2d');
|
||||
ctx2.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'destination-over';
|
||||
ctx.drawImage(canvas2, 0, 0);
|
||||
isPixel(ctx, 50,25, 109,255,145,223, "50,25", "109,255,145,223", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
45
content/canvas/test/test_2d.composite.canvas.lighter.html
Normal file
45
content/canvas/test/test_2d.composite.canvas.lighter.html
Normal file
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.canvas.lighter</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
var canvas2 = document.createElement('canvas');
|
||||
canvas2.width = canvas.width;
|
||||
canvas2.height = canvas.height;
|
||||
var ctx2 = canvas2.getContext('2d');
|
||||
ctx2.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'lighter';
|
||||
ctx.drawImage(canvas2, 0, 0);
|
||||
isPixel(ctx, 50,25, 191,255,127,255, "50,25", "191,255,127,255", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.canvas.source-atop</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
var canvas2 = document.createElement('canvas');
|
||||
canvas2.width = canvas.width;
|
||||
canvas2.height = canvas.height;
|
||||
var ctx2 = canvas2.getContext('2d');
|
||||
ctx2.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'source-atop';
|
||||
ctx.drawImage(canvas2, 0, 0);
|
||||
isPixel(ctx, 50,25, 191,255,63,127, "50,25", "191,255,63,127", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
45
content/canvas/test/test_2d.composite.canvas.source-in.html
Normal file
45
content/canvas/test/test_2d.composite.canvas.source-in.html
Normal file
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.canvas.source-in</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
var canvas2 = document.createElement('canvas');
|
||||
canvas2.width = canvas.width;
|
||||
canvas2.height = canvas.height;
|
||||
var ctx2 = canvas2.getContext('2d');
|
||||
ctx2.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'source-in';
|
||||
ctx.drawImage(canvas2, 0, 0);
|
||||
isPixel(ctx, 50,25, 255,255,0,95, "50,25", "255,255,0,95", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
45
content/canvas/test/test_2d.composite.canvas.source-out.html
Normal file
45
content/canvas/test/test_2d.composite.canvas.source-out.html
Normal file
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.canvas.source-out</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
var canvas2 = document.createElement('canvas');
|
||||
canvas2.width = canvas.width;
|
||||
canvas2.height = canvas.height;
|
||||
var ctx2 = canvas2.getContext('2d');
|
||||
ctx2.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'source-out';
|
||||
ctx.drawImage(canvas2, 0, 0);
|
||||
isPixel(ctx, 50,25, 255,255,0,95, "50,25", "255,255,0,95", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.canvas.source-over</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
var canvas2 = document.createElement('canvas');
|
||||
canvas2.width = canvas.width;
|
||||
canvas2.height = canvas.height;
|
||||
var ctx2 = canvas2.getContext('2d');
|
||||
ctx2.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'source-over';
|
||||
ctx.drawImage(canvas2, 0, 0);
|
||||
isPixel(ctx, 50,25, 218,255,36,223, "50,25", "218,255,36,223", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
45
content/canvas/test/test_2d.composite.canvas.xor.html
Normal file
45
content/canvas/test/test_2d.composite.canvas.xor.html
Normal file
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.canvas.xor</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
var canvas2 = document.createElement('canvas');
|
||||
canvas2.width = canvas.width;
|
||||
canvas2.height = canvas.height;
|
||||
var ctx2 = canvas2.getContext('2d');
|
||||
ctx2.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'xor';
|
||||
ctx.drawImage(canvas2, 0, 0);
|
||||
isPixel(ctx, 50,25, 191,255,63,127, "50,25", "191,255,63,127", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
@ -1,27 +1,24 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.path.transformation.multiple.3</title>
|
||||
<title>Canvas test: 2d.composite.clip.copy</title>
|
||||
<!-- Testing: fill() does not affect pixels outside the clip region. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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);
|
||||
}
|
||||
function todo_isPixel(ctx, x,y, r,g,b,a, pos, colour, d) {
|
||||
isPixel(ctx, x,y, r,g,b,a, pos, colour, d, todo);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
@ -29,20 +26,19 @@ MochiKit.DOM.addLoadEvent(function () {
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
ctx.save();
|
||||
ctx.translate(100, 50);
|
||||
ctx.rect(0, 0, 100, 50);
|
||||
ctx.fill();
|
||||
ctx.restore();
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fill();
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'copy';
|
||||
ctx.rect(-20, -20, 10, 10);
|
||||
ctx.clip();
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 50, 50);
|
||||
isPixel(ctx, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 0);
|
||||
isPixel(ctx, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 0);
|
||||
|
||||
todo_isPixel(ctx, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 0);
|
||||
SimpleTest.finish();
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
});
|
||||
</script>
|
||||
|
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.clip.destination-atop</title>
|
||||
<!-- Testing: fill() does not affect pixels outside the clip region. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'destination-atop';
|
||||
ctx.rect(-20, -20, 10, 10);
|
||||
ctx.clip();
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 50, 50);
|
||||
isPixel(ctx, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 0);
|
||||
isPixel(ctx, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 0);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.clip.destination-in</title>
|
||||
<!-- Testing: fill() does not affect pixels outside the clip region. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'destination-in';
|
||||
ctx.rect(-20, -20, 10, 10);
|
||||
ctx.clip();
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 50, 50);
|
||||
isPixel(ctx, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 0);
|
||||
isPixel(ctx, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 0);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.clip.destination-out</title>
|
||||
<!-- Testing: fill() does not affect pixels outside the clip region. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'destination-out';
|
||||
ctx.rect(-20, -20, 10, 10);
|
||||
ctx.clip();
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 50, 50);
|
||||
isPixel(ctx, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 0);
|
||||
isPixel(ctx, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 0);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.clip.destination-over</title>
|
||||
<!-- Testing: fill() does not affect pixels outside the clip region. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'destination-over';
|
||||
ctx.rect(-20, -20, 10, 10);
|
||||
ctx.clip();
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 50, 50);
|
||||
isPixel(ctx, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 0);
|
||||
isPixel(ctx, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 0);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
44
content/canvas/test/test_2d.composite.clip.lighter.html
Normal file
44
content/canvas/test/test_2d.composite.clip.lighter.html
Normal file
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.clip.lighter</title>
|
||||
<!-- Testing: fill() does not affect pixels outside the clip region. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'lighter';
|
||||
ctx.rect(-20, -20, 10, 10);
|
||||
ctx.clip();
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 50, 50);
|
||||
isPixel(ctx, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 0);
|
||||
isPixel(ctx, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 0);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
44
content/canvas/test/test_2d.composite.clip.source-atop.html
Normal file
44
content/canvas/test/test_2d.composite.clip.source-atop.html
Normal file
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.clip.source-atop</title>
|
||||
<!-- Testing: fill() does not affect pixels outside the clip region. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'source-atop';
|
||||
ctx.rect(-20, -20, 10, 10);
|
||||
ctx.clip();
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 50, 50);
|
||||
isPixel(ctx, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 0);
|
||||
isPixel(ctx, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 0);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
44
content/canvas/test/test_2d.composite.clip.source-in.html
Normal file
44
content/canvas/test/test_2d.composite.clip.source-in.html
Normal file
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.clip.source-in</title>
|
||||
<!-- Testing: fill() does not affect pixels outside the clip region. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'source-in';
|
||||
ctx.rect(-20, -20, 10, 10);
|
||||
ctx.clip();
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 50, 50);
|
||||
isPixel(ctx, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 0);
|
||||
isPixel(ctx, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 0);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
44
content/canvas/test/test_2d.composite.clip.source-out.html
Normal file
44
content/canvas/test/test_2d.composite.clip.source-out.html
Normal file
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.clip.source-out</title>
|
||||
<!-- Testing: fill() does not affect pixels outside the clip region. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'source-out';
|
||||
ctx.rect(-20, -20, 10, 10);
|
||||
ctx.clip();
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 50, 50);
|
||||
isPixel(ctx, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 0);
|
||||
isPixel(ctx, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 0);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
44
content/canvas/test/test_2d.composite.clip.source-over.html
Normal file
44
content/canvas/test/test_2d.composite.clip.source-over.html
Normal file
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.clip.source-over</title>
|
||||
<!-- Testing: fill() does not affect pixels outside the clip region. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'source-over';
|
||||
ctx.rect(-20, -20, 10, 10);
|
||||
ctx.clip();
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 50, 50);
|
||||
isPixel(ctx, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 0);
|
||||
isPixel(ctx, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 0);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
44
content/canvas/test/test_2d.composite.clip.xor.html
Normal file
44
content/canvas/test/test_2d.composite.clip.xor.html
Normal file
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.clip.xor</title>
|
||||
<!-- Testing: fill() does not affect pixels outside the clip region. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'xor';
|
||||
ctx.rect(-20, -20, 10, 10);
|
||||
ctx.clip();
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 50, 50);
|
||||
isPixel(ctx, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 0);
|
||||
isPixel(ctx, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 0);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.globalAlpha.canvas</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -39,7 +38,8 @@ ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations
|
||||
ctx.drawImage(canvas2, 0, 0);
|
||||
isPixel(ctx, 50,25, 2,253,0,255, "50,25", "2,253,0,255", 2);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -1,26 +1,34 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.globalAlpha.canvaspattern</title>
|
||||
<title>Canvas test: 2d.composite.globalAlpha.canvaspattern - bug 401790</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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);
|
||||
}
|
||||
function todo_isPixel(ctx, x,y, r,g,b,a, pos, colour, d) {
|
||||
isPixel(ctx, x,y, r,g,b,a, pos, colour, d, todo);
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
@ -43,7 +51,8 @@ ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
todo_isPixel(ctx, 50,25, 2,253,0,255, "50,25", "2,253,0,255", 2);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,11 +2,10 @@
|
||||
<title>Canvas test: 2d.composite.globalAlpha.default</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
@ -16,7 +15,8 @@ var ctx = canvas.getContext('2d');
|
||||
|
||||
ok(ctx.globalAlpha === 1.0, "ctx.globalAlpha === 1.0");
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.globalAlpha.fill</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -33,7 +32,8 @@ ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 2,253,0,255, "50,25", "2,253,0,255", 2);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.globalAlpha.image</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -32,7 +31,8 @@ ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations
|
||||
ctx.drawImage(document.getElementById('red.png'), 0, 0);
|
||||
isPixel(ctx, 50,25, 2,253,0,255, "50,25", "2,253,0,255", 2);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_red.png" id="red.png" class="resource">
|
||||
|
@ -1,26 +1,34 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.globalAlpha.imagepattern</title>
|
||||
<title>Canvas test: 2d.composite.globalAlpha.imagepattern - bug 401790</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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);
|
||||
}
|
||||
function todo_isPixel(ctx, x,y, r,g,b,a, pos, colour, d) {
|
||||
isPixel(ctx, x,y, r,g,b,a, pos, colour, d, todo);
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
@ -36,7 +44,8 @@ ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
todo_isPixel(ctx, 50,25, 2,253,0,255, "50,25", "2,253,0,255", 2);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_red.png" id="red.png" class="resource">
|
||||
|
@ -1,12 +1,11 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.line.invalid.lineWidth</title>
|
||||
<title>Canvas test: 2d.composite.globalAlpha.invalid</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
@ -14,36 +13,23 @@ MochiKit.DOM.addLoadEvent(function () {
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ctx.lineWidth = 1.5;
|
||||
ok(ctx.lineWidth === 1.5, "ctx.lineWidth === 1.5");
|
||||
|
||||
ctx.lineWidth = 1.5;
|
||||
ctx.lineWidth = 0;
|
||||
todo(ctx.lineWidth === 1.5, "ctx.lineWidth === 1.5");
|
||||
|
||||
ctx.lineWidth = 1.5;
|
||||
ctx.lineWidth = -1;
|
||||
todo(ctx.lineWidth === 1.5, "ctx.lineWidth === 1.5");
|
||||
|
||||
ctx.lineWidth = 1.5;
|
||||
ctx.globalAlpha = 0.5;
|
||||
var a = ctx.globalAlpha; // might not be exactly 0.5, if it is rounded/quantised, so remember for future comparisons
|
||||
var _thrown = undefined; try {
|
||||
ctx.lineWidth = Infinity;
|
||||
ctx.globalAlpha = Infinity;
|
||||
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
||||
ok(ctx.lineWidth === 1.5, "ctx.lineWidth === 1.5");
|
||||
|
||||
ctx.lineWidth = 1.5;
|
||||
ok(ctx.globalAlpha == a, "ctx.globalAlpha == a");
|
||||
var _thrown = undefined; try {
|
||||
ctx.lineWidth = -Infinity;
|
||||
ctx.globalAlpha = -Infinity;
|
||||
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
||||
ok(ctx.lineWidth === 1.5, "ctx.lineWidth === 1.5");
|
||||
|
||||
ctx.lineWidth = 1.5;
|
||||
ok(ctx.globalAlpha == a, "ctx.globalAlpha == a");
|
||||
var _thrown = undefined; try {
|
||||
ctx.lineWidth = NaN;
|
||||
ctx.globalAlpha = NaN;
|
||||
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
||||
ok(ctx.lineWidth === 1.5, "ctx.lineWidth === 1.5");
|
||||
ok(ctx.globalAlpha == a, "ctx.globalAlpha == a");
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
});
|
||||
</script>
|
||||
|
@ -2,11 +2,10 @@
|
||||
<title>Canvas test: 2d.composite.globalAlpha.range</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
@ -25,7 +24,8 @@ ok(ctx.globalAlpha == 0, "ctx.globalAlpha == 0");
|
||||
ctx.globalAlpha = 1;
|
||||
ok(ctx.globalAlpha == 1, "ctx.globalAlpha == 1");
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.image.copy</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -33,7 +32,8 @@ ctx.globalCompositeOperation = 'copy';
|
||||
ctx.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
isPixel(ctx, 50,25, 255,255,0,191, "50,25", "255,255,0,191", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.image.destination-atop</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -33,7 +32,8 @@ ctx.globalCompositeOperation = 'destination-atop';
|
||||
ctx.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
isPixel(ctx, 50,25, 127,255,127,191, "50,25", "127,255,127,191", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.image.destination-in</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -33,7 +32,8 @@ ctx.globalCompositeOperation = 'destination-in';
|
||||
ctx.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
isPixel(ctx, 50,25, 0,255,255,95, "50,25", "0,255,255,95", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.image.destination-out</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -33,7 +32,8 @@ ctx.globalCompositeOperation = 'destination-out';
|
||||
ctx.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
isPixel(ctx, 50,25, 0,255,255,31, "50,25", "0,255,255,31", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.image.destination-over</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -33,7 +32,8 @@ ctx.globalCompositeOperation = 'destination-over';
|
||||
ctx.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
isPixel(ctx, 50,25, 109,255,145,223, "50,25", "109,255,145,223", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.image.lighter</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -33,7 +32,8 @@ ctx.globalCompositeOperation = 'lighter';
|
||||
ctx.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
isPixel(ctx, 50,25, 191,255,127,255, "50,25", "191,255,127,255", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.image.source-atop</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -33,7 +32,8 @@ ctx.globalCompositeOperation = 'source-atop';
|
||||
ctx.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
isPixel(ctx, 50,25, 191,255,63,127, "50,25", "191,255,63,127", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.image.source-in</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -33,7 +32,8 @@ ctx.globalCompositeOperation = 'source-in';
|
||||
ctx.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
isPixel(ctx, 50,25, 255,255,0,95, "50,25", "255,255,0,95", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.image.source-out</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -33,7 +32,8 @@ ctx.globalCompositeOperation = 'source-out';
|
||||
ctx.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
isPixel(ctx, 50,25, 255,255,0,95, "50,25", "255,255,0,95", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.image.source-over</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -33,7 +32,8 @@ ctx.globalCompositeOperation = 'source-over';
|
||||
ctx.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
isPixel(ctx, 50,25, 218,255,36,223, "50,25", "218,255,36,223", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.image.xor</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -33,7 +32,8 @@ ctx.globalCompositeOperation = 'xor';
|
||||
ctx.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
isPixel(ctx, 50,25, 191,255,63,127, "50,25", "191,255,63,127", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
@ -0,0 +1,32 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.operation.casesensitive - bug 401788</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
var _thrown_outer = false;
|
||||
try {
|
||||
|
||||
ctx.globalCompositeOperation = 'xor';
|
||||
ctx.globalCompositeOperation = 'Source-over';
|
||||
ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'");
|
||||
|
||||
} catch (e) {
|
||||
_thrown_outer = true;
|
||||
}
|
||||
todo(!_thrown_outer, 'should not throw exception');
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
@ -2,11 +2,10 @@
|
||||
<title>Canvas test: 2d.composite.operation.clear</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
@ -18,7 +17,8 @@ ctx.globalCompositeOperation = 'xor';
|
||||
ctx.globalCompositeOperation = 'clear';
|
||||
todo(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'");
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,11 +2,10 @@
|
||||
<title>Canvas test: 2d.composite.operation.darker</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
@ -18,7 +17,8 @@ ctx.globalCompositeOperation = 'xor';
|
||||
ctx.globalCompositeOperation = 'darker';
|
||||
todo(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'");
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,11 +2,10 @@
|
||||
<title>Canvas test: 2d.composite.operation.default</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
@ -16,7 +15,8 @@ var ctx = canvas.getContext('2d');
|
||||
|
||||
ok(ctx.globalCompositeOperation == 'source-over', "ctx.globalCompositeOperation == 'source-over'");
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,11 +2,10 @@
|
||||
<title>Canvas test: 2d.composite.operation.get</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
@ -23,7 +22,8 @@ for (var i = 0; i < modes.length; ++i)
|
||||
ok(ctx.globalCompositeOperation == modes[i], "ctx.globalCompositeOperation == modes[\""+(i)+"\"]");
|
||||
}
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -0,0 +1,32 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.operation.highlight - bug 401788</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
var _thrown_outer = false;
|
||||
try {
|
||||
|
||||
ctx.globalCompositeOperation = 'xor';
|
||||
ctx.globalCompositeOperation = 'highlight';
|
||||
ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'");
|
||||
|
||||
} catch (e) {
|
||||
_thrown_outer = true;
|
||||
}
|
||||
todo(!_thrown_outer, 'should not throw exception');
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
@ -0,0 +1,32 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.operation.nullsuffix - bug 401788</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
var _thrown_outer = false;
|
||||
try {
|
||||
|
||||
ctx.globalCompositeOperation = 'xor';
|
||||
ctx.globalCompositeOperation = 'source-over\0';
|
||||
ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'");
|
||||
|
||||
} catch (e) {
|
||||
_thrown_outer = true;
|
||||
}
|
||||
todo(!_thrown_outer, 'should not throw exception');
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
@ -2,11 +2,10 @@
|
||||
<title>Canvas test: 2d.composite.operation.over</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
@ -18,7 +17,8 @@ ctx.globalCompositeOperation = 'xor';
|
||||
ctx.globalCompositeOperation = 'over';
|
||||
todo(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'");
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -0,0 +1,32 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.operation.unrecognised - bug 401788</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
var _thrown_outer = false;
|
||||
try {
|
||||
|
||||
ctx.globalCompositeOperation = 'xor';
|
||||
ctx.globalCompositeOperation = 'nonexistent';
|
||||
ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'");
|
||||
|
||||
} catch (e) {
|
||||
_thrown_outer = true;
|
||||
}
|
||||
todo(!_thrown_outer, 'should not throw exception');
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.solid.copy</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -34,7 +33,8 @@ ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 255,255,0,255, "50,25", "255,255,0,255", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.solid.destination-atop</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -34,7 +33,8 @@ ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,255,255,255, "50,25", "0,255,255,255", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.solid.destination-in</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -34,7 +33,8 @@ ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,255,255,255, "50,25", "0,255,255,255", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.solid.destination-out</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -34,7 +33,8 @@ ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,0,0,0, "50,25", "0,0,0,0", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.solid.destination-over</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -34,7 +33,8 @@ ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,255,255,255, "50,25", "0,255,255,255", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.solid.lighter</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -34,7 +33,8 @@ ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 255,255,255,255, "50,25", "255,255,255,255", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.solid.source-atop</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -34,7 +33,8 @@ ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 255,255,0,255, "50,25", "255,255,0,255", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.solid.source-in</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -34,7 +33,8 @@ ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 255,255,0,255, "50,25", "255,255,0,255", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.solid.source-out</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -34,7 +33,8 @@ ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,0,0,0, "50,25", "0,0,0,0", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.solid.source-over</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -34,7 +33,8 @@ ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 255,255,0,255, "50,25", "255,255,0,255", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
40
content/canvas/test/test_2d.composite.solid.xor.html
Normal file
40
content/canvas/test/test_2d.composite.solid.xor.html
Normal file
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.solid.xor</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'xor';
|
||||
ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,0,0,0, "50,25", "0,0,0,0", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.transparent.copy</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -34,7 +33,8 @@ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,0,255,191, "50,25", "0,0,255,191", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.transparent.destination-atop</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -34,7 +33,8 @@ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,127,127,191, "50,25", "0,127,127,191", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.transparent.destination-in</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -34,7 +33,8 @@ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,255,0,95, "50,25", "0,255,0,95", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.transparent.destination-out</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -34,7 +33,8 @@ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,255,0,31, "50,25", "0,255,0,31", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.transparent.destination-over</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -34,7 +33,8 @@ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,145,109,223, "50,25", "0,145,109,223", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.transparent.lighter</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -34,7 +33,8 @@ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,127,191,255, "50,25", "0,127,191,255", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.transparent.source-atop</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -34,7 +33,8 @@ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,63,191,127, "50,25", "0,63,191,127", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.transparent.source-in</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -34,7 +33,8 @@ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,0,255,95, "50,25", "0,0,255,95", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.transparent.source-out</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -34,7 +33,8 @@ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,0,255,95, "50,25", "0,0,255,95", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.transparent.source-over</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -34,7 +33,8 @@ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,36,218,223, "50,25", "0,36,218,223", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
<title>Canvas test: 2d.composite.transparent.xor</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
var _deferred = false;
|
||||
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d, f) {
|
||||
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];
|
||||
(f || ok)(r-d <= pr && pr <= r+d &&
|
||||
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,
|
||||
@ -34,7 +33,8 @@ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,63,191,127, "50,25", "0,63,191,127", 5);
|
||||
|
||||
if (!_deferred) SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -0,0 +1,54 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.uncovered.fill.copy</title>
|
||||
<!-- Testing: fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'copy';
|
||||
ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
|
||||
ctx.translate(0, 25);
|
||||
ctx.fillRect(0, 50, 100, 50);
|
||||
todo_isPixel(ctx, 50,25, 0,0,0,0, "50,25", "0,0,0,0", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
@ -0,0 +1,54 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.uncovered.fill.destination-atop</title>
|
||||
<!-- Testing: fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'destination-atop';
|
||||
ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
|
||||
ctx.translate(0, 25);
|
||||
ctx.fillRect(0, 50, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,0,0,0, "50,25", "0,0,0,0", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
@ -0,0 +1,54 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.uncovered.fill.destination-in</title>
|
||||
<!-- Testing: fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'destination-in';
|
||||
ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
|
||||
ctx.translate(0, 25);
|
||||
ctx.fillRect(0, 50, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,0,0,0, "50,25", "0,0,0,0", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
@ -0,0 +1,54 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.uncovered.fill.source-in</title>
|
||||
<!-- Testing: fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'source-in';
|
||||
ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
|
||||
ctx.translate(0, 25);
|
||||
ctx.fillRect(0, 50, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,0,0,0, "50,25", "0,0,0,0", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
@ -0,0 +1,54 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.uncovered.fill.source-out</title>
|
||||
<!-- Testing: fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'source-out';
|
||||
ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
|
||||
ctx.translate(0, 25);
|
||||
ctx.fillRect(0, 50, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,0,0,0, "50,25", "0,0,0,0", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
@ -0,0 +1,54 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.uncovered.image.copy</title>
|
||||
<!-- Testing: drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'copy';
|
||||
ctx.drawImage(document.getElementById('yellow.png'), 40, 40, 10, 10, 40, 50, 10, 10)
|
||||
todo_isPixel(ctx, 15,15, 0,0,0,0, "15,15", "0,0,0,0", 5);
|
||||
todo_isPixel(ctx, 50,25, 0,0,0,0, "50,25", "0,0,0,0", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow.png" id="yellow.png" class="resource">
|
||||
|
@ -0,0 +1,54 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.uncovered.image.destination-atop</title>
|
||||
<!-- Testing: drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'destination-atop';
|
||||
ctx.drawImage(document.getElementById('yellow.png'), 40, 40, 10, 10, 40, 50, 10, 10)
|
||||
todo_isPixel(ctx, 15,15, 0,0,0,0, "15,15", "0,0,0,0", 5);
|
||||
todo_isPixel(ctx, 50,25, 0,0,0,0, "50,25", "0,0,0,0", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow.png" id="yellow.png" class="resource">
|
||||
|
@ -0,0 +1,54 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.uncovered.image.destination-in</title>
|
||||
<!-- Testing: drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'destination-in';
|
||||
ctx.drawImage(document.getElementById('yellow.png'), 40, 40, 10, 10, 40, 50, 10, 10)
|
||||
todo_isPixel(ctx, 15,15, 0,0,0,0, "15,15", "0,0,0,0", 5);
|
||||
todo_isPixel(ctx, 50,25, 0,0,0,0, "50,25", "0,0,0,0", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow.png" id="yellow.png" class="resource">
|
||||
|
@ -0,0 +1,54 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.uncovered.image.source-in</title>
|
||||
<!-- Testing: drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'source-in';
|
||||
ctx.drawImage(document.getElementById('yellow.png'), 40, 40, 10, 10, 40, 50, 10, 10)
|
||||
todo_isPixel(ctx, 15,15, 0,0,0,0, "15,15", "0,0,0,0", 5);
|
||||
todo_isPixel(ctx, 50,25, 0,0,0,0, "50,25", "0,0,0,0", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow.png" id="yellow.png" class="resource">
|
||||
|
@ -0,0 +1,54 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.uncovered.image.source-out</title>
|
||||
<!-- Testing: drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'source-out';
|
||||
ctx.drawImage(document.getElementById('yellow.png'), 40, 40, 10, 10, 40, 50, 10, 10)
|
||||
todo_isPixel(ctx, 15,15, 0,0,0,0, "15,15", "0,0,0,0", 5);
|
||||
todo_isPixel(ctx, 50,25, 0,0,0,0, "50,25", "0,0,0,0", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow.png" id="yellow.png" class="resource">
|
||||
|
@ -0,0 +1,54 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: 2d.composite.uncovered.pattern.copy</title>
|
||||
<!-- Testing: Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
|
||||
ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'copy';
|
||||
ctx.fillStyle = ctx.createPattern(document.getElementById('yellow.png'), 'no-repeat');
|
||||
ctx.fillRect(0, 50, 100, 50);
|
||||
todo_isPixel(ctx, 50,25, 0,0,0,0, "50,25", "0,0,0,0", 5);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow.png" id="yellow.png" class="resource">
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user