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 // MSVC++ requires this to be set before any other includes to get M_PI. | 5 // MSVC++ requires this to be set before any other includes to get M_PI. |
6 #define _USE_MATH_DEFINES | 6 #define _USE_MATH_DEFINES |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 MotionEventAura event; | 398 MotionEventAura event; |
399 | 399 |
400 // For now, all pointers have an unknown tool type. | 400 // For now, all pointers have an unknown tool type. |
401 // TODO(jdduke): Expand this test when ui::TouchEvent identifies the source | 401 // TODO(jdduke): Expand this test when ui::TouchEvent identifies the source |
402 // touch type, crbug.com/404128. | 402 // touch type, crbug.com/404128. |
403 event.OnTouch(TouchWithType(ET_TOUCH_PRESSED, 7)); | 403 event.OnTouch(TouchWithType(ET_TOUCH_PRESSED, 7)); |
404 ASSERT_EQ(1U, event.GetPointerCount()); | 404 ASSERT_EQ(1U, event.GetPointerCount()); |
405 EXPECT_EQ(MotionEvent::TOOL_TYPE_UNKNOWN, event.GetToolType(0)); | 405 EXPECT_EQ(MotionEvent::TOOL_TYPE_UNKNOWN, event.GetToolType(0)); |
406 } | 406 } |
407 | 407 |
| 408 TEST(MotionEventAuraTest, Flags) { |
| 409 int ids[] = {7, 11}; |
| 410 MotionEventAura event; |
| 411 |
| 412 TouchEvent press0 = TouchWithType(ET_TOUCH_PRESSED, ids[0]); |
| 413 press0.set_flags(EF_CONTROL_DOWN); |
| 414 event.OnTouch(press0); |
| 415 EXPECT_EQ(EF_CONTROL_DOWN, event.GetFlags()); |
| 416 |
| 417 TouchEvent press1 = TouchWithType(ET_TOUCH_PRESSED, ids[1]); |
| 418 press1.set_flags(EF_CONTROL_DOWN | EF_CAPS_LOCK_DOWN); |
| 419 event.OnTouch(press1); |
| 420 EXPECT_EQ(EF_CONTROL_DOWN | EF_CAPS_LOCK_DOWN, event.GetFlags()); |
| 421 } |
| 422 |
408 } // namespace ui | 423 } // namespace ui |
OLD | NEW |