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

Unified Diff: ash/wm/window_manager_unittest.cc

Issue 1372253002: gfx: Make conversions from gfx::Point to PointF explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pointfconvert-gfx: . Created 5 years, 3 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: ash/wm/window_manager_unittest.cc
diff --git a/ash/wm/window_manager_unittest.cc b/ash/wm/window_manager_unittest.cc
index 5bad49d732d104fafa93dc203ce9cbb7f1497ec8..7bb626caabcf7f0b4f5e01ca2b80ac56f172b4f0 100644
--- a/ash/wm/window_manager_unittest.cc
+++ b/ash/wm/window_manager_unittest.cc
@@ -186,7 +186,8 @@ TEST_F(WindowManagerTest, Focus) {
// Touch on a sub-window (w122) to focus it.
gfx::Point click_point = w122->bounds().CenterPoint();
aura::Window::ConvertPointToTarget(w122->parent(), root_window, &click_point);
- ui::TouchEvent touchev(ui::ET_TOUCH_PRESSED, click_point, 0, getTime());
+ ui::TouchEvent touchev(ui::ET_TOUCH_PRESSED, gfx::PointF(click_point), 0,
+ getTime());
details = dispatcher->OnEventFromSource(&touchev);
ASSERT_FALSE(details.dispatcher_destroyed);
focus_client = aura::client::GetFocusClient(w122.get());
@@ -440,7 +441,8 @@ TEST_F(WindowManagerTest, ActivateOnTouch) {
// Touch window2.
gfx::Point press_point = w2->bounds().CenterPoint();
aura::Window::ConvertPointToTarget(w2->parent(), root_window, &press_point);
- ui::TouchEvent touchev1(ui::ET_TOUCH_PRESSED, press_point, 0, getTime());
+ ui::TouchEvent touchev1(ui::ET_TOUCH_PRESSED, gfx::PointF(press_point), 0,
+ getTime());
ui::EventProcessor* dispatcher = root_window->GetHost()->event_processor();
ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&touchev1);
@@ -460,7 +462,8 @@ TEST_F(WindowManagerTest, ActivateOnTouch) {
press_point = w1->bounds().CenterPoint();
aura::Window::ConvertPointToTarget(w1->parent(), root_window, &press_point);
d1.set_activate(false);
- ui::TouchEvent touchev2(ui::ET_TOUCH_PRESSED, press_point, 1, getTime());
+ ui::TouchEvent touchev2(ui::ET_TOUCH_PRESSED, gfx::PointF(press_point), 1,
+ getTime());
details = dispatcher->OnEventFromSource(&touchev2);
ASSERT_FALSE(details.dispatcher_destroyed);
@@ -513,8 +516,8 @@ TEST_F(WindowManagerTest, MouseEventCursors) {
{
// Resize edges and corners show proper cursors.
window_delegate.set_hittest_code(HTBOTTOM);
- ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1,
- ui::EventTimeForNow(), 0, 0);
+ ui::MouseEvent move1(ui::ET_MOUSE_MOVED, gfx::PointF(point1),
+ gfx::PointF(point1), ui::EventTimeForNow(), 0, 0);
ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move1);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::kCursorSouthResize, host->last_cursor().native_type());
@@ -522,8 +525,8 @@ TEST_F(WindowManagerTest, MouseEventCursors) {
{
window_delegate.set_hittest_code(HTBOTTOMLEFT);
- ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2,
- ui::EventTimeForNow(), 0, 0);
+ ui::MouseEvent move2(ui::ET_MOUSE_MOVED, gfx::PointF(point2),
+ gfx::PointF(point2), ui::EventTimeForNow(), 0, 0);
ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move2);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::kCursorSouthWestResize, host->last_cursor().native_type());
@@ -531,8 +534,8 @@ TEST_F(WindowManagerTest, MouseEventCursors) {
{
window_delegate.set_hittest_code(HTBOTTOMRIGHT);
- ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1,
- ui::EventTimeForNow(), 0, 0);
+ ui::MouseEvent move1(ui::ET_MOUSE_MOVED, gfx::PointF(point1),
+ gfx::PointF(point1), ui::EventTimeForNow(), 0, 0);
ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move1);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::kCursorSouthEastResize, host->last_cursor().native_type());
@@ -540,8 +543,8 @@ TEST_F(WindowManagerTest, MouseEventCursors) {
{
window_delegate.set_hittest_code(HTLEFT);
- ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2,
- ui::EventTimeForNow(), 0, 0);
+ ui::MouseEvent move2(ui::ET_MOUSE_MOVED, gfx::PointF(point2),
+ gfx::PointF(point2), ui::EventTimeForNow(), 0, 0);
ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move2);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::kCursorWestResize, host->last_cursor().native_type());
@@ -549,8 +552,8 @@ TEST_F(WindowManagerTest, MouseEventCursors) {
{
window_delegate.set_hittest_code(HTRIGHT);
- ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1,
- ui::EventTimeForNow(), 0, 0);
+ ui::MouseEvent move1(ui::ET_MOUSE_MOVED, gfx::PointF(point1),
+ gfx::PointF(point1), ui::EventTimeForNow(), 0, 0);
ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move1);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::kCursorEastResize, host->last_cursor().native_type());
@@ -558,8 +561,8 @@ TEST_F(WindowManagerTest, MouseEventCursors) {
{
window_delegate.set_hittest_code(HTTOP);
- ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2,
- ui::EventTimeForNow(), 0, 0);
+ ui::MouseEvent move2(ui::ET_MOUSE_MOVED, gfx::PointF(point2),
+ gfx::PointF(point2), ui::EventTimeForNow(), 0, 0);
ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move2);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::kCursorNorthResize, host->last_cursor().native_type());
@@ -567,8 +570,8 @@ TEST_F(WindowManagerTest, MouseEventCursors) {
{
window_delegate.set_hittest_code(HTTOPLEFT);
- ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1,
- ui::EventTimeForNow(), 0, 0);
+ ui::MouseEvent move1(ui::ET_MOUSE_MOVED, gfx::PointF(point1),
+ gfx::PointF(point1), ui::EventTimeForNow(), 0, 0);
ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move1);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::kCursorNorthWestResize, host->last_cursor().native_type());
@@ -576,8 +579,8 @@ TEST_F(WindowManagerTest, MouseEventCursors) {
{
window_delegate.set_hittest_code(HTTOPRIGHT);
- ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2,
- ui::EventTimeForNow(), 0, 0);
+ ui::MouseEvent move2(ui::ET_MOUSE_MOVED, gfx::PointF(point2),
+ gfx::PointF(point2), ui::EventTimeForNow(), 0, 0);
ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move2);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::kCursorNorthEastResize, host->last_cursor().native_type());
@@ -586,8 +589,8 @@ TEST_F(WindowManagerTest, MouseEventCursors) {
{
// Client area uses null cursor.
window_delegate.set_hittest_code(HTCLIENT);
- ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1,
- ui::EventTimeForNow(), 0, 0);
+ ui::MouseEvent move1(ui::ET_MOUSE_MOVED, gfx::PointF(point1),
+ gfx::PointF(point1), ui::EventTimeForNow(), 0, 0);
ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move1);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::kCursorNull, host->last_cursor().native_type());
@@ -619,26 +622,26 @@ TEST_F(WindowManagerTest, MAYBE_TransformActivate) {
d1.SetWindow(w1.get());
w1->Show();
- gfx::Point miss_point(5, 5);
+ gfx::Point3F miss_point(5.f, 5.f, 0.f);
transform.TransformPoint(&miss_point);
- ui::MouseEvent mouseev1(ui::ET_MOUSE_PRESSED, miss_point, miss_point,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent mouseev1(ui::ET_MOUSE_PRESSED, miss_point.AsPointF(),
+ miss_point.AsPointF(), ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
ui::EventProcessor* dispatcher = root_window->GetHost()->event_processor();
ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&mouseev1);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(NULL, aura::client::GetFocusClient(w1.get())->GetFocusedWindow());
- ui::MouseEvent mouseup(ui::ET_MOUSE_RELEASED, miss_point, miss_point,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent mouseup(ui::ET_MOUSE_RELEASED, miss_point.AsPointF(),
+ miss_point.AsPointF(), ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
details = dispatcher->OnEventFromSource(&mouseup);
ASSERT_FALSE(details.dispatcher_destroyed);
- gfx::Point hit_point(5, 15);
+ gfx::Point3F hit_point(5.f, 15.f, 0.f);
transform.TransformPoint(&hit_point);
- ui::MouseEvent mouseev2(ui::ET_MOUSE_PRESSED, hit_point, hit_point,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent mouseev2(ui::ET_MOUSE_PRESSED, hit_point.AsPointF(),
+ hit_point.AsPointF(), ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
details = dispatcher->OnEventFromSource(&mouseev2);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_TRUE(wm::IsActiveWindow(w1.get()));
@@ -672,8 +675,8 @@ TEST_F(WindowManagerTest, AdditionalFilters) {
ui::EventProcessor* dispatcher = root_window->GetHost()->event_processor();
ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&key_event);
ASSERT_FALSE(details.dispatcher_destroyed);
- ui::MouseEvent mouse_pressed(ui::ET_MOUSE_PRESSED, gfx::Point(0, 0),
- gfx::Point(0, 0), ui::EventTimeForNow(), 0, 0);
+ ui::MouseEvent mouse_pressed(ui::ET_MOUSE_PRESSED, gfx::PointF(),
+ gfx::PointF(), ui::EventTimeForNow(), 0, 0);
details = dispatcher->OnEventFromSource(&mouse_pressed);
ASSERT_FALSE(details.dispatcher_destroyed);
@@ -693,8 +696,8 @@ TEST_F(WindowManagerTest, AdditionalFilters) {
// Dispatches events.
details = dispatcher->OnEventFromSource(&key_event);
ASSERT_FALSE(details.dispatcher_destroyed);
- ui::MouseEvent mouse_released(ui::ET_MOUSE_RELEASED, gfx::Point(0, 0),
- gfx::Point(0, 0), ui::EventTimeForNow(), 0, 0);
+ ui::MouseEvent mouse_released(ui::ET_MOUSE_RELEASED, gfx::PointF(),
+ gfx::PointF(), ui::EventTimeForNow(), 0, 0);
details = dispatcher->OnEventFromSource(&mouse_released);
ASSERT_FALSE(details.dispatcher_destroyed);

Powered by Google App Engine
This is Rietveld 408576698