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

Side by Side Diff: ui/aura/window_unittest.cc

Issue 8374005: aura: Try to make Linux host resize code more reliable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reset host win position when wm isn't running Created 9 years, 2 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 | Annotate | Revision Log
« ui/aura/desktop_host_linux.cc ('K') | « ui/aura/desktop_host_linux.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/aura/window.h" 5 #include "ui/aura/window.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 EXPECT_TRUE(root->IsOrContainsFullscreenWindow()); 940 EXPECT_TRUE(root->IsOrContainsFullscreenWindow());
941 941
942 w11->Hide(); 942 w11->Hide();
943 EXPECT_FALSE(root->IsOrContainsFullscreenWindow()); 943 EXPECT_FALSE(root->IsOrContainsFullscreenWindow());
944 } 944 }
945 945
946 #if !defined(OS_WIN) 946 #if !defined(OS_WIN)
947 // Tests transformation on the desktop. 947 // Tests transformation on the desktop.
948 TEST_F(WindowTest, Transform) { 948 TEST_F(WindowTest, Transform) {
949 Desktop* desktop = Desktop::GetInstance(); 949 Desktop* desktop = Desktop::GetInstance();
950 gfx::Size size(200, 300);
951 desktop->SetHostSize(size);
952 desktop->ShowDesktop(); 950 desktop->ShowDesktop();
953 951 gfx::Size size = desktop->GetHostSize();
954 EXPECT_EQ(gfx::Rect(size), gfx::Rect(desktop->GetHostSize()));
955 EXPECT_EQ(gfx::Rect(size), 952 EXPECT_EQ(gfx::Rect(size),
956 gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point())); 953 gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point()));
957 954
958 // Rotate it clock-wise 90 degrees. 955 // Rotate it clock-wise 90 degrees.
959 ui::Transform transform; 956 ui::Transform transform;
960 transform.SetRotate(90.0f); 957 transform.SetRotate(90.0f);
961 transform.ConcatTranslate(size.width(), 0); 958 transform.ConcatTranslate(size.width(), 0);
962 desktop->SetTransform(transform); 959 desktop->SetTransform(transform);
963 960
964 // The size should be the transformed size. 961 // The size should be the transformed size.
965 EXPECT_EQ(gfx::Rect(0, 0, 300, 200), gfx::Rect(desktop->GetHostSize())); 962 gfx::Size transformed_size(size.height(), size.width());
966 EXPECT_EQ(gfx::Rect(0, 0, 300, 200), desktop->bounds()); 963 EXPECT_EQ(transformed_size.ToString(), desktop->GetHostSize().ToString());
967 EXPECT_EQ(gfx::Rect(0, 0, 300, 200), 964 EXPECT_EQ(gfx::Rect(gfx::Point(), transformed_size).ToString(),
968 gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point())); 965 desktop->bounds().ToString());
966 EXPECT_EQ(gfx::Rect(gfx::Point(), transformed_size).ToString(),
967 gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point()).ToString());
969 968
970 ActivateWindowDelegate d1; 969 ActivateWindowDelegate d1;
971 scoped_ptr<Window> w1( 970 scoped_ptr<Window> w1(
972 CreateTestWindowWithDelegate(&d1, 1, gfx::Rect(0, 10, 50, 50), NULL)); 971 CreateTestWindowWithDelegate(&d1, 1, gfx::Rect(0, 10, 50, 50), NULL));
973 w1->Show(); 972 w1->Show();
974 973
974 gfx::Point miss_point(5, 5);
975 transform.TransformPoint(miss_point);
975 MouseEvent mouseev1(ui::ET_MOUSE_PRESSED, 976 MouseEvent mouseev1(ui::ET_MOUSE_PRESSED,
976 gfx::Point(195, 5), ui::EF_LEFT_BUTTON_DOWN); 977 miss_point,
978 ui::EF_LEFT_BUTTON_DOWN);
977 desktop->DispatchMouseEvent(&mouseev1); 979 desktop->DispatchMouseEvent(&mouseev1);
978 EXPECT_FALSE(w1->GetFocusManager()->GetFocusedWindow()); 980 EXPECT_FALSE(w1->GetFocusManager()->GetFocusedWindow());
979 MouseEvent mouseup(ui::ET_MOUSE_RELEASED, 981 MouseEvent mouseup(ui::ET_MOUSE_RELEASED,
980 gfx::Point(195, 5), ui::EF_LEFT_BUTTON_DOWN); 982 miss_point,
983 ui::EF_LEFT_BUTTON_DOWN);
981 desktop->DispatchMouseEvent(&mouseup); 984 desktop->DispatchMouseEvent(&mouseup);
982 985
986 gfx::Point hit_point(5, 15);
987 transform.TransformPoint(hit_point);
983 MouseEvent mouseev2(ui::ET_MOUSE_PRESSED, 988 MouseEvent mouseev2(ui::ET_MOUSE_PRESSED,
984 gfx::Point(185, 5), ui::EF_LEFT_BUTTON_DOWN); 989 hit_point,
990 ui::EF_LEFT_BUTTON_DOWN);
985 desktop->DispatchMouseEvent(&mouseev2); 991 desktop->DispatchMouseEvent(&mouseev2);
986 EXPECT_EQ(w1.get(), desktop->active_window()); 992 EXPECT_EQ(w1.get(), desktop->active_window());
987 EXPECT_EQ(w1.get(), w1->GetFocusManager()->GetFocusedWindow()); 993 EXPECT_EQ(w1.get(), w1->GetFocusManager()->GetFocusedWindow());
988 } 994 }
989 #endif 995 #endif
990 996
991 class ToplevelWindowTest : public WindowTest { 997 class ToplevelWindowTest : public WindowTest {
992 public: 998 public:
993 ToplevelWindowTest() {} 999 ToplevelWindowTest() {}
994 virtual ~ToplevelWindowTest() {} 1000 virtual ~ToplevelWindowTest() {}
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 1200
1195 w3->Activate(); 1201 w3->Activate();
1196 EXPECT_EQ(w2.get(), active()); 1202 EXPECT_EQ(w2.get(), active());
1197 1203
1198 w1->Activate(); 1204 w1->Activate();
1199 EXPECT_EQ(w1.get(), active()); 1205 EXPECT_EQ(w1.get(), active());
1200 } 1206 }
1201 1207
1202 } // namespace test 1208 } // namespace test
1203 } // namespace aura 1209 } // namespace aura
OLDNEW
« ui/aura/desktop_host_linux.cc ('K') | « ui/aura/desktop_host_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698