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

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

Issue 2647253002: Add tangentialPressure and twist properties to PointerEvent on Windows (Closed)
Patch Set: rotation 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
« no previous file with comments | « ui/events/blink/web_input_event.cc ('k') | ui/events/event.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 EXPECT_EQ(123, webkit_event.windowX); 444 EXPECT_EQ(123, webkit_event.windowX);
445 EXPECT_EQ(321, webkit_event.y); 445 EXPECT_EQ(321, webkit_event.y);
446 EXPECT_EQ(321, webkit_event.windowY); 446 EXPECT_EQ(321, webkit_event.windowY);
447 } 447 }
448 { 448 {
449 // Stylus values for PointerDetails. 449 // Stylus values for PointerDetails.
450 base::TimeTicks timestamp = EventTimeForNow(); 450 base::TimeTicks timestamp = EventTimeForNow();
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 ui_event.set_pointer_details( 454 PointerDetails pointer_details(EventPointerType::POINTER_TYPE_PEN,
455 PointerDetails(EventPointerType::POINTER_TYPE_PEN, 455 /* radius_x */ 0.0f,
456 /* radius_x */ 0.0f, 456 /* radius_y */ 0.0f,
457 /* radius_y */ 0.0f, 457 /* force */ 0.8f,
458 /* force */ 0.8f, 458 /* tilt_x */ 89.5f,
459 /* tilt_x */ 89.5f, 459 /* tilt_y */ -89.5f,
460 /* tilt_y */ -89.5f)); 460 /* tangential_pressure */ 0.6f,
461 /* twist */ 269);
462 ui_event.set_pointer_details(pointer_details);
461 blink::WebMouseEvent webkit_event = 463 blink::WebMouseEvent webkit_event =
462 MakeWebMouseEvent(ui_event, base::Bind(&GetScreenLocationFromEvent)); 464 MakeWebMouseEvent(ui_event, base::Bind(&GetScreenLocationFromEvent));
463 465
464 EXPECT_EQ(blink::WebPointerProperties::PointerType::Pen, 466 EXPECT_EQ(blink::WebPointerProperties::PointerType::Pen,
465 webkit_event.pointerType); 467 webkit_event.pointerType);
466 EXPECT_EQ(90, webkit_event.tiltX); 468 EXPECT_EQ(90, webkit_event.tiltX);
467 EXPECT_EQ(-90, webkit_event.tiltY); 469 EXPECT_EQ(-90, webkit_event.tiltY);
468 EXPECT_FLOAT_EQ(0.8f, webkit_event.force); 470 EXPECT_FLOAT_EQ(0.8f, webkit_event.force);
469 EXPECT_EQ(0.0f, webkit_event.tangentialPressure); 471 EXPECT_FLOAT_EQ(0.6f, webkit_event.tangentialPressure);
470 EXPECT_EQ(0, webkit_event.twist); 472 EXPECT_EQ(269, webkit_event.twist);
471 EXPECT_EQ(123, webkit_event.x); 473 EXPECT_EQ(123, webkit_event.x);
472 EXPECT_EQ(123, webkit_event.windowX); 474 EXPECT_EQ(123, webkit_event.windowX);
473 EXPECT_EQ(321, webkit_event.y); 475 EXPECT_EQ(321, webkit_event.y);
474 EXPECT_EQ(321, webkit_event.windowY); 476 EXPECT_EQ(321, webkit_event.windowY);
475 } 477 }
476 } 478 }
477 479
478 TEST(WebInputEventTest, TestMakeWebMouseWheelEvent) { 480 TEST(WebInputEventTest, TestMakeWebMouseWheelEvent) {
479 { 481 {
480 // Mouse wheel. 482 // Mouse wheel.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 ASSERT_EQ(tests[i].web_type, web_event.type()); 581 ASSERT_EQ(tests[i].web_type, web_event.type());
580 ASSERT_EQ(tests[i].web_modifiers, web_event.modifiers()); 582 ASSERT_EQ(tests[i].web_modifiers, web_event.modifiers());
581 ASSERT_EQ(tests[i].location.x(), web_event.x); 583 ASSERT_EQ(tests[i].location.x(), web_event.x);
582 ASSERT_EQ(tests[i].location.y(), web_event.y); 584 ASSERT_EQ(tests[i].location.y(), web_event.y);
583 ASSERT_EQ(tests[i].screen_location.x(), web_event.globalX); 585 ASSERT_EQ(tests[i].screen_location.x(), web_event.globalX);
584 ASSERT_EQ(tests[i].screen_location.y(), web_event.globalY); 586 ASSERT_EQ(tests[i].screen_location.y(), web_event.globalY);
585 } 587 }
586 } 588 }
587 589
588 } // namespace ui 590 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/blink/web_input_event.cc ('k') | ui/events/event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698