Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-flipY.html

Issue 1631733003: Implementing ImageBitmap option imageOrientation of flipY (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-flipY.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-flipY.html
similarity index 77%
copy from third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage.html
copy to third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-flipY.html
index cd81dcf960b8831b6b4292efaaa82ac67a500b1a..f5ca70b3b89f25514ea6feafba62ec574b440982 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-flipY.html
@@ -6,7 +6,7 @@
<body>
jbroman 2016/01/26 17:03:37 Would you mind also testing the other cases (none,
xidachen 2016/02/03 02:17:19 Acknowledged.
<script>
-description("Ensure correct behavior of drawImage with ImageBitmaps.");
+description("Ensure correct behavior of drawImage with ImageBitmaps along with flipY option.");
window.jsTestIsAsync = true;
function jsWrapperClass(node)
@@ -152,8 +152,10 @@ xhr.onload = function() {
function loaded() {
if (imageLoaded && imageBitmapLoaded && blobLoaded) {
- // check all of these elements
- elements = [image, aCanvas, d, testBitmap, blob];
+ // check the case of ImageData only, the rest will be added later on when
+ // they are supported.
+ elements = [d];
+ // elements = [image, aCanvas, d, testBitmap, blob];
// wait for callback to finish before each check to ensure synchronous behavior
nextCheck(0);
}
@@ -167,15 +169,15 @@ function nextCheck(elementIndex) {
var element = elements[elementIndex];
imageBitmaps = {};
debug("Checking " + jsWrapperClass(element) + ".");
- var p1 = createImageBitmap(element).then(function (image) { imageBitmaps.noCrop = image });
- var p2 = createImageBitmap(element, 0, 0, 10, 10).then(function (image) { imageBitmaps.crop = image });
- var p3 = createImageBitmap(element, 5, 5, 10, 10).then(function (image) { imageBitmaps.cropCenter = image });
- var p4 = createImageBitmap(element, 10, 10, 10, 10).then(function (image) { imageBitmaps.cropRight = image });
- var p5 = createImageBitmap(element, -10, -10, 60, 60).then(function (image) { imageBitmaps.overCrop = image });
- var p6 = createImageBitmap(element, 10, 10, 50, 50).then(function (image) { imageBitmaps.overCropRight = image });
- var p7 = createImageBitmap(element, 10, 10, -10, -10).then(function (image) { imageBitmaps.negativeCrop = image });
- var p8 = createImageBitmap(element, -30, -30, 30, 30).then(function (image) { imageBitmaps.empty = image });
- var p9 = createImageBitmap(element, 40, 30, 30, 30).then(function (image) { imageBitmaps.emptyTwo = image });
+ var p1 = createImageBitmap(element, {'orientation' : "flipY"}).then(function (image) { imageBitmaps.noCrop = image });
jbroman 2016/01/26 17:03:37 style nit: prefer not to quote the keys, and to ha
xidachen 2016/02/03 02:17:19 Acknowledged.
+ var p2 = createImageBitmap(element, 0, 0, 10, 10, {'orientation' : "flipY"}).then(function (image) { imageBitmaps.crop = image });
+ var p3 = createImageBitmap(element, 5, 5, 10, 10, {'orientation' : "flipY"}).then(function (image) { imageBitmaps.cropCenter = image });
+ var p4 = createImageBitmap(element, 10, 10, 10, 10, {'orientation' : "flipY"}).then(function (image) { imageBitmaps.cropRight = image });
+ var p5 = createImageBitmap(element, -10, -10, 60, 60, {'orientation' : "flipY"}).then(function (image) { imageBitmaps.overCrop = image });
+ var p6 = createImageBitmap(element, 10, 10, 50, 50, {'orientation' : "flipY"}).then(function (image) { imageBitmaps.overCropRight = image });
+ var p7 = createImageBitmap(element, 10, 10, -10, -10, {'orientation' : "flipY"}).then(function (image) { imageBitmaps.negativeCrop = image });
+ var p8 = createImageBitmap(element, -30, -30, 30, 30, {'orientation' : "flipY"}).then(function (image) { imageBitmaps.empty = image });
+ var p9 = createImageBitmap(element, 40, 30, 30, 30, {'orientation' : "flipY"}).then(function (image) { imageBitmaps.emptyTwo = image });
Promise.all([p1, p2, p3, p4, p5, p6, p7, p8, p9]).then(function() {
checkNoCrop(imageBitmaps.noCrop);
checkCrop(imageBitmaps.crop);
@@ -200,11 +202,11 @@ function checkNoCrop(imageBitmap) {
// should be drawn to (0, 0), (20, 20)
clearContext(ctx);
ctx.drawImage(imageBitmap, 0, 0);
- shouldBeRed(9, 9);
- shouldBeGreen(11, 9);
- shouldBeBlue(9, 11);
- shouldBeBlack(11, 11);
- shouldBeBlack(19, 19);
+ shouldBeBlue(9, 9);
+ shouldBeBlack(11, 9);
+ shouldBeRed(9, 11);
+ shouldBeGreen(11, 11);
+ shouldBeGreen(19, 19);
shouldBeClear(1, 21);
shouldBeClear(21, 1);
shouldBeClear(21, 21);
@@ -212,11 +214,11 @@ function checkNoCrop(imageBitmap) {
// shrunk to (0, 0), (10, 10)
clearContext(ctx);
ctx.drawImage(imageBitmap, 0, 0, 10, 10);
- shouldBeRed(4, 4);
- shouldBeGreen(6, 4);
- shouldBeBlue(4, 6);
- shouldBeBlack(6, 6);
- shouldBeBlack(9, 9);
+ shouldBeBlue(4, 4);
+ shouldBeBlack(6, 4);
+ shouldBeRed(4, 6);
+ shouldBeGreen(6, 6);
+ shouldBeGreen(9, 9);
shouldBeClear(1, 11);
shouldBeClear(11, 1);
shouldBeClear(11, 11);
@@ -224,11 +226,11 @@ function checkNoCrop(imageBitmap) {
// shrunk to (10, 10), (20, 20)
clearContext(ctx);
ctx.drawImage(imageBitmap, 10, 10, 10, 10);
- shouldBeRed(14, 14);
- shouldBeGreen(16, 14);
- shouldBeBlue(14, 16);
- shouldBeBlack(16, 16);
- shouldBeBlack(19, 19);
+ shouldBeBlue(14, 14);
+ shouldBeBlack(16, 14);
+ shouldBeRed(14, 16);
+ shouldBeGreen(16, 16);
+ shouldBeGreen(19, 19);
shouldBeClear(11, 21);
shouldBeClear(21, 11);
shouldBeClear(21, 21);
@@ -237,8 +239,8 @@ function checkNoCrop(imageBitmap) {
clearContext(ctx);
ctx.drawImage(imageBitmap, 10, 10, 10, 10, 10, 10, 10, 10);
shouldBeClear(9, 9);
- shouldBeBlack(11, 11);
- shouldBeBlack(19, 19);
+ shouldBeGreen(11, 11);
+ shouldBeGreen(19, 19);
shouldBeClear(1, 21);
shouldBeClear(21, 1);
shouldBeClear(21, 21);
@@ -254,8 +256,8 @@ function checkCrop(imageBitmap) {
// red should be drawn to (0, 0), (10, 10)
clearContext(ctx);
ctx.drawImage(imageBitmap, 0, 0);
- shouldBeRed(1, 1);
- shouldBeRed(9, 9);
+ shouldBeBlue(1, 1);
+ shouldBeBlue(9, 9);
shouldBeClear(12, 12);
shouldBeClear(1, 12);
shouldBeClear(12, 1);
@@ -263,8 +265,8 @@ function checkCrop(imageBitmap) {
// red should be drawn to (0, 0), (20, 20)
clearContext(ctx);
ctx.drawImage(imageBitmap, 0, 0, 20, 20);
- shouldBeRed(1, 1);
- shouldBeRed(18, 18);
+ shouldBeBlue(1, 1);
+ shouldBeBlue(18, 18);
shouldBeClear(22, 22);
shouldBeClear(1, 22);
shouldBeClear(22, 1);
@@ -280,11 +282,11 @@ function checkCropCenter(imageBitmap) {
// should be drawn to (0, 0), (10, 10) with all four colors
clearContext(ctx);
ctx.drawImage(imageBitmap, 0, 0);
- shouldBeRed(4, 4);
- shouldBeGreen(6, 4);
- shouldBeBlue(4, 6);
- shouldBeBlack(6, 6);
- shouldBeBlack(9, 9);
+ shouldBeBlue(4, 4);
+ shouldBeBlack(6, 4);
+ shouldBeRed(4, 6);
+ shouldBeGreen(6, 6);
+ shouldBeGreen(9, 9);
shouldBeClear(11, 11);
shouldBeClear(1, 11);
shouldBeClear(11, 1);
@@ -292,11 +294,11 @@ function checkCropCenter(imageBitmap) {
// should be drawn to (0, 0), (20, 20) with all four colors
clearContext(ctx);
ctx.drawImage(imageBitmap, 0, 0, 20, 20);
- shouldBeRed(8, 8);
- shouldBeGreen(11, 8);
- shouldBeBlue(8, 11);
- shouldBeBlack(11, 11);
- shouldBeBlack(18, 18);
+ shouldBeBlue(8, 8);
+ shouldBeBlack(11, 8);
+ shouldBeRed(8, 11);
+ shouldBeGreen(11, 11);
+ shouldBeGreen(18, 18);
shouldBeClear(22, 22);
shouldBeClear(1, 21);
shouldBeClear(21, 1);
@@ -312,8 +314,8 @@ function checkCropRight(imageBitmap) {
// black should be drawn to (0, 0), (10, 10)
clearContext(ctx);
ctx.drawImage(imageBitmap, 0, 0);
- shouldBeBlack(1, 1);
- shouldBeBlack(9, 9);
+ shouldBeGreen(1, 1);
+ shouldBeGreen(9, 9);
shouldBeClear(11, 11);
shouldBeClear(1, 11);
shouldBeClear(11, 1);
@@ -331,12 +333,12 @@ function checkOverCrop(imageBitmap) {
ctx.drawImage(imageBitmap, 0, 0);
shouldBeClear(1, 1);
shouldBeClear(9, 9);
- shouldBeRed(11, 11);
- shouldBeRed(19, 19);
- shouldBeGreen(21, 19);
- shouldBeBlue(19, 21);
- shouldBeBlack(21, 21);
- shouldBeBlack(29, 29);
+ shouldBeBlue(11, 11);
+ shouldBeBlue(19, 19);
+ shouldBeBlack(21, 19);
+ shouldBeRed(19, 21);
+ shouldBeGreen(21, 21);
+ shouldBeGreen(29, 29);
shouldBeClear(32, 1);
shouldBeClear(1, 32);
shouldBeClear(32, 32);
@@ -346,12 +348,12 @@ function checkOverCrop(imageBitmap) {
ctx.drawImage(imageBitmap, 0, 0, 30, 30);
shouldBeClear(1, 1);
shouldBeClear(4, 4);
- shouldBeRed(6, 6);
- shouldBeRed(9, 9);
- shouldBeGreen(11, 9);
- shouldBeBlue(9, 11);
- shouldBeBlack(11, 11);
- shouldBeBlack(14, 14);
+ shouldBeBlue(6, 6);
+ shouldBeBlue(9, 9);
+ shouldBeBlack(11, 9);
+ shouldBeRed(9, 11);
+ shouldBeGreen(11, 11);
+ shouldBeGreen(14, 14);
shouldBeClear(16, 1);
shouldBeClear(1, 16);
shouldBeClear(16, 16);
@@ -366,8 +368,8 @@ function checkOverCropRight(imageBitmap) {
// black should be drawn to (0, 0), (10, 10)
clearContext(ctx);
ctx.drawImage(imageBitmap, 0, 0);
- shouldBeBlack(1, 1);
- shouldBeBlack(9, 9);
+ shouldBeGreen(1, 1);
+ shouldBeGreen(9, 9);
shouldBeClear(11, 11);
shouldBeClear(1, 11);
shouldBeClear(11, 1);
@@ -375,8 +377,8 @@ function checkOverCropRight(imageBitmap) {
// black should be drawn to (0, 0), (4, 4)
clearContext(ctx);
ctx.drawImage(imageBitmap, 0, 0, 20, 20);
- shouldBeBlack(1, 1);
- shouldBeBlack(3, 3);
+ shouldBeGreen(1, 1);
+ shouldBeGreen(3, 3);
shouldBeClear(5, 5);
shouldBeClear(1, 5);
shouldBeClear(5, 1);

Powered by Google App Engine
This is Rietveld 408576698