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

Side by Side Diff: ash/frame/default_header_painter_unittest.cc

Issue 934503002: Ash frames: dark frames now use white caption buttons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 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 unified diff | Download patch
« no previous file with comments | « ash/frame/default_header_painter.cc ('k') | ash/resources/ash_resources.grd » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 painter.Init(w.get(), 46 painter.Init(w.get(),
47 w->non_client_view()->frame_view(), 47 w->non_client_view()->frame_view(),
48 &container); 48 &container);
49 painter.UpdateLeftHeaderView(&window_icon); 49 painter.UpdateLeftHeaderView(&window_icon);
50 painter.LayoutHeader(); 50 painter.LayoutHeader();
51 gfx::Rect title_bounds = painter.GetTitleBounds(); 51 gfx::Rect title_bounds = painter.GetTitleBounds();
52 EXPECT_EQ(window_icon.bounds().CenterPoint().y(), 52 EXPECT_EQ(window_icon.bounds().CenterPoint().y(),
53 title_bounds.CenterPoint().y()); 53 title_bounds.CenterPoint().y());
54 } 54 }
55 55
56 // Ensure the light icons are used when appropriate.
57 TEST_F(DefaultHeaderPainterTest, LightIcons) {
58 scoped_ptr<Widget> w(CreateTestWidget());
59 ash::FrameCaptionButtonContainerView container(w.get());
60 views::StaticSizedView window_icon(gfx::Size(16, 16));
61 window_icon.SetBounds(0, 0, 16, 16);
62 w->SetBounds(gfx::Rect(0, 0, 500, 500));
63 w->Show();
64
65 DefaultHeaderPainter painter;
66 painter.Init(w.get(), w->non_client_view()->frame_view(), &container);
67
68 // Check by default light icons are not used.
69 painter.mode_ = HeaderPainter::MODE_ACTIVE;
70 EXPECT_EQ(false, painter.ShouldUseLightImages());
71 painter.mode_ = HeaderPainter::MODE_INACTIVE;
72 EXPECT_EQ(false, painter.ShouldUseLightImages());
73
74 // Check that setting dark colors should use light icons.
75 painter.SetFrameColors(SkColorSetRGB(0, 0, 0), SkColorSetRGB(0, 0, 0));
76 painter.mode_ = HeaderPainter::MODE_ACTIVE;
77 EXPECT_EQ(true, painter.ShouldUseLightImages());
78 painter.mode_ = HeaderPainter::MODE_INACTIVE;
79 EXPECT_EQ(true, painter.ShouldUseLightImages());
80
81 // Check that inactive and active colors are used properly.
82 painter.SetFrameColors(SkColorSetRGB(0, 0, 0), SkColorSetRGB(255, 255, 255));
83 painter.mode_ = HeaderPainter::MODE_ACTIVE;
84 EXPECT_EQ(true, painter.ShouldUseLightImages());
85 painter.mode_ = HeaderPainter::MODE_INACTIVE;
86 EXPECT_EQ(false, painter.ShouldUseLightImages());
87
88 // Check not so light or dark colors.
89 painter.SetFrameColors(SkColorSetRGB(70, 70, 70),
90 SkColorSetRGB(200, 200, 200));
91 painter.mode_ = HeaderPainter::MODE_ACTIVE;
92 EXPECT_EQ(true, painter.ShouldUseLightImages());
93 painter.mode_ = HeaderPainter::MODE_INACTIVE;
94 EXPECT_EQ(false, painter.ShouldUseLightImages());
95 }
96
56 } // namespace ash 97 } // namespace ash
OLDNEW
« no previous file with comments | « ash/frame/default_header_painter.cc ('k') | ash/resources/ash_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698