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.
6 #include "public/platform/WebScreenInfo.h"
8 #include <gtest/gtest.h>
12 TEST(WebScreenInfoTest
, Equality
)
14 WebScreenInfo screenInfo1
;
15 WebScreenInfo screenInfo2
;
17 EXPECT_EQ(screenInfo1
, screenInfo2
);
19 // Change same values in screenInfo1.
20 screenInfo1
.deviceScaleFactor
= 10.f
;
21 screenInfo1
.depth
= 3;
22 screenInfo1
.depthPerComponent
= 2;
23 screenInfo1
.isMonochrome
= false;
25 EXPECT_NE(screenInfo1
, screenInfo2
);
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;
33 EXPECT_EQ(screenInfo1
, screenInfo2
);
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;
45 EXPECT_NE(screenInfo1
, screenInfo2
);
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;
56 EXPECT_EQ(screenInfo1
, screenInfo2
);