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

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

Issue 11412315: Make the cursor have separate mode for disabled mouse events and invisible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile errors and nit Created 8 years 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <utility> 7 #include <utility>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 // Test Window::ConvertPointToWindow() with transform to root_window. 364 // Test Window::ConvertPointToWindow() with transform to root_window.
365 TEST_F(WindowTest, MoveCursorToWithTransformRootWindow) { 365 TEST_F(WindowTest, MoveCursorToWithTransformRootWindow) {
366 RootWindow* root = root_window(); 366 RootWindow* root = root_window();
367 gfx::Transform transform; 367 gfx::Transform transform;
368 transform.Translate(100.0, 100.0); 368 transform.Translate(100.0, 100.0);
369 transform.Rotate(90.0); 369 transform.Rotate(90.0);
370 transform.Scale(2.0, 5.0); 370 transform.Scale(2.0, 5.0);
371 root->SetTransform(transform); 371 root->SetTransform(transform);
372 root->MoveCursorTo(gfx::Point(10, 10)); 372 root->MoveCursorTo(gfx::Point(10, 10));
373 #if !defined(OS_WIN) 373 #if !defined(OS_WIN)
374 gfx::Point mouse_location;
375 EXPECT_TRUE(root->QueryMouseLocationForTest(&mouse_location));
374 // TODO(yoshiki): fix this to build on Windows. See crbug.com/133413.OD 376 // TODO(yoshiki): fix this to build on Windows. See crbug.com/133413.OD
375 EXPECT_EQ("50,120", root->QueryMouseLocationForTest().ToString()); 377 EXPECT_EQ("50,120", mouse_location.ToString());
376 #endif 378 #endif
377 EXPECT_EQ("10,10", 379 EXPECT_EQ("10,10",
378 gfx::Screen::GetScreenFor(root)->GetCursorScreenPoint().ToString()); 380 gfx::Screen::GetScreenFor(root)->GetCursorScreenPoint().ToString());
379 } 381 }
380 382
381 // Tests Window::ConvertPointToWindow() with transform to non-root windows. 383 // Tests Window::ConvertPointToWindow() with transform to non-root windows.
382 TEST_F(WindowTest, MoveCursorToWithTransformWindow) { 384 TEST_F(WindowTest, MoveCursorToWithTransformWindow) {
383 scoped_ptr<Window> w1( 385 scoped_ptr<Window> w1(
384 CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(10, 10, 500, 500), 386 CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(10, 10, 500, 500),
385 root_window())); 387 root_window()));
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 root->SetTransform(root_transform); 447 root->SetTransform(root_transform);
446 w1->SetTransform(transform); 448 w1->SetTransform(transform);
447 w11->SetTransform(transform); 449 w11->SetTransform(transform);
448 w111->SetTransform(transform); 450 w111->SetTransform(transform);
449 w1111->SetTransform(transform); 451 w1111->SetTransform(transform);
450 452
451 w1111->MoveCursorTo(gfx::Point(10, 10)); 453 w1111->MoveCursorTo(gfx::Point(10, 10));
452 454
453 #if !defined(OS_WIN) 455 #if !defined(OS_WIN)
454 // TODO(yoshiki): fix this to build on Windows. See crbug.com/133413. 456 // TODO(yoshiki): fix this to build on Windows. See crbug.com/133413.
455 EXPECT_EQ("169,80", root->QueryMouseLocationForTest().ToString()); 457 gfx::Point mouse_location;
458 EXPECT_TRUE(root->QueryMouseLocationForTest(&mouse_location));
459 EXPECT_EQ("169,80", mouse_location.ToString());
456 #endif 460 #endif
457 EXPECT_EQ("20,53", 461 EXPECT_EQ("20,53",
458 gfx::Screen::GetScreenFor(root)->GetCursorScreenPoint().ToString()); 462 gfx::Screen::GetScreenFor(root)->GetCursorScreenPoint().ToString());
459 } 463 }
460 464
461 TEST_F(WindowTest, HitTest) { 465 TEST_F(WindowTest, HitTest) {
462 Window w1(new ColorTestWindowDelegate(SK_ColorWHITE)); 466 Window w1(new ColorTestWindowDelegate(SK_ColorWHITE));
463 w1.set_id(1); 467 w1.set_id(1);
464 w1.Init(ui::LAYER_TEXTURED); 468 w1.Init(ui::LAYER_TEXTURED);
465 w1.SetBounds(gfx::Rect(10, 20, 50, 60)); 469 w1.SetBounds(gfx::Rect(10, 20, 50, 60));
(...skipping 2119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2585 // Move |w2| to be a child of |w1|. 2589 // Move |w2| to be a child of |w1|.
2586 w1->AddChild(w2.get()); 2590 w1->AddChild(w2.get());
2587 // Sine we moved in the same root, observer shouldn't be notified. 2591 // Sine we moved in the same root, observer shouldn't be notified.
2588 EXPECT_EQ("0 0", observer.CountStringAndReset()); 2592 EXPECT_EQ("0 0", observer.CountStringAndReset());
2589 // |w2| should still have focus after moving. 2593 // |w2| should still have focus after moving.
2590 EXPECT_TRUE(w2->HasFocus()); 2594 EXPECT_TRUE(w2->HasFocus());
2591 } 2595 }
2592 2596
2593 } // namespace test 2597 } // namespace test
2594 } // namespace aura 2598 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698