| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/display/manager/chromeos/display_change_observer.h" | 5 #include "ui/display/manager/chromeos/display_change_observer.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 | 323 |
| 324 TEST(DisplayChangeObserverTest, FindDeviceScaleFactor) { | 324 TEST(DisplayChangeObserverTest, FindDeviceScaleFactor) { |
| 325 EXPECT_EQ(1.0f, ComputeDeviceScaleFactor(19.5f, gfx::Rect(1600, 900))); | 325 EXPECT_EQ(1.0f, ComputeDeviceScaleFactor(19.5f, gfx::Rect(1600, 900))); |
| 326 | 326 |
| 327 // 21.5" 1920x1080 | 327 // 21.5" 1920x1080 |
| 328 EXPECT_EQ(1.0f, ComputeDeviceScaleFactor(21.5f, gfx::Rect(1920, 1080))); | 328 EXPECT_EQ(1.0f, ComputeDeviceScaleFactor(21.5f, gfx::Rect(1920, 1080))); |
| 329 | 329 |
| 330 // 12.1" 1280x800 | 330 // 12.1" 1280x800 |
| 331 EXPECT_EQ(1.0f, ComputeDeviceScaleFactor(12.1f, gfx::Rect(1280, 800))); | 331 EXPECT_EQ(1.0f, ComputeDeviceScaleFactor(12.1f, gfx::Rect(1280, 800))); |
| 332 | 332 |
| 333 // 11.6" 1920x1080 | |
| 334 EXPECT_EQ(1.25f, ComputeDeviceScaleFactor(11.6f, gfx::Rect(1920, 1080))); | |
| 335 | |
| 336 // 13.3" 1920x1080 | 333 // 13.3" 1920x1080 |
| 337 EXPECT_EQ(1.25f, ComputeDeviceScaleFactor(13.3f, gfx::Rect(1920, 1080))); | 334 EXPECT_EQ(1.25f, ComputeDeviceScaleFactor(13.3f, gfx::Rect(1920, 1080))); |
| 338 | 335 |
| 339 // 14" 1920x1080 | 336 // 14" 1920x1080 |
| 340 EXPECT_EQ(1.25f, ComputeDeviceScaleFactor(14.0f, gfx::Rect(1920, 1080))); | 337 EXPECT_EQ(1.25f, ComputeDeviceScaleFactor(14.0f, gfx::Rect(1920, 1080))); |
| 341 | 338 |
| 339 // 11.6" 1920x1080 |
| 340 EXPECT_EQ(1.5f, ComputeDeviceScaleFactor(11.6f, gfx::Rect(1920, 1080))); |
| 341 |
| 342 // 12.85" 2560x1700 | 342 // 12.85" 2560x1700 |
| 343 EXPECT_EQ(2.0f, ComputeDeviceScaleFactor(12.85f, gfx::Rect(2560, 1700))); | 343 EXPECT_EQ(2.0f, ComputeDeviceScaleFactor(12.85f, gfx::Rect(2560, 1700))); |
| 344 | 344 |
| 345 // 12.3" 2400x1600 |
| 346 EXPECT_EQ(2.0f, ComputeDeviceScaleFactor(12.3f, gfx::Rect(2400, 1600))); |
| 347 |
| 345 // Erroneous values should still work. | 348 // Erroneous values should still work. |
| 346 EXPECT_EQ(1.0f, DisplayChangeObserver::FindDeviceScaleFactor(-100.0f)); | 349 EXPECT_EQ(1.0f, DisplayChangeObserver::FindDeviceScaleFactor(-100.0f)); |
| 347 EXPECT_EQ(1.0f, DisplayChangeObserver::FindDeviceScaleFactor(0.0f)); | 350 EXPECT_EQ(1.0f, DisplayChangeObserver::FindDeviceScaleFactor(0.0f)); |
| 348 EXPECT_EQ(2.0f, DisplayChangeObserver::FindDeviceScaleFactor(10000.0f)); | 351 EXPECT_EQ(2.0f, DisplayChangeObserver::FindDeviceScaleFactor(10000.0f)); |
| 349 } | 352 } |
| 350 | 353 |
| 351 TEST(DisplayChangeObserverTest, FindExternalDisplayNativeModeWhenOverwritten) { | 354 TEST(DisplayChangeObserverTest, FindExternalDisplayNativeModeWhenOverwritten) { |
| 352 std::unique_ptr<DisplaySnapshot> display_snapshot = | 355 std::unique_ptr<DisplaySnapshot> display_snapshot = |
| 353 FakeDisplaySnapshot::Builder() | 356 FakeDisplaySnapshot::Builder() |
| 354 .SetId(123) | 357 .SetId(123) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 365 EXPECT_FALSE(display_modes[0]->native()); | 368 EXPECT_FALSE(display_modes[0]->native()); |
| 366 EXPECT_EQ(display_modes[0]->refresh_rate(), 60); | 369 EXPECT_EQ(display_modes[0]->refresh_rate(), 60); |
| 367 | 370 |
| 368 EXPECT_EQ("1920x1080", display_modes[1]->size().ToString()); | 371 EXPECT_EQ("1920x1080", display_modes[1]->size().ToString()); |
| 369 EXPECT_TRUE(display_modes[1]->is_interlaced()); | 372 EXPECT_TRUE(display_modes[1]->is_interlaced()); |
| 370 EXPECT_TRUE(display_modes[1]->native()); | 373 EXPECT_TRUE(display_modes[1]->native()); |
| 371 EXPECT_EQ(display_modes[1]->refresh_rate(), 60); | 374 EXPECT_EQ(display_modes[1]->refresh_rate(), 60); |
| 372 } | 375 } |
| 373 | 376 |
| 374 } // namespace display | 377 } // namespace display |
| OLD | NEW |