Chromium Code Reviews
DescriptionAdd platform/transforms pretty printers for logging and testing
This patch switches from a test-only TransformPrinters to a common
pretty printer format for logging and testing in debug and release.
For example, to print the value of an AffineTransform:
AffineTransform transform = AffineTransform::translation(3, 4);
LOG(INFO) << "transform: " << translation.toString();
Which prints:
transform: "translation(3,4)"
In tests, gtests will automatically call the PrintTo functions. For
example:
AffineTransform translation = AffineTransform::translation(7, 9);
AffineTransform rotation;
rotation.rotate(180);
EXPECT_EQ(translation, rotation);
Will fail with:
Actual: "translation(0,0), scale(1,1), angle(3.14159rad), remainder(1,0,0,1)"
Expected: "translation(7,9)"
[ FAILED ] AffineTransformTest.NotEqual (0 ms)
In debuggers, toString() should work as expected. There is also an
optional argument to print the transforms in row-major order.
BUG=632096
Committed: https://crrev.com/54bd1a11aa538122321db5481881cf8603e9bf2e
Cr-Commit-Position: refs/heads/master@{#413504}
Patch Set 1 #Patch Set 2 : Minor formatting cleanup #Patch Set 3 : Minor cleanup #Patch Set 4 : Remove unused code #
Total comments: 7
Patch Set 5 : Update per reviewer comments #Messages
Total messages: 25 (18 generated)
|