window_util_unittest.cc revision c2e0dbddbe15c98d52c4786dac06cb8952a8ae6d
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. 4 5#include "ash/wm/window_util.h" 6 7#include "ash/screen_ash.h" 8#include "ash/test/ash_test_base.h" 9#include "ui/aura/window.h" 10 11namespace ash { 12 13typedef test::AshTestBase WindowUtilTest; 14 15TEST_F(WindowUtilTest, CenterWindow) { 16 UpdateDisplay("500x400, 600x400"); 17 scoped_ptr<aura::Window> window( 18 CreateTestWindowInShellWithBounds(gfx::Rect(12, 20, 100, 100))); 19 wm::CenterWindow(window.get()); 20 EXPECT_EQ("200,126 100x100", window->bounds().ToString()); 21 EXPECT_EQ("200,126 100x100", window->GetBoundsInScreen().ToString()); 22 window->SetBoundsInScreen(gfx::Rect(600, 0, 100, 100), 23 ScreenAsh::GetSecondaryDisplay()); 24 wm::CenterWindow(window.get()); 25 EXPECT_EQ("250,126 100x100", window->bounds().ToString()); 26 EXPECT_EQ("750,126 100x100", window->GetBoundsInScreen().ToString()); 27} 28 29} // namespace ash 30