| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 #include "ui/events/ozone/chromeos/cursor_controller.h" | 7 #include "ui/events/ozone/chromeos/cursor_controller.h" |
| 8 | 8 |
| 9 namespace ui { | 9 namespace ui { |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 gfx::Vector2dF delta(2.f, 3.f); | 34 gfx::Vector2dF delta(2.f, 3.f); |
| 35 cursor_controller->ApplyCursorConfigForWindow(kTestWindow, &delta); | 35 cursor_controller->ApplyCursorConfigForWindow(kTestWindow, &delta); |
| 36 EXPECT_FLOAT_EQ(2.f, delta.x()); | 36 EXPECT_FLOAT_EQ(2.f, delta.x()); |
| 37 EXPECT_FLOAT_EQ(3.f, delta.y()); | 37 EXPECT_FLOAT_EQ(3.f, delta.y()); |
| 38 } | 38 } |
| 39 | 39 |
| 40 TEST_F(CursorControllerTest, ClearedIdentity) { | 40 TEST_F(CursorControllerTest, ClearedIdentity) { |
| 41 ui::CursorController* cursor_controller = CursorController::GetInstance(); | 41 ui::CursorController* cursor_controller = CursorController::GetInstance(); |
| 42 | 42 |
| 43 // Check that configured & cleared windows use identity. | 43 // Check that configured & cleared windows use identity. |
| 44 cursor_controller->SetCursorConfigForWindow(kTestWindow, | 44 cursor_controller->SetCursorConfigForWindow( |
| 45 gfx::Display::ROTATE_180, 3.2f); | 45 kTestWindow, display::Display::ROTATE_180, 3.2f); |
| 46 cursor_controller->ClearCursorConfigForWindow(kTestWindow); | 46 cursor_controller->ClearCursorConfigForWindow(kTestWindow); |
| 47 gfx::Vector2dF delta(3.f, 5.f); | 47 gfx::Vector2dF delta(3.f, 5.f); |
| 48 cursor_controller->ApplyCursorConfigForWindow(kTestWindow, &delta); | 48 cursor_controller->ApplyCursorConfigForWindow(kTestWindow, &delta); |
| 49 EXPECT_FLOAT_EQ(3.f, delta.x()); | 49 EXPECT_FLOAT_EQ(3.f, delta.x()); |
| 50 EXPECT_FLOAT_EQ(5.f, delta.y()); | 50 EXPECT_FLOAT_EQ(5.f, delta.y()); |
| 51 } | 51 } |
| 52 | 52 |
| 53 TEST_F(CursorControllerTest, RotatedHighDpi) { | 53 TEST_F(CursorControllerTest, RotatedHighDpi) { |
| 54 ui::CursorController* cursor_controller = CursorController::GetInstance(); | 54 ui::CursorController* cursor_controller = CursorController::GetInstance(); |
| 55 | 55 |
| 56 // Check that 90deg rotated highdpi window transforms correctly. | 56 // Check that 90deg rotated highdpi window transforms correctly. |
| 57 cursor_controller->SetCursorConfigForWindow(kTestWindow, | 57 cursor_controller->SetCursorConfigForWindow(kTestWindow, |
| 58 gfx::Display::ROTATE_90, 2.f); | 58 display::Display::ROTATE_90, 2.f); |
| 59 gfx::Vector2dF delta(3.f, 5.f); | 59 gfx::Vector2dF delta(3.f, 5.f); |
| 60 cursor_controller->ApplyCursorConfigForWindow(kTestWindow, &delta); | 60 cursor_controller->ApplyCursorConfigForWindow(kTestWindow, &delta); |
| 61 EXPECT_FLOAT_EQ(-10.f, delta.x()); | 61 EXPECT_FLOAT_EQ(-10.f, delta.x()); |
| 62 EXPECT_FLOAT_EQ(6.f, delta.y()); | 62 EXPECT_FLOAT_EQ(6.f, delta.y()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace ui | 65 } // namespace ui |
| OLD | NEW |