forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide gtest printers for ui/gfx geometry types
This provides PrintTo(..) functions for the geometric types in ui/gfx/ so that failing gtest assertions pretty-print the values instead of dumping the bytes of the objects. This way gtest assertions on these types can be written in the form: EXPECT_EQ(a, b); instead of EXPECT_EQ(a.ToString(), b.ToString()); which is currently used (inconsistently) to provide more readable failure messages. This is a bit tricky since gtest uses streams and somewhat complicated template expansion magic to pretty print values and we don't want to link the stream-based code into production code paths. This declares the PrintTo() functions in the headers defining each of the geometry types, using the <iosfwd> header to keep stream bloat to a minimum, and defines the formatters in gfx_test_support. This way every test that instantiates these printers has to declare a dependency on gfx_test_support or it fails to link, but a test does not have to #include any particular header to see the correct printer declaration and thus expand the template correctly. If we were to declare the PrintTo() functions in a test only header such a gfx_util.h then the pretty printers would work reliably only if *every* target in a translation unit that instantiated the comparison saw this declaration. If some unit tests in a target #included the header and some did not then it would be intederminate whether the template instantiation linked in to the test binary was the pretty printed one or the hex dump one (and in practice this appears to be inconsistent across clang and gcc for whatever reason). Review URL: https://codereview.chromium.org/368903003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282270 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
jamesr@chromium.org
committed
Jul 10, 2014
1 parent
a5a068d
commit a109fd0
Showing
28 changed files
with
256 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.