Skip to content

Commit

Permalink
Bug 1685017 [wpt PR 27040] - createImageBitmap for out of bound clipp…
Browse files Browse the repository at this point in the history
…ing, a=testonly

Automatic update from web-platform-tests
HTML: createImageBitmap() for out of bound clipping

For whatwg/html#6346.
--

wpt-commits: f480960da2cb3cc827f6fe4ac629b6dd229b0fea
wpt-pr: 27040

UltraBlame original commit: 10a1015aa806f8b426d358d9f4546a2240b6b8ee
  • Loading branch information
marco-c committed Feb 10, 2021
1 parent a363f4a commit 8fa2371
Showing 1 changed file with 263 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -162,10 +192,10 @@
createImageBitmap
(
image
8
8
16
16
sx
sy
sw
sh
)
;
}
Expand All @@ -178,10 +208,21 @@
imageBitmap
)
{
const
color
=
204
assert_equals
(
imageBitmap
.
width
expectedWidth
)
;
assert_equals
(
imageBitmap
.
height
expectedHeight
)
;
const
canvas
Expand Down Expand Up @@ -212,9 +253,14 @@
debug
document
.
body
getElementById
(
"
results
"
)
.
appendChild
append
(
canvas
)
Expand Down Expand Up @@ -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
Expand All @@ -336,7 +344,7 @@
a
]
of
expected
expectedColors
)
{
_assertPixel
Expand Down Expand Up @@ -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
)
;
<
Expand Down

0 comments on commit 8fa2371

Please sign in to comment.