Bug 85245 - [chromium] CCDamageTrackerTest.verifyDamageForPerspectiveClippedLayer needs to be cleaner
Summary: [chromium] CCDamageTrackerTest.verifyDamageForPerspectiveClippedLayer needs t...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Shawn Singh
URL:
Keywords:
Depends on:
Blocks: 85241
  Show dependency treegraph
 
Reported: 2012-04-30 16:29 PDT by Dana Jansens
Modified: 2012-06-04 15:27 PDT (History)
4 users (show)

See Also:


Attachments
Patch (3.28 KB, patch)
2012-06-01 11:34 PDT, Shawn Singh
no flags Details | Formatted Diff | Diff
Patch (3.14 KB, patch)
2012-06-01 11:41 PDT, Shawn Singh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dana Jansens 2012-04-30 16:29:06 PDT
Claim:
    // The expected damage should cover the entire root surface (500x500), but we don't
    // care whether the damage rect was clamped or is larger than the surface for this test.
    FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();

But it tests the rootDamageRect's width/height only. The following fails:

    EXPECT_LE(rootDamageRect.x(), 0);
    EXPECT_LE(rootDamageRect.y(), 0);
    EXPECT_GE(rootDamageRect.maxX(), 500);
    EXPECT_GE(rootDamageRect.maxY(), 500);

It seems to actually end up with a damage rect that is very large and with its bottom right corner at 0,0. I am not sure if this is wrong, though it smells a bit weird to me. But the test does not seem to be testing what it actually claims - that the damage covers the root surface.
Comment 1 Shawn Singh 2012-06-01 10:48:30 PDT
(In reply to comment #0)
> Claim:
>     // The expected damage should cover the entire root surface (500x500), but we don't
>     // care whether the damage rect was clamped or is larger than the surface for this test.
>     FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
> 
> But it tests the rootDamageRect's width/height only. The following fails:
> 
>     EXPECT_LE(rootDamageRect.x(), 0);
>     EXPECT_LE(rootDamageRect.y(), 0);
>     EXPECT_GE(rootDamageRect.maxX(), 500);
>     EXPECT_GE(rootDamageRect.maxY(), 500);
> 
> It seems to actually end up with a damage rect that is very large and with its bottom right corner at 0,0. I am not sure if this is wrong, though it smells a bit weird to me. But the test does not seem to be testing what it actually claims - that the damage covers the root surface.


So I added those two lines, and it seems to work correctly.  Can you please double-check what it is you felt might be wrong?

In the mean-time, I'll use this bug to submit a quick and trivial patch to add those two lines, because I agree they should be there.
Comment 2 Dana Jansens 2012-06-01 10:54:02 PDT
I added a printf and get this

[ RUN      ] CCDamageTrackerTest.verifyDamageForPerspectiveClippedLayer
rootDamageRect -15099999.000000 -10000000.000000 15099996.000000 10000000.000000

The damage rect is not intersecting with the root at all, as its maxY is 0.
Comment 3 Shawn Singh 2012-06-01 11:30:58 PDT
OK, I looked at it in detail and found the following:

The test was testing what it needed to, so nothing was really wrong.  However, it was certainly confusing and misleading, and I don't understand why I had written it that way when I originally wrote it.

So I'm about to submit a patch that fixes it to be a little bit more intuitive (as much as this perspective stuff can be...)  and changed the bug title to reflect the actual problem.

Thanks Dana!
Comment 4 Shawn Singh 2012-06-01 11:34:21 PDT
Created attachment 145342 [details]
Patch
Comment 5 Dana Jansens 2012-06-01 11:38:18 PDT
Comment on attachment 145342 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=145342&action=review

Good stuff!

> Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp:366
> +    FloatRect damageWeCareAbout = FloatRect(FloatPoint::zero(), FloatSize(500, 500));
> +    rootDamageRect.intersect(damageWeCareAbout);
> +    EXPECT_FLOAT_RECT_EQ(damageWeCareAbout, rootDamageRect);

What about EXPECT_TRUE(rootdamageRect.contains(rootRect))? I think that's what we're doing in 2 lines here?
Comment 6 Shawn Singh 2012-06-01 11:39:39 PDT
(In reply to comment #5)
> (From update of attachment 145342 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=145342&action=review
> 
> Good stuff!
> 
> > Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp:366
> > +    FloatRect damageWeCareAbout = FloatRect(FloatPoint::zero(), FloatSize(500, 500));
> > +    rootDamageRect.intersect(damageWeCareAbout);
> > +    EXPECT_FLOAT_RECT_EQ(damageWeCareAbout, rootDamageRect);
> 
> What about EXPECT_TRUE(rootdamageRect.contains(rootRect))? I think that's what we're doing in 2 lines here?

sure, sounds even better.
Comment 7 Shawn Singh 2012-06-01 11:41:42 PDT
Created attachment 145344 [details]
Patch
Comment 8 Shawn Singh 2012-06-04 13:20:14 PDT
James could you please review this?  Thanks in advance.
Comment 9 James Robinson 2012-06-04 14:20:59 PDT
Comment on attachment 145344 [details]
Patch

R=me
Comment 10 Shawn Singh 2012-06-04 14:22:26 PDT
Comment on attachment 145344 [details]
Patch

Thanks!
Comment 11 WebKit Review Bot 2012-06-04 15:27:04 PDT
Comment on attachment 145344 [details]
Patch

Clearing flags on attachment: 145344

Committed r119432: <http://trac.webkit.org/changeset/119432>
Comment 12 WebKit Review Bot 2012-06-04 15:27:08 PDT
All reviewed patches have been landed.  Closing bug.