1 // Copyright (c) 2013 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.
5 #include "ash/wm/window_util.h"
7 #include "ash/screen_ash.h"
8 #include "ash/test/ash_test_base.h"
9 #include "ui/aura/window.h"
13 typedef test::AshTestBase WindowUtilTest
;
15 TEST_F(WindowUtilTest
, CenterWindow
) {
16 if (!SupportsMultipleDisplays())
19 UpdateDisplay("500x400, 600x400");
20 scoped_ptr
<aura::Window
> window(
21 CreateTestWindowInShellWithBounds(gfx::Rect(12, 20, 100, 100)));
22 wm::CenterWindow(window
.get());
23 EXPECT_EQ("200,126 100x100", window
->bounds().ToString());
24 EXPECT_EQ("200,126 100x100", window
->GetBoundsInScreen().ToString());
25 window
->SetBoundsInScreen(gfx::Rect(600, 0, 100, 100),
26 ScreenAsh::GetSecondaryDisplay());
27 wm::CenterWindow(window
.get());
28 EXPECT_EQ("250,126 100x100", window
->bounds().ToString());
29 EXPECT_EQ("750,126 100x100", window
->GetBoundsInScreen().ToString());