Commit b6e599fe authored by wangxianzhu's avatar wangxianzhu Committed by Commit bot

Deflake paint/invalidation/svg/image-animation-with-zoom.html

It had been flaky after https://codereview.chromium.org/2872423002/
which defined PaintInvalidationReason::kImage for invalidations
caused by image change. The test sometimes produced "full" and
sometimes produced "image" as the invalidation reason of the image.
The flakiness might be because of arbitrary timing of image animation.

- Add image onload handler to start the test;
- Advance image animation twice to avoid flakiness.
- Convert it into a ref test.
- Increase the size of the image to avoid the layout from being
  affected by different font sizes on different platforms.

BUG=722131

Review-Url: https://codereview.chromium.org/2882873002
Cr-Commit-Position: refs/heads/master@{#472165}
parent 13ae67b0
......@@ -90,9 +90,6 @@ crbug.com/664850 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-comm
crbug.com/664852 virtual/gpu/fast/canvas/canvas-createImageBitmap-webgl.html [ Pass Failure ]
crbug.com/664852 virtual/gpu/fast/canvas/OffscreenCanvas-2d-drawImage.html [ Pass Failure ]
crbug.com/722131 paint/invalidation/svg/image-animation-with-zoom.html [ Pass Failure ]
crbug.com/722131 virtual/disable-spinvalidation/paint/invalidation/svg/image-animation-with-zoom.html [ Pass Failure ]
########## Bugs to fix ##########
# This is a missing event and increasing the timeout or using run-after-layout-and-paint doesn't
# seem to fix it.
......
<!DOCTYPE HTML>
<!-- Test for crbug.com/375765: test passes if a green square is drawn. -->
<div style="position: absolute; top: 22px; left: 22px; width: 66px; height: 66px; background: green"></div>
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"contentsOpaque": true,
"drawsContent": true,
"paintInvalidations": [
{
"object": "LayoutImage IMG id='targetImage'",
"rect": [0, 9, 22, 22],
"reason": "full"
}
]
}
],
"objectPaintInvalidations": [
{
"object": "LayoutImage IMG id='targetImage'",
"reason": "full"
}
]
}
<!DOCTYPE HTML>
<!-- Test for crbug.com/375765: test passes if a green square is drawn. -->
<script src="../resources/text-based-repaint.js"></script>
<script src="../../../resources/run-after-layout-and-paint.js"></script>
<style>
html {
zoom: 2.2;
......@@ -9,16 +9,29 @@
margin: 0;
padding: 0;
}
img {
width: 50px;
height: 50px;
}
</style>
<script>
window.testIsAsync = true;
window.onload = runRepaintTest;
function repaintTest() {
window.internals.advanceImageAnimation(targetImage);
window.requestAnimationFrame(function() {
finishRepaintTest();
});
if (window.testRunner)
testRunner.waitUntilDone();
onload = function() {
if (window.testRunner && window.internals) {
targetImage.onload = function() {
requestAnimationFrame(function() {
internals.advanceImageAnimation(targetImage);
requestAnimationFrame(function() {
internals.advanceImageAnimation(targetImage);
requestAnimationFrame(function() {
testRunner.notifyDone();
});
});
});
};
}
targetImage.src='resources/animate-center.svg';
};
</script>
<img id="targetImage" src="resources/animate-center.svg" width="10px" height="10px">
\ No newline at end of file
<img id="targetImage">
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10">
<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50">
<defs>
<style type="text/css"><![CDATA[
#square {
......@@ -15,5 +15,5 @@
}
]]></style>
</defs>
<rect id="square" width="5" height="5" x="5" y="5"></rect>
</svg>
\ No newline at end of file
<rect id="square" width="30" height="30" x="10" y="10"></rect>
</svg>
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"contentsOpaque": true,
"drawsContent": true,
"paintInvalidations": [
{
"object": "LayoutImage IMG id='targetImage'",
"rect": [0, 10, 22, 22],
"reason": "full"
}
]
}
],
"objectPaintInvalidations": [
{
"object": "LayoutImage IMG id='targetImage'",
"reason": "full"
}
]
}
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"contentsOpaque": true,
"drawsContent": true,
"paintInvalidations": [
{
"object": "LayoutImage IMG id='targetImage'",
"rect": [0, 9, 22, 22],
"reason": "image"
}
]
}
],
"objectPaintInvalidations": [
{
"object": "LayoutImage IMG id='targetImage'",
"reason": "image"
}
]
}
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"contentsOpaque": true,
"drawsContent": true,
"paintInvalidations": [
{
"object": "LayoutImage IMG id='targetImage'",
"rect": [0, 10, 22, 22],
"reason": "full"
}
]
}
],
"objectPaintInvalidations": [
{
"object": "LayoutImage IMG id='targetImage'",
"reason": "full"
}
]
}
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"contentsOpaque": true,
"drawsContent": true,
"paintInvalidations": [
{
"object": "LayoutImage IMG id='targetImage'",
"rect": [0, 10, 22, 22],
"reason": "image"
}
]
}
],
"objectPaintInvalidations": [
{
"object": "LayoutImage IMG id='targetImage'",
"reason": "image"
}
]
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment