diff options
Diffstat (limited to 'chromium/ash/wm/window_util_unittest.cc')
-rw-r--r-- | chromium/ash/wm/window_util_unittest.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/chromium/ash/wm/window_util_unittest.cc b/chromium/ash/wm/window_util_unittest.cc new file mode 100644 index 00000000000..8073a38cc87 --- /dev/null +++ b/chromium/ash/wm/window_util_unittest.cc @@ -0,0 +1,32 @@ +// Copyright (c) 2013 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 "ash/wm/window_util.h" + +#include "ash/screen_ash.h" +#include "ash/test/ash_test_base.h" +#include "ui/aura/window.h" + +namespace ash { + +typedef test::AshTestBase WindowUtilTest; + +TEST_F(WindowUtilTest, CenterWindow) { + if (!SupportsMultipleDisplays()) + return; + + UpdateDisplay("500x400, 600x400"); + scoped_ptr<aura::Window> window( + CreateTestWindowInShellWithBounds(gfx::Rect(12, 20, 100, 100))); + wm::CenterWindow(window.get()); + EXPECT_EQ("200,126 100x100", window->bounds().ToString()); + EXPECT_EQ("200,126 100x100", window->GetBoundsInScreen().ToString()); + window->SetBoundsInScreen(gfx::Rect(600, 0, 100, 100), + ScreenAsh::GetSecondaryDisplay()); + wm::CenterWindow(window.get()); + EXPECT_EQ("250,126 100x100", window->bounds().ToString()); + EXPECT_EQ("750,126 100x100", window->GetBoundsInScreen().ToString()); +} + +} // namespace ash |