From 8fa237186f9c21f2ac7eb01347b5402afca9d820 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Wed, 10 Feb 2021 00:25:54 +0000 Subject: [PATCH] Bug 1685017 [wpt PR 27040] - createImageBitmap for out of bound clipping, a=testonly Automatic update from web-platform-tests HTML: createImageBitmap() for out of bound clipping For https://github.com/whatwg/html/pull/6346. -- wpt-commits: f480960da2cb3cc827f6fe4ac629b6dd229b0fea wpt-pr: 27040 UltraBlame original commit: 10a1015aa806f8b426d358d9f4546a2240b6b8ee --- .../imagebitmap/createImageBitmap-bounds.html | 312 +++++++++++++++--- 1 file changed, 263 insertions(+), 49 deletions(-) diff --git a/testing/web-platform/tests/html/canvas/element/manual/imagebitmap/createImageBitmap-bounds.html b/testing/web-platform/tests/html/canvas/element/manual/imagebitmap/createImageBitmap-bounds.html index cecbc9d208acb..0a02354e0ea01 100644 --- a/testing/web-platform/tests/html/canvas/element/manual/imagebitmap/createImageBitmap-bounds.html +++ b/testing/web-platform/tests/html/canvas/element/manual/imagebitmap/createImageBitmap-bounds.html @@ -77,8 +77,38 @@ script > < +div +id += +" +results +" +> +< +/ +div +> +< script > +const +color += +204 +; +function +testClip +( +name +sx +sy +sw +sh +expectedColors +expectedWidth +expectedHeight +) +{ promise_test ( function @@ -162,10 +192,10 @@ createImageBitmap ( image -8 -8 -16 -16 +sx +sy +sw +sh ) ; } @@ -178,10 +208,21 @@ imageBitmap ) { -const -color -= -204 +assert_equals +( +imageBitmap +. +width +expectedWidth +) +; +assert_equals +( +imageBitmap +. +height +expectedHeight +) ; const canvas @@ -212,9 +253,14 @@ debug document . -body +getElementById +( +" +results +" +) . -appendChild +append ( canvas ) @@ -286,44 +332,6 @@ 0 ) ; -const -expected -= -[ -[ -4 -4 -0 -255 -0 -255 -] -[ -12 -4 -color -color -color -255 -] -[ -4 -12 -color -color -color -255 -] -[ -12 -12 -color -color -color -255 -] -] -; for ( let @@ -336,7 +344,7 @@ a ] of -expected +expectedColors ) { _assertPixel @@ -373,6 +381,212 @@ ) ; } +name +) +; +} +testClip +( +" +simple +clip +inside +" +8 +8 +8 +8 +[ +[ +4 +4 +0 +255 +0 +255 +] +[ +12 +4 +color +color +color +255 +] +[ +4 +12 +color +color +color +255 +] +[ +12 +12 +color +color +color +255 +] +] +8 +8 +) +; +testClip +( +" +clip +outside +negative +" +- +8 +- +8 +16 +16 +[ +[ +4 +4 +color +color +color +255 +] +[ +12 +4 +color +color +color +255 +] +[ +4 +12 +color +color +color +255 +] +[ +12 +12 +0 +255 +0 +255 +] +] +16 +16 +) +; +testClip +( +" +clip +outside +positive +" +8 +8 +16 +16 +[ +[ +4 +4 +0 +255 +0 +255 +] +[ +12 +4 +color +color +color +255 +] +[ +4 +12 +color +color +color +255 +] +[ +12 +12 +color +color +color +255 +] +] +16 +16 +) +; +testClip +( +" +clip +inside +using +negative +width +and +height +" +24 +24 +- +16 +- +16 +[ +[ +4 +4 +0 +255 +0 +255 +] +[ +12 +4 +color +color +color +255 +] +[ +4 +12 +color +color +color +255 +] +[ +12 +12 +color +color +color +255 +] +] +16 +16 ) ; <