diff options
| author | Sam Spilsbury <sam.spilsbury@canonical.com> | 2012-12-08 10:54:24 +0800 | 
|---|---|---|
| committer | Sam Spilsbury <sam.spilsbury@canonical.com> | 2012-12-08 10:54:24 +0800 | 
| commit | 493ac2282c9fe85da79ccca8fef54f6395b84256 (patch) | |
| tree | 69162c466535c572d8090eebb382b27d16333606 | |
| parent | 5bd83df2b50ea766f6050b03fcf79a9895fc31b4 (diff) | |
Remove applyDelta - lets move this to nux instead
(bzr r2954.2.2)
| -rw-r--r-- | tests/test_unityshell_private.cpp | 52 | ||||
| -rw-r--r-- | unity-shared/DeltaRestrainment.cpp | 25 | 
2 files changed, 12 insertions, 65 deletions
| diff --git a/tests/test_unityshell_private.cpp b/tests/test_unityshell_private.cpp index 79cebe39d..0f645cd47 100644 --- a/tests/test_unityshell_private.cpp +++ b/tests/test_unityshell_private.cpp @@ -51,7 +51,7 @@ TEST(DeltaRestrainment, RestrainOutWidth)  int x = 1;  int y = 0; - util::restrainDelta (x, y, Rectangle, PointBR); + util::restrainDelta(x, y, Rectangle, PointBR);  EXPECT_EQ (x, 0);  EXPECT_EQ (y, 0); @@ -62,7 +62,7 @@ TEST(DeltaRestrainment, RestrainOutHeight)  int x = 0;  int y = 1; - util::restrainDelta (x, y, Rectangle, PointBR); + util::restrainDelta(x, y, Rectangle, PointBR);  EXPECT_EQ (x, 0);  EXPECT_EQ (y, 0); @@ -73,7 +73,7 @@ TEST(DeltaRestrainment, RestrainOutX)  int x = -1;  int y = 0; - util::restrainDelta (x, y, Rectangle, PointTL); + util::restrainDelta(x, y, Rectangle, PointTL);  EXPECT_EQ (x, 0);  EXPECT_EQ (y, 0); @@ -84,51 +84,7 @@ TEST(DeltaRestrainment, RestrainOutY)  int x = 0;  int y = -1; - util::restrainDelta (x, y, Rectangle, PointTL); - - EXPECT_EQ (x, 0); - EXPECT_EQ (y, 0); -} - -TEST(ApplyDelta, ApplyPosX) -{ - int x = 0; - int y = 0; - - util::applyDelta (1, 0, x, y); - - EXPECT_EQ (x, 1); - EXPECT_EQ (y, 0); -} - -TEST(ApplyDelta, ApplyPosY) -{ - int x = 0; - int y = 0; - - util::applyDelta (0, 1, x, y); - - EXPECT_EQ (x, 0); - EXPECT_EQ (y, 1); -} - -TEST(ApplyDelta, ApplyNegX) -{ - int x = 1; - int y = 0; - - util::applyDelta (-1, 0, x, y); - - EXPECT_EQ (x, 0); - EXPECT_EQ (y, 0); -} - -TEST(ApplyDelta, ApplyNegY) -{ - int x = 0; - int y = 1; - - util::applyDelta (0, -1, x, y); + util::restrainDelta(x, y, Rectangle, PointTL);  EXPECT_EQ (x, 0);  EXPECT_EQ (y, 0); diff --git a/unity-shared/DeltaRestrainment.cpp b/unity-shared/DeltaRestrainment.cpp index 4d4e635a6..2903ad623 100644 --- a/unity-shared/DeltaRestrainment.cpp +++ b/unity-shared/DeltaRestrainment.cpp @@ -23,26 +23,17 @@  #include "DeltaRestrainment-Inl.h"  void -unity::util::restrainDelta (int &dx, - int &dy, - const nux::Geometry &rect, - const nux::Point ¤tPoint) +unity::util::restrainDelta(int &dx, + int &dy, + nux::Geometry const &rect, + nux::Point const ¤tPoint)  { - int restrain_x = std::min (0, (rect.x + rect.width) - (currentPoint.x + dx)); - int restrain_y = std::min (0, (rect.y + rect.height) - (currentPoint.y + dy)); + int restrain_x = std::min(0, (rect.x + rect.width) - (currentPoint.x + dx)); + int restrain_y = std::min(0, (rect.y + rect.height) - (currentPoint.y + dy)); - restrain_x += rect.x - std::min (rect.x, currentPoint.x + dx); - restrain_y += rect.y - std::min (rect.y, currentPoint.y + dy); + restrain_x += rect.x - std::min(rect.x, currentPoint.x + dx); + restrain_y += rect.y - std::min(rect.y, currentPoint.y + dy);  dx += restrain_x;  dy += restrain_y;  } - -void unity::util::applyDelta (int dx, - int dy, - int &x, - int &y) -{ - x += dx; - y += dy; -} | 
