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

Unified Diff: ui/wm/core/coordinate_conversion_unittest.cc

Issue 2660873002: Move two utility functions from ash/screen_util.h to ui/wm/core/coordinate_conversion.h (Closed)
Patch Set: rebase Created 3 years, 10 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 | « ui/wm/core/coordinate_conversion.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/coordinate_conversion_unittest.cc
diff --git a/ui/wm/core/coordinate_conversion_unittest.cc b/ui/wm/core/coordinate_conversion_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..13d077ab7e7ebbbd3f1be96a1eb1be2145635c4f
--- /dev/null
+++ b/ui/wm/core/coordinate_conversion_unittest.cc
@@ -0,0 +1,42 @@
+// Copyright 2017 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 "ui/wm/core/coordinate_conversion.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/aura/client/screen_position_client.h"
+#include "ui/aura/test/aura_test_base.h"
+#include "ui/aura/test/test_windows.h"
+#include "ui/wm/core/default_screen_position_client.h"
+
+namespace wm {
+
+typedef aura::test::AuraTestBase CoordinateConversionTest;
+
+TEST_F(CoordinateConversionTest, ConvertRect) {
+ DefaultScreenPositionClient screen_position_client;
+ aura::client::SetScreenPositionClient(root_window(), &screen_position_client);
+ aura::Window* w = aura::test::CreateTestWindowWithBounds(
+ gfx::Rect(10, 20, 100, 200), root_window());
+
+ gfx::Rect r1(10, 20, 100, 120);
+ ConvertRectFromScreen(w, &r1);
+ EXPECT_EQ("0,0 100x120", r1.ToString());
+
+ gfx::Rect r2(0, 0, 100, 200);
+ ConvertRectFromScreen(w, &r2);
+ EXPECT_EQ("-10,-20 100x200", r2.ToString());
+
+ gfx::Rect r3(30, 30, 100, 200);
+ ConvertRectToScreen(w, &r3);
+ EXPECT_EQ("40,50 100x200", r3.ToString());
+
+ gfx::Rect r4(-10, -20, 100, 200);
+ ConvertRectToScreen(w, &r4);
+ EXPECT_EQ("0,0 100x200", r4.ToString());
+
+ aura::client::SetScreenPositionClient(root_window(), nullptr);
+}
+
+} // namespace wm
« no previous file with comments | « ui/wm/core/coordinate_conversion.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698