Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(958)

Unified Diff: mojo/services/view_manager/view_coordinate_conversions_unittest.cc

Issue 1092033003: Pulls display related changes from mojo to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/services/view_manager/view_coordinate_conversions_unittest.cc
diff --git a/mojo/services/view_manager/view_coordinate_conversions_unittest.cc b/mojo/services/view_manager/view_coordinate_conversions_unittest.cc
index 2a9a01818ae8e8bcd8a1989862c0ed5630095557..100a06481000729ac0d2646e64e099ca46b00d3e 100644
--- a/mojo/services/view_manager/view_coordinate_conversions_unittest.cc
+++ b/mojo/services/view_manager/view_coordinate_conversions_unittest.cc
@@ -2,13 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "mojo/services/view_manager/view_coordinate_conversions.h"
+
#include "mojo/services/view_manager/server_view.h"
#include "mojo/services/view_manager/server_view_delegate.h"
#include "mojo/services/view_manager/test_server_view_delegate.h"
-#include "mojo/services/view_manager/view_coordinate_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/rect.h"
-#include "ui/gfx/geometry/vector2d.h"
namespace view_manager {
@@ -30,4 +31,28 @@ TEST_F(ViewCoordinateConversionsTest, ConvertRectBetweenViews) {
ConvertRectBetweenViews(&v3, &v1, gfx::Rect(10, 11, 8, 9)));
}
+TEST_F(ViewCoordinateConversionsTest, ConvertPointFBetweenViews) {
+ TestServerViewDelegate d1, d2, d3;
+ ServerView v1(&d1, ViewId()), v2(&d2, ViewId()), v3(&d3, ViewId());
+ v1.SetBounds(gfx::Rect(1, 2, 100, 100));
+ v2.SetBounds(gfx::Rect(3, 4, 100, 100));
+ v3.SetBounds(gfx::Rect(5, 6, 100, 100));
+ v1.Add(&v2);
+ v2.Add(&v3);
+
+ {
+ const gfx::PointF result(
+ ConvertPointFBetweenViews(&v1, &v3, gfx::PointF(10.5f, 11.9f)));
+ EXPECT_FLOAT_EQ(2.5f, result.x());
+ EXPECT_FLOAT_EQ(1.9f, result.y());
+ }
+
+ {
+ const gfx::PointF result(
+ ConvertPointFBetweenViews(&v3, &v1, gfx::PointF(10.2f, 11.4f)));
+ EXPECT_FLOAT_EQ(18.2f, result.x());
+ EXPECT_FLOAT_EQ(21.4f, result.y());
+ }
+}
+
} // namespace view_manager
« no previous file with comments | « mojo/services/view_manager/view_coordinate_conversions.cc ('k') | mojo/services/view_manager/view_locator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698