Index: LayoutTests/fast/canvas/canvas-composite-text-alpha.html |
diff --git a/LayoutTests/fast/canvas/canvas-composite-stroke-alpha.html b/LayoutTests/fast/canvas/canvas-composite-text-alpha.html |
similarity index 96% |
copy from LayoutTests/fast/canvas/canvas-composite-stroke-alpha.html |
copy to LayoutTests/fast/canvas/canvas-composite-text-alpha.html |
index 43a87be3b336d58b3910a323f7742f9dddd10589..73cbf76d6a7e3d6c36ff032899632a451d1207fb 100644 |
--- a/LayoutTests/fast/canvas/canvas-composite-stroke-alpha.html |
+++ b/LayoutTests/fast/canvas/canvas-composite-text-alpha.html |
@@ -1,6 +1,6 @@ |
<html> |
<head> |
- <title>A canvas globalCompositeOperation test with alpha blending</title> |
+ <title>A canvas globalCompositeOperation test with alpha compositing on text</title> |
<!-- This test was inspired by http://canvex.lazyilluminati.com/misc/compositex.html --> |
<script type="application/x-javascript"> |
if (window.testRunner) { |
@@ -313,7 +313,7 @@ |
trMessageElement.appendChild(tdElement); |
var ctx = expectedCanvasElement.getContext("2d"); |
- ctx.lineWidth = 10; |
+ ctx.lineWidth = 3; |
// Draw expected image. |
ctx.globalCompositeOperation = "copy"; |
ctx.fillStyle = getRGBAString(expectedColor.destination); |
@@ -327,7 +327,7 @@ |
drawPolicy.drawComposition(ctx); |
ctx = actualCanvasElement.getContext("2d"); |
- ctx.lineWidth = 10; |
+ ctx.lineWidth = 3; |
// Draw destination rectangle. |
ctx.globalCompositeOperation = "copy"; |
@@ -345,8 +345,8 @@ |
var errorSuffix = ", composite type: " + type + ", source: " + inputColor.source + ", destination: " + inputColor.destination + "<br>"; |
var results = ""; |
- // Note that (0, 0) may be affected by anti-alias. |
- var img = ctx.getImageData(1, 1, 1, 1).data; |
+ // Note that (2, 3) may be affected by anti-alias. |
+ var img = ctx.getImageData(3, 4, 1, 1).data; |
var actualColor = [img[0], img[1], img[2], img[3]]; |
if (isDifferentColor(actualColor, expectedColor.source)) { |
results += "Unexpected source! expected: " + expectedColor.source + " actual: " + actualColor + errorSuffix; |
@@ -357,7 +357,7 @@ |
if (isDifferentColor(actualColor, expectedColor.destination)) { |
results += "Unexpected destination! expected: " + expectedColor.destination + " actual: " + actualColor + errorSuffix; |
} |
- img = ctx.getImageData(12, 12, 1, 1).data; |
+ img = ctx.getImageData(11, 12, 1, 1).data; |
actualColor = [img[0], img[1], img[2], img[3]]; |
if (isDifferentColor(actualColor, expectedColor.composition)) { |
results += "Unexpected composition! expected: " + expectedColor.composition + " actual: " + actualColor + errorSuffix; |
@@ -383,9 +383,10 @@ |
} |
} |
- var useStrokeRect = { |
+ var useFillText = { |
drawSource: function(ctx) { |
- ctx.strokeRect(5, 5, 10, 10); |
+ ctx.font="bold 20px arial"; |
+ ctx.fillText("B", 0, 18); |
}, |
drawDestination: function(ctx) { |
@@ -396,18 +397,13 @@ |
ctx.fillRect(5, 5, 15, 15); |
}, |
- name: "stroke rect" |
+ name: "fill text" |
}; |
- var usePathAndStroke = { |
+ var useStrokeText = { |
drawSource: function(ctx) { |
- ctx.beginPath(); |
- ctx.moveTo(5, 5); |
- ctx.lineTo(15, 5); |
- ctx.lineTo(15, 15); |
- ctx.lineTo(5, 15); |
- ctx.closePath(); |
- ctx.stroke(); |
+ ctx.font="bold 20px arial"; |
+ ctx.strokeText("B", 0, 18); |
}, |
drawDestination: function(ctx) { |
@@ -418,13 +414,13 @@ |
ctx.fillRect(5, 5, 15, 15); |
}, |
- name: "path and stroke" |
+ name: "stroke text" |
}; |
function draw() |
{ |
- drawTable(useStrokeRect); |
- drawTable(usePathAndStroke); |
+ drawTable(useFillText); |
+ drawTable(useStrokeText); |
if (window.testRunner) |
testRunner.notifyDone(); |
} |
@@ -440,7 +436,7 @@ |
</style> |
</head> |
<body onload="draw();"> |
- <p>This test exercises a bunch of alpha composition checks with stroking. The top-left rectangles are the source images and bottom-right rectangles are the destination images.</p> |
+ <p>This test exercises a bunch of alpha composition operations on text. The top-left rectangles are the source images and bottom-right rectangles are the destination images.</p> |
<div id="results"> |
</div> |
<textarea id="debug"></textarea> |