Bug 86421 - [chromium] Add unit testing to WebTransformationMatrix.cpp
Summary: [chromium] Add unit testing to WebTransformationMatrix.cpp
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Shawn Singh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-14 17:59 PDT by Shawn Singh
Modified: 2012-05-21 18:29 PDT (History)
5 users (show)

See Also:


Attachments
Patch (30.01 KB, patch)
2012-05-14 19:13 PDT, Shawn Singh
no flags Details | Formatted Diff | Diff
Addressed reviewer comment (30.34 KB, patch)
2012-05-15 14:02 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 Shawn Singh 2012-05-14 17:59:02 PDT
WebTransformationMatrix is going to become the compositor's data type for transforms.  It currently wraps WebCore::TransformationMatrix, and in the future there will be additional implementation of the same interface. However, transformation math is a high profile, high risk black hole for errors... there is a lot of "almost-redundant" code that can have tiny mistakes that are very difficult to find.

So it is probably a good idea to be very aggressive with testing here, going for very tight, specific, and complete test coverage.

This patch will provide all of those tests, except for the mapRect/mapQuad/projectQuad routines that will eventually be removed.  The new mapRect/mapQuad/projectQuad functionality would be in CCMathUtil, and testing does need to be added to that code soon.  Then, after the dust settles from GTFO, WebTransformationMatrix and CCMathUtil could probably be merged.
Comment 1 Shawn Singh 2012-05-14 19:13:36 PDT
Created attachment 141843 [details]
Patch

Note: I also skipped the blend() function for now. Will talk to vollick@ about what coverge he feels exists or is needed before spending time on that.
Comment 2 Shawn Singh 2012-05-15 09:11:50 PDT
(In reply to comment #1)
> Created an attachment (id=141843) [details]
> Patch
> 
> Note: I also skipped the blend() function for now. Will talk to vollick@ about what coverge he feels exists or is needed before spending time on that.

Spoke with him, and we will need to add test coverage for blend(), I would like to do it in a separate patch.  Thanks!
Comment 3 Adrienne Walker 2012-05-15 12:25:58 PDT
Comment on attachment 141843 [details]
Patch

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

> Source/WebKit/chromium/tests/WebTransformationMatrixTest.cpp:234
> +    WebTransformationMatrix B = A;

This isn't assignment, it's copy-initialization via the copy constructor.  The assignment needs to be in a separate statement.

Also, maybe you should test the return value from the assignment operator, e.g. A = B = C.
Comment 4 Shawn Singh 2012-05-15 14:02:32 PDT
Created attachment 142048 [details]
Addressed reviewer comment
Comment 5 Adrienne Walker 2012-05-15 14:13:05 PDT
Comment on attachment 142048 [details]
Addressed reviewer comment

R=me.  I don't quite follow why blend needs to be in a separate patch, but this set of tests looks fine to me.
Comment 6 Shawn Singh 2012-05-15 17:14:39 PDT
Comment on attachment 142048 [details]
Addressed reviewer comment

There was no strong reason, please feel free to cancel the cq if you want them to be together for any reason.

blend() will add another 7-8 tests.  I'm running into challenges trying to figure out why the blending is not as "linear" as I expect for skewY; and testing rotation blending will not be ideal either since they use quaternions; I'll probably just resort to testing the status quo in a few different configurations.
Comment 7 WebKit Review Bot 2012-05-15 18:23:15 PDT
Comment on attachment 142048 [details]
Addressed reviewer comment

Clearing flags on attachment: 142048

Committed r117199: <http://trac.webkit.org/changeset/117199>
Comment 8 WebKit Review Bot 2012-05-15 18:23:21 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Shawn Singh 2012-05-21 18:29:08 PDT
(In reply to comment #6)
> (From update of attachment 142048 [details])
> There was no strong reason, please feel free to cancel the cq if you want them to be together for any reason.
> 
> blend() will add another 7-8 tests.  I'm running into challenges trying to figure out why the blending is not as "linear" as I expect for skewY; and testing rotation blending will not be ideal either since they use quaternions; I'll probably just resort to testing the status quo in a few different configurations.

https://bugs.webkit.org/show_bug.cgi?id=87066 will add unit tests for blend().