diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-23 17:26:37 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-23 17:26:37 +0000 |
commit | 379b0d60d227f67a2c6960128a289ac81ccc00f8 (patch) | |
tree | 4a1be7e7be3d9c3f70daa723b78311350dce8e14 /ui/aura/root_window_unittest.cc | |
parent | 7781d121ca4b546f3989e00fe113c989ac479417 (diff) | |
download | chromium_src-379b0d60d227f67a2c6960128a289ac81ccc00f8.zip chromium_src-379b0d60d227f67a2c6960128a289ac81ccc00f8.tar.gz chromium_src-379b0d60d227f67a2c6960128a289ac81ccc00f8.tar.bz2 |
Short term workaround to deal with calculation error caused by inverted matrix.
I'll work on better fix for m28 as described in the bug.
BUG=222483
TEST=autohide launcher works on any side (lefr,right,top,bottom) when display is rotated.
Review URL: https://chromiumcodereview.appspot.com/12423007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190037 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura/root_window_unittest.cc')
-rw-r--r-- | ui/aura/root_window_unittest.cc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/ui/aura/root_window_unittest.cc b/ui/aura/root_window_unittest.cc index 8ff53c7..43b43ca 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 { |