OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 |
| 5 #include "config.h" |
| 6 #include "public/platform/WebScreenInfo.h" |
| 7 |
| 8 #include <gtest/gtest.h> |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 TEST(WebScreenInfoTest, Equality) |
| 13 { |
| 14 WebScreenInfo screenInfo1; |
| 15 WebScreenInfo screenInfo2; |
| 16 |
| 17 EXPECT_EQ(screenInfo1, screenInfo2); |
| 18 |
| 19 // Change same values in screenInfo1. |
| 20 screenInfo1.deviceScaleFactor = 10.f; |
| 21 screenInfo1.depth = 3; |
| 22 screenInfo1.depthPerComponent = 2; |
| 23 screenInfo1.isMonochrome = false; |
| 24 |
| 25 EXPECT_NE(screenInfo1, screenInfo2); |
| 26 |
| 27 // Set the same values to screenInfo2, they should be equal now. |
| 28 screenInfo2.deviceScaleFactor = 10.f; |
| 29 screenInfo2.depth = 3; |
| 30 screenInfo2.depthPerComponent = 2; |
| 31 screenInfo2.isMonochrome = false; |
| 32 |
| 33 EXPECT_EQ(screenInfo1, screenInfo2); |
| 34 |
| 35 // Set all the known members. |
| 36 screenInfo1.deviceScaleFactor = 2.f; |
| 37 screenInfo1.depth = 1; |
| 38 screenInfo1.depthPerComponent = 1; |
| 39 screenInfo1.isMonochrome = false; |
| 40 screenInfo1.rect = WebRect(0, 0, 1024, 1024); |
| 41 screenInfo1.availableRect = WebRect(0, 0, 1024, 1024); |
| 42 screenInfo1.orientationType = blink::WebScreenOrientationLandscapePrimary; |
| 43 screenInfo1.orientationAngle = 90; |
| 44 |
| 45 EXPECT_NE(screenInfo1, screenInfo2); |
| 46 |
| 47 screenInfo2.deviceScaleFactor = 2.f; |
| 48 screenInfo2.depth = 1; |
| 49 screenInfo2.depthPerComponent = 1; |
| 50 screenInfo2.isMonochrome = false; |
| 51 screenInfo2.rect = WebRect(0, 0, 1024, 1024); |
| 52 screenInfo2.availableRect = WebRect(0, 0, 1024, 1024); |
| 53 screenInfo2.orientationType = blink::WebScreenOrientationLandscapePrimary; |
| 54 screenInfo2.orientationAngle = 90; |
| 55 |
| 56 EXPECT_EQ(screenInfo1, screenInfo2); |
| 57 } |
| 58 |
| 59 } // namespace blink |
OLD | NEW |