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

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

Issue 201573015: Introdcue AshWindowTreeHost and move ash/chrome specific code in WTH to ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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 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 <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 #if defined(USE_OZONE) 363 #if defined(USE_OZONE)
364 // TODO(rjkroege): Add cursor support in ozone: http://crbug.com/252315. 364 // TODO(rjkroege): Add cursor support in ozone: http://crbug.com/252315.
365 TEST_F(WindowTest, DISABLED_MoveCursorToWithTransformRootWindow) { 365 TEST_F(WindowTest, DISABLED_MoveCursorToWithTransformRootWindow) {
366 #else 366 #else
367 TEST_F(WindowTest, MoveCursorToWithTransformRootWindow) { 367 TEST_F(WindowTest, MoveCursorToWithTransformRootWindow) {
368 #endif 368 #endif
369 gfx::Transform transform; 369 gfx::Transform transform;
370 transform.Translate(100.0, 100.0); 370 transform.Translate(100.0, 100.0);
371 transform.Rotate(90.0); 371 transform.Rotate(90.0);
372 transform.Scale(2.0, 5.0); 372 transform.Scale(2.0, 5.0);
373 host()->SetTransform(transform); 373 host()->SetRootTransform(transform);
374 host()->MoveCursorTo(gfx::Point(10, 10)); 374 host()->MoveCursorTo(gfx::Point(10, 10));
375 #if !defined(OS_WIN) 375 #if !defined(OS_WIN)
376 gfx::Point mouse_location; 376 gfx::Point mouse_location;
377 EXPECT_TRUE(host()->QueryMouseLocation(&mouse_location)); 377 EXPECT_TRUE(host()->QueryMouseLocation(&mouse_location));
378 // TODO(yoshiki): fix this to build on Windows. See crbug.com/133413.OD 378 // TODO(yoshiki): fix this to build on Windows. See crbug.com/133413.OD
379 EXPECT_EQ("50,120", mouse_location.ToString()); 379 EXPECT_EQ("50,120", mouse_location.ToString());
380 #endif 380 #endif
381 EXPECT_EQ("10,10", gfx::Screen::GetScreenFor( 381 EXPECT_EQ("10,10", gfx::Screen::GetScreenFor(
382 root_window())->GetCursorScreenPoint().ToString()); 382 root_window())->GetCursorScreenPoint().ToString());
383 } 383 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 gfx::Transform root_transform; 444 gfx::Transform root_transform;
445 root_transform.Translate(60.0, 70.0); 445 root_transform.Translate(60.0, 70.0);
446 root_transform.Rotate(-90.0); 446 root_transform.Rotate(-90.0);
447 root_transform.Translate(-50.0, -50.0); 447 root_transform.Translate(-50.0, -50.0);
448 root_transform.Scale(2.0, 3.0); 448 root_transform.Scale(2.0, 3.0);
449 449
450 gfx::Transform transform; 450 gfx::Transform transform;
451 transform.Translate(10.0, 20.0); 451 transform.Translate(10.0, 20.0);
452 transform.Rotate(10.0); 452 transform.Rotate(10.0);
453 transform.Scale(0.3f, 0.5f); 453 transform.Scale(0.3f, 0.5f);
454 host()->SetTransform(root_transform); 454 host()->SetRootTransform(root_transform);
455 w1->SetTransform(transform); 455 w1->SetTransform(transform);
456 w11->SetTransform(transform); 456 w11->SetTransform(transform);
457 w111->SetTransform(transform); 457 w111->SetTransform(transform);
458 w1111->SetTransform(transform); 458 w1111->SetTransform(transform);
459 459
460 w1111->MoveCursorTo(gfx::Point(10, 10)); 460 w1111->MoveCursorTo(gfx::Point(10, 10));
461 461
462 #if !defined(OS_WIN) 462 #if !defined(OS_WIN)
463 // TODO(yoshiki): fix this to build on Windows. See crbug.com/133413. 463 // TODO(yoshiki): fix this to build on Windows. See crbug.com/133413.
464 gfx::Point mouse_location; 464 gfx::Point mouse_location;
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 TEST_F(WindowTest, Transform) { 1487 TEST_F(WindowTest, Transform) {
1488 gfx::Size size = host()->GetBounds().size(); 1488 gfx::Size size = host()->GetBounds().size();
1489 EXPECT_EQ(gfx::Rect(size), 1489 EXPECT_EQ(gfx::Rect(size),
1490 gfx::Screen::GetScreenFor(root_window())->GetDisplayNearestPoint( 1490 gfx::Screen::GetScreenFor(root_window())->GetDisplayNearestPoint(
1491 gfx::Point()).bounds()); 1491 gfx::Point()).bounds());
1492 1492
1493 // Rotate it clock-wise 90 degrees. 1493 // Rotate it clock-wise 90 degrees.
1494 gfx::Transform transform; 1494 gfx::Transform transform;
1495 transform.Translate(size.height(), 0); 1495 transform.Translate(size.height(), 0);
1496 transform.Rotate(90.0); 1496 transform.Rotate(90.0);
1497 host()->SetTransform(transform); 1497 host()->SetRootTransform(transform);
1498 1498
1499 // The size should be the transformed size. 1499 // The size should be the transformed size.
1500 gfx::Size transformed_size(size.height(), size.width()); 1500 gfx::Size transformed_size(size.height(), size.width());
1501 EXPECT_EQ(transformed_size.ToString(), 1501 EXPECT_EQ(transformed_size.ToString(),
1502 root_window()->bounds().size().ToString()); 1502 root_window()->bounds().size().ToString());
1503 EXPECT_EQ( 1503 EXPECT_EQ(
1504 gfx::Rect(transformed_size).ToString(), 1504 gfx::Rect(transformed_size).ToString(),
1505 gfx::Screen::GetScreenFor(root_window())->GetDisplayNearestPoint( 1505 gfx::Screen::GetScreenFor(root_window())->GetDisplayNearestPoint(
1506 gfx::Point()).bounds().ToString()); 1506 gfx::Point()).bounds().ToString());
1507 1507
1508 // Host size shouldn't change. 1508 // Host size shouldn't change.
1509 EXPECT_EQ(size.ToString(), host()->GetBounds().size().ToString()); 1509 EXPECT_EQ(size.ToString(), host()->GetBounds().size().ToString());
1510 } 1510 }
1511 1511
1512 TEST_F(WindowTest, TransformGesture) { 1512 TEST_F(WindowTest, TransformGesture) {
1513 gfx::Size size = host()->GetBounds().size(); 1513 gfx::Size size = host()->GetBounds().size();
1514 1514
1515 scoped_ptr<GestureTrackPositionDelegate> delegate( 1515 scoped_ptr<GestureTrackPositionDelegate> delegate(
1516 new GestureTrackPositionDelegate); 1516 new GestureTrackPositionDelegate);
1517 scoped_ptr<Window> window(CreateTestWindowWithDelegate(delegate.get(), -1234, 1517 scoped_ptr<Window> window(CreateTestWindowWithDelegate(delegate.get(), -1234,
1518 gfx::Rect(0, 0, 20, 20), root_window())); 1518 gfx::Rect(0, 0, 20, 20), root_window()));
1519 1519
1520 // Rotate the root-window clock-wise 90 degrees. 1520 // Rotate the root-window clock-wise 90 degrees.
1521 gfx::Transform transform; 1521 gfx::Transform transform;
1522 transform.Translate(size.height(), 0.0); 1522 transform.Translate(size.height(), 0.0);
1523 transform.Rotate(90.0); 1523 transform.Rotate(90.0);
1524 host()->SetTransform(transform); 1524 host()->SetRootTransform(transform);
1525 1525
1526 ui::TouchEvent press( 1526 ui::TouchEvent press(
1527 ui::ET_TOUCH_PRESSED, gfx::Point(size.height() - 10, 10), 0, getTime()); 1527 ui::ET_TOUCH_PRESSED, gfx::Point(size.height() - 10, 10), 0, getTime());
1528 DispatchEventUsingWindowDispatcher(&press); 1528 DispatchEventUsingWindowDispatcher(&press);
1529 EXPECT_EQ(gfx::Point(10, 10).ToString(), delegate->position().ToString()); 1529 EXPECT_EQ(gfx::Point(10, 10).ToString(), delegate->position().ToString());
1530 } 1530 }
1531 1531
1532 namespace { 1532 namespace {
1533 DEFINE_WINDOW_PROPERTY_KEY(int, kIntKey, -2); 1533 DEFINE_WINDOW_PROPERTY_KEY(int, kIntKey, -2);
1534 DEFINE_WINDOW_PROPERTY_KEY(const char*, kStringKey, "squeamish"); 1534 DEFINE_WINDOW_PROPERTY_KEY(const char*, kStringKey, "squeamish");
(...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after
3291 BuildRootLayerTreeDescription(*root.layer())) 3291 BuildRootLayerTreeDescription(*root.layer()))
3292 << "layer tree doesn't match at " << i; 3292 << "layer tree doesn't match at " << i;
3293 EXPECT_EQ(data[i].expected_description, 3293 EXPECT_EQ(data[i].expected_description,
3294 BuildRootWindowTreeDescription(root)) 3294 BuildRootWindowTreeDescription(root))
3295 << "window tree doesn't match at " << i; 3295 << "window tree doesn't match at " << i;
3296 } 3296 }
3297 } 3297 }
3298 3298
3299 } // namespace test 3299 } // namespace test
3300 } // namespace aura 3300 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/window_tree_host_x11_unittest.cc ('k') | ui/views/widget/desktop_aura/desktop_window_tree_host_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698