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

Side by Side Diff: ui/events/blink/web_input_event_unittest.cc

Issue 2655303004: Add id properties to PointerEvent (Closed)
Patch Set: pointer id Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/events/blink/web_input_event.h" 5 #include "ui/events/blink/web_input_event.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 MouseEvent ui_event(ET_MOUSE_PRESSED, gfx::Point(123, 321), 451 MouseEvent ui_event(ET_MOUSE_PRESSED, gfx::Point(123, 321),
452 gfx::Point(123, 321), timestamp, EF_LEFT_MOUSE_BUTTON, 452 gfx::Point(123, 321), timestamp, EF_LEFT_MOUSE_BUTTON,
453 EF_LEFT_MOUSE_BUTTON); 453 EF_LEFT_MOUSE_BUTTON);
454 PointerDetails pointer_details(EventPointerType::POINTER_TYPE_PEN, 454 PointerDetails pointer_details(EventPointerType::POINTER_TYPE_PEN,
455 /* radius_x */ 0.0f, 455 /* radius_x */ 0.0f,
456 /* radius_y */ 0.0f, 456 /* radius_y */ 0.0f,
457 /* force */ 0.8f, 457 /* force */ 0.8f,
458 /* tilt_x */ 89.5f, 458 /* tilt_x */ 89.5f,
459 /* tilt_y */ -89.5f, 459 /* tilt_y */ -89.5f,
460 /* tangential_pressure */ 0.6f, 460 /* tangential_pressure */ 0.6f,
461 /* twist */ 269); 461 /* twist */ 269,
462 /* id */ 63);
462 ui_event.set_pointer_details(pointer_details); 463 ui_event.set_pointer_details(pointer_details);
463 blink::WebMouseEvent webkit_event = 464 blink::WebMouseEvent webkit_event =
464 MakeWebMouseEvent(ui_event, base::Bind(&GetScreenLocationFromEvent)); 465 MakeWebMouseEvent(ui_event, base::Bind(&GetScreenLocationFromEvent));
465 466
466 EXPECT_EQ(blink::WebPointerProperties::PointerType::Pen, 467 EXPECT_EQ(blink::WebPointerProperties::PointerType::Pen,
467 webkit_event.pointerType); 468 webkit_event.pointerType);
468 EXPECT_EQ(90, webkit_event.tiltX); 469 EXPECT_EQ(90, webkit_event.tiltX);
469 EXPECT_EQ(-90, webkit_event.tiltY); 470 EXPECT_EQ(-90, webkit_event.tiltY);
470 EXPECT_FLOAT_EQ(0.8f, webkit_event.force); 471 EXPECT_FLOAT_EQ(0.8f, webkit_event.force);
471 EXPECT_FLOAT_EQ(0.6f, webkit_event.tangentialPressure); 472 EXPECT_FLOAT_EQ(0.6f, webkit_event.tangentialPressure);
472 EXPECT_EQ(269, webkit_event.twist); 473 EXPECT_EQ(269, webkit_event.twist);
474 EXPECT_EQ(63, webkit_event.id);
473 EXPECT_EQ(123, webkit_event.x); 475 EXPECT_EQ(123, webkit_event.x);
474 EXPECT_EQ(123, webkit_event.windowX); 476 EXPECT_EQ(123, webkit_event.windowX);
475 EXPECT_EQ(321, webkit_event.y); 477 EXPECT_EQ(321, webkit_event.y);
476 EXPECT_EQ(321, webkit_event.windowY); 478 EXPECT_EQ(321, webkit_event.windowY);
477 } 479 }
478 } 480 }
479 481
480 TEST(WebInputEventTest, TestMakeWebMouseWheelEvent) { 482 TEST(WebInputEventTest, TestMakeWebMouseWheelEvent) {
481 { 483 {
482 // Mouse wheel. 484 // Mouse wheel.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 ASSERT_EQ(tests[i].web_type, web_event.type()); 583 ASSERT_EQ(tests[i].web_type, web_event.type());
582 ASSERT_EQ(tests[i].web_modifiers, web_event.modifiers()); 584 ASSERT_EQ(tests[i].web_modifiers, web_event.modifiers());
583 ASSERT_EQ(tests[i].location.x(), web_event.x); 585 ASSERT_EQ(tests[i].location.x(), web_event.x);
584 ASSERT_EQ(tests[i].location.y(), web_event.y); 586 ASSERT_EQ(tests[i].location.y(), web_event.y);
585 ASSERT_EQ(tests[i].screen_location.x(), web_event.globalX); 587 ASSERT_EQ(tests[i].screen_location.x(), web_event.globalX);
586 ASSERT_EQ(tests[i].screen_location.y(), web_event.globalY); 588 ASSERT_EQ(tests[i].screen_location.y(), web_event.globalY);
587 } 589 }
588 } 590 }
589 591
590 } // namespace ui 592 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698