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

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

Issue 2782893002: WebMouseEvent coordinates are now fractional & private (Closed)
Patch Set: Rebased, fixed a comment in web_input_event_builders_mac.mm 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/win/windows_version.h" 6 #include "base/win/windows_version.h"
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "third_party/WebKit/public/platform/WebInputEvent.h" 9 #include "third_party/WebKit/public/platform/WebInputEvent.h"
10 #include "ui/display/display.h" 10 #include "ui/display/display.h"
(...skipping 15 matching lines...) Expand all
26 display::Display::ResetForceDeviceScaleFactorForTesting(); 26 display::Display::ResetForceDeviceScaleFactorForTesting();
27 27
28 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 28 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
29 command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor, "2"); 29 command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor, "2");
30 30
31 // Synthesize a mouse move with x = 300 and y = 200. 31 // Synthesize a mouse move with x = 300 and y = 200.
32 WebMouseEvent mouse_move = ui::WebMouseEventBuilder::Build( 32 WebMouseEvent mouse_move = ui::WebMouseEventBuilder::Build(
33 ::GetDesktopWindow(), WM_MOUSEMOVE, 0, MAKELPARAM(300, 200), 100, 33 ::GetDesktopWindow(), WM_MOUSEMOVE, 0, MAKELPARAM(300, 200), 100,
34 blink::WebPointerProperties::PointerType::Mouse); 34 blink::WebPointerProperties::PointerType::Mouse);
35 35
36 // The WebMouseEvent.x, WebMouseEvent.y fields should be in pixels 36 // The WebMouseEvent.position field should be in pixels on return and hence
37 // on return and hence should be the same value as the x and y coordinates 37 // should be the same value as the x and y coordinates passed in to the
38 // passed in to the WebMouseEventBuilder::Build function. 38 // WebMouseEventBuilder::Build function.
39 EXPECT_EQ(300, mouse_move.x); 39 EXPECT_EQ(300, mouse_move.positionInWidget().x);
40 EXPECT_EQ(200, mouse_move.y); 40 EXPECT_EQ(200, mouse_move.positionInWidget().y);
41 41
42 // WebMouseEvent.globalX and WebMouseEvent.globalY are calculated in DIPs. 42 // WebMouseEvent.positionInScreen is calculated in DIPs.
43 EXPECT_EQ(150, mouse_move.globalX); 43 EXPECT_EQ(150, mouse_move.positionInScreen().x);
44 EXPECT_EQ(100, mouse_move.globalY); 44 EXPECT_EQ(100, mouse_move.positionInScreen().y);
45 45
46 EXPECT_EQ(blink::WebPointerProperties::PointerType::Mouse, 46 EXPECT_EQ(blink::WebPointerProperties::PointerType::Mouse,
47 mouse_move.pointerType); 47 mouse_move.pointerType);
48 48
49 command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor, "1"); 49 command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor, "1");
50 display::Display::ResetForceDeviceScaleFactorForTesting(); 50 display::Display::ResetForceDeviceScaleFactorForTesting();
51 } 51 }
52 52
53 } // namespace ui 53 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/blink/web_input_event_builders_win.cc ('k') | ui/events/blink/web_input_event_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698