Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Unified Diff: Source/platform/WebScreenInfoTest.cpp

Issue 1100503003: Add operator== to WebScreenInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add testS Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/platform/blink_platform.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/WebScreenInfoTest.cpp
diff --git a/Source/platform/WebScreenInfoTest.cpp b/Source/platform/WebScreenInfoTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..ce63ce8635911383aff0291dfafe8330a02f4607
--- /dev/null
+++ b/Source/platform/WebScreenInfoTest.cpp
@@ -0,0 +1,59 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "public/platform/WebScreenInfo.h"
+
+#include <gtest/gtest.h>
+
+namespace blink {
+
+TEST(WebScreenInfoTest, Equality)
+{
+ WebScreenInfo screenInfo1;
+ WebScreenInfo screenInfo2;
+
+ EXPECT_EQ(screenInfo1, screenInfo2);
+
+ // Change same values in screenInfo1.
+ screenInfo1.deviceScaleFactor = 10.f;
+ screenInfo1.depth = 3;
+ screenInfo1.depthPerComponent = 2;
+ screenInfo1.isMonochrome = false;
+
+ EXPECT_NE(screenInfo1, screenInfo2);
+
+ // Set the same values to screenInfo2, they should be equal now.
+ screenInfo2.deviceScaleFactor = 10.f;
+ screenInfo2.depth = 3;
+ screenInfo2.depthPerComponent = 2;
+ screenInfo2.isMonochrome = false;
+
+ EXPECT_EQ(screenInfo1, screenInfo2);
+
+ // Set all the known members.
+ screenInfo1.deviceScaleFactor = 2.f;
+ screenInfo1.depth = 1;
+ screenInfo1.depthPerComponent = 1;
+ screenInfo1.isMonochrome = false;
+ screenInfo1.rect = WebRect(0, 0, 1024, 1024);
+ screenInfo1.availableRect = WebRect(0, 0, 1024, 1024);
+ screenInfo1.orientationType = blink::WebScreenOrientationLandscapePrimary;
+ screenInfo1.orientationAngle = 90;
+
+ EXPECT_NE(screenInfo1, screenInfo2);
+
+ screenInfo2.deviceScaleFactor = 2.f;
+ screenInfo2.depth = 1;
+ screenInfo2.depthPerComponent = 1;
+ screenInfo2.isMonochrome = false;
+ screenInfo2.rect = WebRect(0, 0, 1024, 1024);
+ screenInfo2.availableRect = WebRect(0, 0, 1024, 1024);
+ screenInfo2.orientationType = blink::WebScreenOrientationLandscapePrimary;
+ screenInfo2.orientationAngle = 90;
+
+ EXPECT_EQ(screenInfo1, screenInfo2);
+}
+
+} // namespace blink
« no previous file with comments | « no previous file | Source/platform/blink_platform.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698