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

Unified Diff: ui/events/event_unittest.cc

Issue 1906603002: mus: Fix event transformation in client code. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/event.cc ('k') | ui/views/mus/window_tree_host_mus.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/event_unittest.cc
diff --git a/ui/events/event_unittest.cc b/ui/events/event_unittest.cc
index 9a3efb1564a2e2d2dd9e87821634879b8f88801f..ee4b6fd75965026698302dce9f92597e5734548a 100644
--- a/ui/events/event_unittest.cc
+++ b/ui/events/event_unittest.cc
@@ -16,6 +16,7 @@
#include "ui/events/keycodes/dom/dom_code.h"
#include "ui/events/keycodes/dom/keycode_converter.h"
#include "ui/events/test/events_test_utils.h"
+#include "ui/gfx/transform.h"
#if defined(USE_X11)
#include <X11/Xlib.h>
@@ -425,6 +426,20 @@ TEST(EventTest, KeyEventCode) {
#endif // OS_WIN
}
+TEST(EventTest, LocatedEventTransform) {
+ const gfx::Point root_location(10, 20);
+ const gfx::Point location(0, 14);
+ MouseEvent mouseev(ET_MOUSE_MOVED, location, root_location,
+ EventTimeForNow(), EF_NONE, EF_NONE);
+ gfx::Transform transform;
+ transform.Scale(0.5, 0.5);
+ mouseev.UpdateForRootTransform(transform);
+ EXPECT_EQ(gfx::Point(5, 10).ToString(),
+ mouseev.root_location().ToString());
+ EXPECT_EQ(gfx::Point(0, 7).ToString(),
+ mouseev.location().ToString());
+}
+
namespace {
#if defined(USE_X11)
void SetKeyEventTimestamp(XEvent* event, long time) {
« no previous file with comments | « ui/events/event.cc ('k') | ui/views/mus/window_tree_host_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698