| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/base/touch/selection_bound.h" | 5 #include "ui/base/touch/selection_bound.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "ui/gfx/rect.h" | 8 #include "ui/gfx/geometry/rect.h" |
| 9 | 9 |
| 10 namespace ui { | 10 namespace ui { |
| 11 | 11 |
| 12 TEST(SelectionBoundTest, RectBetweenSelectionBounds) { | 12 TEST(SelectionBoundTest, RectBetweenSelectionBounds) { |
| 13 SelectionBound b1, b2; | 13 SelectionBound b1, b2; |
| 14 // Simple case of aligned vertical bounds of equal height | 14 // Simple case of aligned vertical bounds of equal height |
| 15 b1.SetEdge(gfx::Point(0, 20), gfx::Point(0, 25)); | 15 b1.SetEdge(gfx::Point(0, 20), gfx::Point(0, 25)); |
| 16 b2.SetEdge(gfx::Point(110, 20), gfx::Point(110, 25)); | 16 b2.SetEdge(gfx::Point(110, 20), gfx::Point(110, 25)); |
| 17 gfx::Rect expected_rect( | 17 gfx::Rect expected_rect( |
| 18 b1.edge_top_rounded().x(), | 18 b1.edge_top_rounded().x(), |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 expected_rect = gfx::Rect( | 81 expected_rect = gfx::Rect( |
| 82 b1.edge_bottom_rounded().x(), | 82 b1.edge_bottom_rounded().x(), |
| 83 b1.edge_top_rounded().y(), | 83 b1.edge_top_rounded().y(), |
| 84 b2.edge_bottom_rounded().x() - b1.edge_bottom_rounded().x(), | 84 b2.edge_bottom_rounded().x() - b1.edge_bottom_rounded().x(), |
| 85 b2.edge_bottom_rounded().y() - b2.edge_top_rounded().y()); | 85 b2.edge_bottom_rounded().y() - b2.edge_top_rounded().y()); |
| 86 EXPECT_EQ(expected_rect, RectBetweenSelectionBounds(b1, b2)); | 86 EXPECT_EQ(expected_rect, RectBetweenSelectionBounds(b1, b2)); |
| 87 EXPECT_EQ(expected_rect, RectBetweenSelectionBounds(b2, b1)); | 87 EXPECT_EQ(expected_rect, RectBetweenSelectionBounds(b2, b1)); |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // namespace ui | 90 } // namespace ui |
| OLD | NEW |