cast_display_util_unittest.cc 1.0 KB

123456789101112131415161718192021222324252627282930
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "chromecast/graphics/cast_display_util.h"
  5. #include "testing/gtest/include/gtest/gtest.h"
  6. namespace chromecast {
  7. TEST(CastDisplayScaleTest, StandardResolutions_16x9) {
  8. const gfx::Size kResolution720p(1280, 720);
  9. const gfx::Size kResolution1080p(1920, 1080);
  10. const gfx::Size kResolution1440p(2560, 1440);
  11. const gfx::Size kResolution2160p(3840, 2160);
  12. const gfx::Size kResolution4320p(7680, 4320);
  13. EXPECT_EQ(1.f, GetDeviceScaleFactor(kResolution720p));
  14. EXPECT_EQ(1.5f, GetDeviceScaleFactor(kResolution1080p));
  15. EXPECT_EQ(2.f, GetDeviceScaleFactor(kResolution1440p));
  16. EXPECT_EQ(3.f, GetDeviceScaleFactor(kResolution2160p));
  17. EXPECT_EQ(6.f, GetDeviceScaleFactor(kResolution4320p));
  18. }
  19. TEST(CastDisplayScaleTest, NonstandardResolutions) {
  20. const gfx::Size kResolutionHomeHub(600, 1024);
  21. EXPECT_EQ(1.f, GetDeviceScaleFactor(kResolutionHomeHub));
  22. }
  23. } // namespace chromecast