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 // Needed on Windows to get |M_PI| from <cmath>. | 5 // Needed on Windows to get |M_PI| from <cmath>. |
6 #ifdef _WIN32 | 6 #ifdef _WIN32 |
7 #define _USE_MATH_DEFINES | 7 #define _USE_MATH_DEFINES |
8 #endif | 8 #endif |
9 | 9 |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 EXPECT_EQ(gfx::ToFlooredInt(pos.x()), web_event.x); | 96 EXPECT_EQ(gfx::ToFlooredInt(pos.x()), web_event.x); |
97 EXPECT_EQ(gfx::ToFlooredInt(pos.y()), web_event.y); | 97 EXPECT_EQ(gfx::ToFlooredInt(pos.y()), web_event.y); |
98 EXPECT_EQ(gfx::ToFlooredInt(raw_pos.x()), web_event.globalX); | 98 EXPECT_EQ(gfx::ToFlooredInt(raw_pos.x()), web_event.globalX); |
99 EXPECT_EQ(gfx::ToFlooredInt(raw_pos.y()), web_event.globalY); | 99 EXPECT_EQ(gfx::ToFlooredInt(raw_pos.y()), web_event.globalY); |
100 EXPECT_EQ(blink::WebGestureDeviceTouchscreen, web_event.sourceDevice); | 100 EXPECT_EQ(blink::WebGestureDeviceTouchscreen, web_event.sourceDevice); |
101 EXPECT_EQ(delta.x(), web_event.data.scrollUpdate.deltaX); | 101 EXPECT_EQ(delta.x(), web_event.data.scrollUpdate.deltaX); |
102 EXPECT_EQ(delta.y(), web_event.data.scrollUpdate.deltaY); | 102 EXPECT_EQ(delta.y(), web_event.data.scrollUpdate.deltaY); |
103 EXPECT_TRUE(web_event.data.scrollUpdate.previousUpdateInSequencePrevented); | 103 EXPECT_TRUE(web_event.data.scrollUpdate.previousUpdateInSequencePrevented); |
104 } | 104 } |
105 | 105 |
| 106 TEST(WebInputEventUtilTest, TouchMinorOfZeroUsesTouchMajor) { |
| 107 const float nonZeroMajorAxisLength = 36; |
| 108 |
| 109 // Test zeroed minor axis. |
| 110 ui::PointerProperties pointer(5, 10, 40); |
| 111 pointer.touch_major = nonZeroMajorAxisLength; |
| 112 pointer.touch_minor = 0; |
| 113 MotionEventGeneric event( |
| 114 MotionEvent::ACTION_DOWN, base::TimeTicks::Now(), pointer); |
| 115 |
| 116 WebTouchEvent actual_event = CreateWebTouchEventFromMotionEvent(event, false); |
| 117 EXPECT_EQ(nonZeroMajorAxisLength / 2, actual_event.touches[0].radiusX); |
| 118 EXPECT_EQ(nonZeroMajorAxisLength / 2, actual_event.touches[0].radiusY); |
| 119 } |
| 120 |
106 } // namespace content | 121 } // namespace content |
OLD | NEW |