summaryrefslogtreecommitdiffstats
path: root/ui/gfx/vector2d_unittest.cc
Commit message (Collapse)AuthorAgeFilesLines
* Fix a couple test cases where we should be doing floating point comparisons.thestig@chromium.org2013-01-091-5/+5
| | | | | | Review URL: https://chromiumcodereview.appspot.com/11776034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175620 0039d316-1c4b-4281-b951-d872f2087c98
* ui: Add methods to clamp Sizes, Points, and Vectors from above or below.danakj@chromium.org2012-11-101-0/+52
| | | | | | | | | | | | | | | | | | Tests: PointTest.Clamp PointTest.ClampF SizeTest.Clamp SizeTest.ClampF Vector2dTest.Clamp Vector2dTest.ClampF Vector3dTest.ClampF R=sky,enne BUG=147395 Review URL: https://codereview.chromium.org/11361186 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167014 0039d316-1c4b-4281-b951-d872f2087c98
* ui: Add non-member Vector2dScale() and Vector3dScale() methods to create ↵danakj@chromium.org2012-11-091-0/+12
| | | | | | | | | | | | | | | | | scaled vectors These behave like similar methods for Rect/Point/Size. Tests: ui_unittests:Vector2dTest.Scale ui_unittests:Vector3dTest.Scale R=sky BUG=160158 Review URL: https://codereview.chromium.org/11293193 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166993 0039d316-1c4b-4281-b951-d872f2087c98
* ui/gfx: Put unittests back into gfx namespace.tfarina@chromium.org2012-11-021-40/+40
| | | | | | | | | TEST=ui_unittests R=sky@chromium.org Review URL: https://codereview.chromium.org/11360043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165761 0039d316-1c4b-4281-b951-d872f2087c98
* Add Vector2d classes that represent offsets, instead of using Point.danakj@chromium.org2012-10-311-0/+186
Previously Point served two purposes, to be a position in 2d space, and also an offset from the origin. This introduces a Vector2d class to represent an offset, allowing typesafety checks for geometric operations. The following are now the case: Point +/- Vector = Point - A point plus/minus an offset gives you a point at a position offset by the vector. Vector +/- Vector = Vector - Two offsets can be added together to make a new offset. Point - Point = Vector - Subtracting one point from another gives you the offset between the two points. We add some new methods to perform these operations: Rect::OffsetFromOrigin() gives the offset between the position of the rect and the origin. Point::OffsetFromOrigin() gives the offset between the point and the origin. PointAtOffsetFromOrigin(Vector2d) converts a Vector2d to a Point at the given offset away from the origin. Rect::Offset(), Point::Add(), and Point::Subtract() now receive a Vector2d instead of a point. BUG=147395 R=sky Review URL: https://codereview.chromium.org/11269022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165198 0039d316-1c4b-4281-b951-d872f2087c98