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

Unified Diff: ui/aura/root_window_unittest.cc

Issue 12423007: Short term workaround to deal with calculation error caused by inverted matrix. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix argument order Created 7 years, 9 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/aura/root_window.cc ('k') | ui/aura/test/event_generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/root_window_unittest.cc
diff --git a/ui/aura/root_window_unittest.cc b/ui/aura/root_window_unittest.cc
index 8ff53c782c17bf45b6c4763aad5963f5e700119a..43b43ca3ec529a6479d454cb56cd9ec29d68079d 100644
--- a/ui/aura/root_window_unittest.cc
+++ b/ui/aura/root_window_unittest.cc
@@ -25,6 +25,7 @@
#include "ui/gfx/point.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/screen.h"
+#include "ui/gfx/transform.h"
namespace aura {
namespace {
@@ -208,6 +209,47 @@ TEST_F(RootWindowTest, TranslatedEvent) {
EXPECT_EQ("100,100", translated_event.root_location().ToString());
}
+#if defined(OS_CHROMEOS)
+// Make sure the mouse location is translated within the root
+// window. crbug.com/222483.
+TEST_F(RootWindowTest, KeepTranslatedEventInRoot) {
+ // Clockwise.
+ gfx::Transform rotate;
+ rotate.Translate(599, 0);
+ rotate.Rotate(90);
+ root_window()->SetTransform(rotate);
+
+ gfx::Point top_edge_on_host(100, 0);
+ ui::MouseEvent top_event(ui::ET_MOUSE_PRESSED,
+ top_edge_on_host,
+ top_edge_on_host, 0);
+ root_window()->TransformEventForDeviceScaleFactor(true, &top_event);
+ EXPECT_TRUE(root_window()->bounds().Contains(top_event.location()));
+
+ // Counter clockwise.
+ rotate.MakeIdentity();
+ rotate.Translate(0, 799);
+ rotate.Rotate(270);
+ root_window()->SetTransform(rotate);
+
+ gfx::Point bottom_edge_on_host(500, 799);
+ ui::MouseEvent bottom_event(ui::ET_MOUSE_PRESSED,
+ bottom_edge_on_host,
+ bottom_edge_on_host, 0);
+ root_window()->TransformEventForDeviceScaleFactor(true, &bottom_event);
+ EXPECT_TRUE(root_window()->bounds().Contains(bottom_event.location()));
+
+ // The locaion can be outside if |keep_inside_root| is false.
+ ui::MouseEvent bottom_event_outside(ui::ET_MOUSE_PRESSED,
+ bottom_edge_on_host,
+ bottom_edge_on_host, 0);
+ root_window()->TransformEventForDeviceScaleFactor(false,
+ &bottom_event_outside);
+ EXPECT_FALSE(root_window()->bounds().Contains(
+ bottom_event_outside.location()));
+}
+#endif
+
namespace {
class TestEventClient : public client::EventClient {
« no previous file with comments | « ui/aura/root_window.cc ('k') | ui/aura/test/event_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698