| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/frame/default_header_painter.h" | 5 #include "ash/frame/default_header_painter.h" |
| 6 | 6 |
| 7 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 7 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
| 10 #include "ash/wm/window_state.h" | 10 #include "ash/wm/window_state.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 29 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 30 params.context = CurrentContext(); | 30 params.context = CurrentContext(); |
| 31 widget->Init(params); | 31 widget->Init(params); |
| 32 return widget; | 32 return widget; |
| 33 } | 33 } |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 // Ensure the title text is vertically aligned with the window icon. | 36 // Ensure the title text is vertically aligned with the window icon. |
| 37 TEST_F(DefaultHeaderPainterTest, TitleIconAlignment) { | 37 TEST_F(DefaultHeaderPainterTest, TitleIconAlignment) { |
| 38 scoped_ptr<Widget> w(CreateTestWidget()); | 38 scoped_ptr<Widget> w(CreateTestWidget()); |
| 39 ash::FrameCaptionButtonContainerView container(w.get(), | 39 ash::FrameCaptionButtonContainerView container(w.get()); |
| 40 ash::FrameCaptionButtonContainerView::MINIMIZE_ALLOWED); | |
| 41 views::StaticSizedView window_icon(gfx::Size(16, 16)); | 40 views::StaticSizedView window_icon(gfx::Size(16, 16)); |
| 42 window_icon.SetBounds(0, 0, 16, 16); | 41 window_icon.SetBounds(0, 0, 16, 16); |
| 43 w->SetBounds(gfx::Rect(0, 0, 500, 500)); | 42 w->SetBounds(gfx::Rect(0, 0, 500, 500)); |
| 44 w->Show(); | 43 w->Show(); |
| 45 | 44 |
| 46 DefaultHeaderPainter painter; | 45 DefaultHeaderPainter painter; |
| 47 painter.Init(w.get(), | 46 painter.Init(w.get(), |
| 48 w->non_client_view()->frame_view(), | 47 w->non_client_view()->frame_view(), |
| 49 &container); | 48 &container); |
| 50 painter.UpdateLeftHeaderView(&window_icon); | 49 painter.UpdateLeftHeaderView(&window_icon); |
| 51 painter.LayoutHeader(); | 50 painter.LayoutHeader(); |
| 52 gfx::Rect title_bounds = painter.GetTitleBounds(); | 51 gfx::Rect title_bounds = painter.GetTitleBounds(); |
| 53 EXPECT_EQ(window_icon.bounds().CenterPoint().y(), | 52 EXPECT_EQ(window_icon.bounds().CenterPoint().y(), |
| 54 title_bounds.CenterPoint().y()); | 53 title_bounds.CenterPoint().y()); |
| 55 } | 54 } |
| 56 | 55 |
| 57 } // namespace ash | 56 } // namespace ash |
| OLD | NEW |