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

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

Issue 2786693002: Add PointerDetails to ui::MouseEvent's constructors (Closed)
Patch Set: mouse constructor Created 3 years, 8 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 EXPECT_EQ(0, webkit_event.tiltY); 421 EXPECT_EQ(0, webkit_event.tiltY);
422 EXPECT_TRUE(std::isnan(webkit_event.force)); 422 EXPECT_TRUE(std::isnan(webkit_event.force));
423 EXPECT_EQ(0.0f, webkit_event.tangentialPressure); 423 EXPECT_EQ(0.0f, webkit_event.tangentialPressure);
424 EXPECT_EQ(0, webkit_event.twist); 424 EXPECT_EQ(0, webkit_event.twist);
425 EXPECT_EQ(123, webkit_event.x); 425 EXPECT_EQ(123, webkit_event.x);
426 EXPECT_EQ(321, webkit_event.y); 426 EXPECT_EQ(321, webkit_event.y);
427 } 427 }
428 { 428 {
429 // Stylus values for PointerDetails. 429 // Stylus values for PointerDetails.
430 base::TimeTicks timestamp = EventTimeForNow(); 430 base::TimeTicks timestamp = EventTimeForNow();
431 MouseEvent ui_event(ET_MOUSE_PRESSED, gfx::Point(123, 321),
432 gfx::Point(123, 321), timestamp, EF_LEFT_MOUSE_BUTTON,
433 EF_LEFT_MOUSE_BUTTON);
434 PointerDetails pointer_details(EventPointerType::POINTER_TYPE_PEN, 431 PointerDetails pointer_details(EventPointerType::POINTER_TYPE_PEN,
435 /* id */ 63, 432 /* id */ 63,
436 /* radius_x */ 0.0f, 433 /* radius_x */ 0.0f,
437 /* radius_y */ 0.0f, 434 /* radius_y */ 0.0f,
438 /* force */ 0.8f, 435 /* force */ 0.8f,
439 /* tilt_x */ 89.5f, 436 /* tilt_x */ 89.5f,
440 /* tilt_y */ -89.5f, 437 /* tilt_y */ -89.5f,
441 /* tangential_pressure */ 0.6f, 438 /* tangential_pressure */ 0.6f,
442 /* twist */ 269); 439 /* twist */ 269);
443 ui_event.set_pointer_details(pointer_details); 440 MouseEvent ui_event(ET_MOUSE_PRESSED, gfx::Point(123, 321),
441 gfx::Point(123, 321), timestamp, EF_LEFT_MOUSE_BUTTON,
442 EF_LEFT_MOUSE_BUTTON, pointer_details);
444 blink::WebMouseEvent webkit_event = 443 blink::WebMouseEvent webkit_event =
445 MakeWebMouseEvent(ui_event, base::Bind(&GetScreenLocationFromEvent)); 444 MakeWebMouseEvent(ui_event, base::Bind(&GetScreenLocationFromEvent));
446 445
447 EXPECT_EQ(blink::WebPointerProperties::PointerType::Pen, 446 EXPECT_EQ(blink::WebPointerProperties::PointerType::Pen,
448 webkit_event.pointerType); 447 webkit_event.pointerType);
449 EXPECT_EQ(90, webkit_event.tiltX); 448 EXPECT_EQ(90, webkit_event.tiltX);
450 EXPECT_EQ(-90, webkit_event.tiltY); 449 EXPECT_EQ(-90, webkit_event.tiltY);
451 EXPECT_FLOAT_EQ(0.8f, webkit_event.force); 450 EXPECT_FLOAT_EQ(0.8f, webkit_event.force);
452 EXPECT_FLOAT_EQ(0.6f, webkit_event.tangentialPressure); 451 EXPECT_FLOAT_EQ(0.6f, webkit_event.tangentialPressure);
453 EXPECT_EQ(269, webkit_event.twist); 452 EXPECT_EQ(269, webkit_event.twist);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 ASSERT_EQ(tests[i].web_type, web_event.type()); 558 ASSERT_EQ(tests[i].web_type, web_event.type());
560 ASSERT_EQ(tests[i].web_modifiers, web_event.modifiers()); 559 ASSERT_EQ(tests[i].web_modifiers, web_event.modifiers());
561 ASSERT_EQ(tests[i].location.x(), web_event.x); 560 ASSERT_EQ(tests[i].location.x(), web_event.x);
562 ASSERT_EQ(tests[i].location.y(), web_event.y); 561 ASSERT_EQ(tests[i].location.y(), web_event.y);
563 ASSERT_EQ(tests[i].screen_location.x(), web_event.globalX); 562 ASSERT_EQ(tests[i].screen_location.x(), web_event.globalX);
564 ASSERT_EQ(tests[i].screen_location.y(), web_event.globalY); 563 ASSERT_EQ(tests[i].screen_location.y(), web_event.globalY);
565 } 564 }
566 } 565 }
567 566
568 } // namespace ui 567 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698