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

Unified Diff: ui/aura/window_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: ui/aura/window_unittest.cc
diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc
index 5fc481665ab88f0ba85791a8fa2510d7eeac1690..942198d57b36c8efa1e5fb2119c71e829b4bb5f2 100644
--- a/ui/aura/window_unittest.cc
+++ b/ui/aura/window_unittest.cc
@@ -807,8 +807,8 @@ TEST_F(WindowTest, CaptureTests) {
EXPECT_EQ(2, delegate.mouse_event_count());
delegate.ResetCounts();
- ui::TouchEvent touchev(
- ui::ET_TOUCH_PRESSED, gfx::Point(50, 50), 0, getTime());
+ ui::TouchEvent touchev(ui::ET_TOUCH_PRESSED, gfx::PointF(50.f, 50.f), 0,
+ getTime());
DispatchEventUsingWindowDispatcher(&touchev);
EXPECT_EQ(1, delegate.touch_event_count());
delegate.ResetCounts();
@@ -823,8 +823,8 @@ TEST_F(WindowTest, CaptureTests) {
generator.PressLeftButton();
EXPECT_EQ(1, delegate.mouse_event_count());
- ui::TouchEvent touchev2(
- ui::ET_TOUCH_PRESSED, gfx::Point(250, 250), 1, getTime());
+ ui::TouchEvent touchev2(ui::ET_TOUCH_PRESSED, gfx::PointF(250.f, 250.f), 1,
+ getTime());
DispatchEventUsingWindowDispatcher(&touchev2);
EXPECT_EQ(0, delegate.touch_event_count());
@@ -846,8 +846,8 @@ TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) {
&delegate2, 0, gfx::Rect(50, 50, 50, 50), root_window()));
// Press on w1.
- ui::TouchEvent press1(
- ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime());
+ ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::PointF(10.f, 10.f), 0,
+ getTime());
DispatchEventUsingWindowDispatcher(&press1);
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
EXPECT_EQ(2, delegate1.gesture_event_count());
@@ -861,22 +861,23 @@ TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) {
delegate2.ResetCounts();
// Events are now untargetted.
- ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(10, 20), 0, getTime());
+ ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::PointF(10.f, 20.f), 0,
+ getTime());
DispatchEventUsingWindowDispatcher(&move);
EXPECT_EQ(0, delegate1.gesture_event_count());
EXPECT_EQ(0, delegate1.touch_event_count());
EXPECT_EQ(0, delegate2.gesture_event_count());
EXPECT_EQ(0, delegate2.touch_event_count());
- ui::TouchEvent release(
- ui::ET_TOUCH_RELEASED, gfx::Point(10, 20), 0, getTime());
+ ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::PointF(10.f, 20.f), 0,
+ getTime());
DispatchEventUsingWindowDispatcher(&release);
EXPECT_EQ(0, delegate1.gesture_event_count());
EXPECT_EQ(0, delegate2.gesture_event_count());
// A new press is captured by w2.
- ui::TouchEvent press2(
- ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime());
+ ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::PointF(10.f, 10.f), 0,
+ getTime());
DispatchEventUsingWindowDispatcher(&press2);
EXPECT_EQ(0, delegate1.gesture_event_count());
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
@@ -899,8 +900,7 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) {
base::TimeDelta time = getTime();
const int kTimeDelta = 100;
- ui::TouchEvent press(
- ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, time);
+ ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::PointF(10.f, 10.f), 0, time);
DispatchEventUsingWindowDispatcher(&press);
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
@@ -916,7 +916,7 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) {
// On move We will get TOUCH_MOVED, GESTURE_TAP_CANCEL,
// GESTURE_SCROLL_START and GESTURE_SCROLL_UPDATE.
time += base::TimeDelta::FromMilliseconds(kTimeDelta);
- ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(10, 20), 0, time);
+ ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::PointF(10.f, 20.f), 0, time);
DispatchEventUsingWindowDispatcher(&move);
EXPECT_EQ(1, delegate.touch_event_count());
EXPECT_EQ(3, delegate.gesture_event_count());
@@ -930,7 +930,7 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) {
// On move we still get TOUCH_MOVED and GESTURE_SCROLL_UPDATE.
time += base::TimeDelta::FromMilliseconds(kTimeDelta);
- ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(10, 30), 0, time);
+ ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::PointF(10.f, 30.f), 0, time);
DispatchEventUsingWindowDispatcher(&move2);
EXPECT_EQ(1, delegate.touch_event_count());
EXPECT_EQ(1, delegate.gesture_event_count());
@@ -938,8 +938,8 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) {
// And on release we get TOUCH_RELEASED, GESTURE_SCROLL_END, GESTURE_END
time += base::TimeDelta::FromMilliseconds(kTimeDelta);
- ui::TouchEvent release(
- ui::ET_TOUCH_RELEASED, gfx::Point(10, 20), 0, time);
+ ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::PointF(10.f, 20.f), 0,
+ time);
DispatchEventUsingWindowDispatcher(&release);
EXPECT_EQ(1, delegate.touch_event_count());
EXPECT_EQ(2, delegate.gesture_event_count());
@@ -952,7 +952,8 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) {
CaptureWindowDelegateImpl d1;
scoped_ptr<Window> w1(CreateTestWindowWithDelegate(
&d1, 0, gfx::Rect(0, 0, 20, 20), root_window()));
- ui::TouchEvent p1(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime());
+ ui::TouchEvent p1(ui::ET_TOUCH_PRESSED, gfx::PointF(10.f, 10.f), 0,
+ getTime());
DispatchEventUsingWindowDispatcher(&p1);
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
EXPECT_EQ(1, d1.touch_event_count());
@@ -963,7 +964,8 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) {
CaptureWindowDelegateImpl d2;
scoped_ptr<Window> w2(CreateTestWindowWithDelegate(
&d2, 0, gfx::Rect(40, 0, 40, 20), root_window()));
- ui::TouchEvent p2(ui::ET_TOUCH_PRESSED, gfx::Point(41, 10), 1, getTime());
+ ui::TouchEvent p2(ui::ET_TOUCH_PRESSED, gfx::PointF(41.f, 10.f), 1,
+ getTime());
DispatchEventUsingWindowDispatcher(&p2);
EXPECT_EQ(0, d1.touch_event_count());
EXPECT_EQ(0, d1.gesture_event_count());
@@ -998,7 +1000,8 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) {
// Move touch id originally associated with |w2|. The touch has been
// cancelled, so no events should be dispatched.
- ui::TouchEvent m3(ui::ET_TOUCH_MOVED, gfx::Point(110, 105), 1, getTime());
+ ui::TouchEvent m3(ui::ET_TOUCH_MOVED, gfx::PointF(110.f, 105.f), 1,
+ getTime());
DispatchEventUsingWindowDispatcher(&m3);
EXPECT_EQ(0, d1.touch_event_count());
EXPECT_EQ(0, d1.gesture_event_count());
@@ -1017,7 +1020,8 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) {
EXPECT_EQ(0, d3.gesture_event_count());
// The touch has been cancelled, so no events are dispatched.
- ui::TouchEvent m4(ui::ET_TOUCH_MOVED, gfx::Point(120, 105), 1, getTime());
+ ui::TouchEvent m4(ui::ET_TOUCH_MOVED, gfx::PointF(120.f, 105.f), 1,
+ getTime());
DispatchEventUsingWindowDispatcher(&m4);
EXPECT_EQ(0, d1.touch_event_count());
EXPECT_EQ(0, d1.gesture_event_count());
@@ -1247,7 +1251,7 @@ TEST_F(WindowTest, WindowTreeHostExit) {
EXPECT_FALSE(d1.exited());
d1.ResetExpectations();
- ui::MouseEvent exit_event(ui::ET_MOUSE_EXITED, gfx::Point(), gfx::Point(),
+ ui::MouseEvent exit_event(ui::ET_MOUSE_EXITED, gfx::PointF(), gfx::PointF(),
ui::EventTimeForNow(), 0, 0);
DispatchEventUsingWindowDispatcher(&exit_event);
EXPECT_FALSE(d1.entered());
@@ -1621,8 +1625,8 @@ TEST_F(WindowTest, TransformGesture) {
transform.Rotate(90.0);
host()->SetRootTransform(transform);
- ui::TouchEvent press(
- ui::ET_TOUCH_PRESSED, gfx::Point(size.height() - 10, 10), 0, getTime());
+ ui::TouchEvent press(ui::ET_TOUCH_PRESSED,
+ gfx::PointF(size.height() - 10.f, 10.f), 0, getTime());
DispatchEventUsingWindowDispatcher(&press);
EXPECT_EQ(gfx::Point(10, 10).ToString(), delegate->position().ToString());
}

Powered by Google App Engine
This is Rietveld 408576698