Compute can_use_lcd_text using property trees.
[chromium-blink-merge.git] / remoting / host / screen_resolution_unittest.cc
blob01de134b9690f6a006afd7214e079f7ed253b8d6
1 // Copyright (c) 2013 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.
5 #include "remoting/host/screen_resolution.h"
7 #include <limits>
9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h"
12 namespace remoting {
14 TEST(ScreenResolutionTest, Empty) {
15 ScreenResolution resolution1(
16 webrtc::DesktopSize(100, 100), webrtc::DesktopVector(10, 10));
17 EXPECT_FALSE(resolution1.IsEmpty());
19 ScreenResolution resolution2(
20 webrtc::DesktopSize(), webrtc::DesktopVector(10, 10));
21 EXPECT_TRUE(resolution2.IsEmpty());
23 ScreenResolution resolution3(
24 webrtc::DesktopSize(1, 1), webrtc::DesktopVector(0, 0));
25 EXPECT_TRUE(resolution3.IsEmpty());
28 TEST(ScreenResolutionTest, Scaling) {
29 ScreenResolution resolution(
30 webrtc::DesktopSize(100, 100), webrtc::DesktopVector(10, 10));
32 EXPECT_TRUE(webrtc::DesktopSize(50, 50).equals(
33 resolution.ScaleDimensionsToDpi(webrtc::DesktopVector(5, 5))));
35 EXPECT_TRUE(webrtc::DesktopSize(200, 200).equals(
36 resolution.ScaleDimensionsToDpi(webrtc::DesktopVector(20, 20))));
39 TEST(ScreenResolutionTest, ScalingSaturation) {
40 ScreenResolution resolution(
41 webrtc::DesktopSize(10000000, 1000000), webrtc::DesktopVector(1, 1));
43 int32 max_int = std::numeric_limits<int32>::max();
44 EXPECT_TRUE(webrtc::DesktopSize(max_int, max_int).equals(
45 resolution.ScaleDimensionsToDpi(
46 webrtc::DesktopVector(1000000, 1000000))));
49 } // namespace remoting