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

Side by Side Diff: ash/wm/window_animations_unittest.cc

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/wm/window_animations.cc ('k') | ash/wm/window_cycle_controller.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/wm/window_animations.h" 5 #include "ash/wm/window_animations.h"
6 6
7 #include "ash/common/shell_window_ids.h" 7 #include "ash/common/shell_window_ids.h"
8 #include "ash/common/wm/window_animation_types.h" 8 #include "ash/common/wm/window_animation_types.h"
9 #include "ash/common/wm/window_state.h" 9 #include "ash/common/wm/window_state.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); 113 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
114 114
115 std::unique_ptr<Window> window(CreateTestWindowInShellWithId(0)); 115 std::unique_ptr<Window> window(CreateTestWindowInShellWithId(0));
116 window->SetBounds(gfx::Rect(5, 10, 320, 240)); 116 window->SetBounds(gfx::Rect(5, 10, 320, 240));
117 window->Show(); 117 window->Show();
118 118
119 Layer* old_layer = window->layer(); 119 Layer* old_layer = window->layer();
120 EXPECT_EQ(1.0f, old_layer->GetTargetOpacity()); 120 EXPECT_EQ(1.0f, old_layer->GetTargetOpacity());
121 121
122 // Cross fade to a larger size, as in a maximize animation. 122 // Cross fade to a larger size, as in a maximize animation.
123 GetWindowState(window.get())->SetBoundsDirectCrossFade( 123 GetWindowState(window.get())
124 gfx::Rect(0, 0, 640, 480)); 124 ->SetBoundsDirectCrossFade(gfx::Rect(0, 0, 640, 480));
125 // Window's layer has been replaced. 125 // Window's layer has been replaced.
126 EXPECT_NE(old_layer, window->layer()); 126 EXPECT_NE(old_layer, window->layer());
127 // Original layer stays opaque and stretches to new size. 127 // Original layer stays opaque and stretches to new size.
128 EXPECT_EQ(1.0f, old_layer->GetTargetOpacity()); 128 EXPECT_EQ(1.0f, old_layer->GetTargetOpacity());
129 EXPECT_EQ("5,10 320x240", old_layer->bounds().ToString()); 129 EXPECT_EQ("5,10 320x240", old_layer->bounds().ToString());
130 gfx::Transform grow_transform; 130 gfx::Transform grow_transform;
131 grow_transform.Translate(-5.f, -10.f); 131 grow_transform.Translate(-5.f, -10.f);
132 grow_transform.Scale(640.f / 320.f, 480.f / 240.f); 132 grow_transform.Scale(640.f / 320.f, 480.f / 240.f);
133 EXPECT_EQ(grow_transform, old_layer->GetTargetTransform()); 133 EXPECT_EQ(grow_transform, old_layer->GetTargetTransform());
134 // New layer animates in to the identity transform. 134 // New layer animates in to the identity transform.
135 EXPECT_EQ(1.0f, window->layer()->GetTargetOpacity()); 135 EXPECT_EQ(1.0f, window->layer()->GetTargetOpacity());
136 EXPECT_EQ(gfx::Transform(), window->layer()->GetTargetTransform()); 136 EXPECT_EQ(gfx::Transform(), window->layer()->GetTargetTransform());
137 137
138 // Run the animations to completion. 138 // Run the animations to completion.
139 old_layer->GetAnimator()->Step(base::TimeTicks::Now() + 139 old_layer->GetAnimator()->Step(base::TimeTicks::Now() +
140 base::TimeDelta::FromSeconds(1)); 140 base::TimeDelta::FromSeconds(1));
141 window->layer()->GetAnimator()->Step(base::TimeTicks::Now() + 141 window->layer()->GetAnimator()->Step(base::TimeTicks::Now() +
142 base::TimeDelta::FromSeconds(1)); 142 base::TimeDelta::FromSeconds(1));
143 143
144 // Cross fade to a smaller size, as in a restore animation. 144 // Cross fade to a smaller size, as in a restore animation.
145 old_layer = window->layer(); 145 old_layer = window->layer();
146 GetWindowState(window.get())->SetBoundsDirectCrossFade( 146 GetWindowState(window.get())
147 gfx::Rect(5, 10, 320, 240)); 147 ->SetBoundsDirectCrossFade(gfx::Rect(5, 10, 320, 240));
148 // Again, window layer has been replaced. 148 // Again, window layer has been replaced.
149 EXPECT_NE(old_layer, window->layer()); 149 EXPECT_NE(old_layer, window->layer());
150 // Original layer fades out and stretches down to new size. 150 // Original layer fades out and stretches down to new size.
151 EXPECT_EQ(0.0f, old_layer->GetTargetOpacity()); 151 EXPECT_EQ(0.0f, old_layer->GetTargetOpacity());
152 EXPECT_EQ("0,0 640x480", old_layer->bounds().ToString()); 152 EXPECT_EQ("0,0 640x480", old_layer->bounds().ToString());
153 gfx::Transform shrink_transform; 153 gfx::Transform shrink_transform;
154 shrink_transform.Translate(5.f, 10.f); 154 shrink_transform.Translate(5.f, 10.f);
155 shrink_transform.Scale(320.f / 640.f, 240.f / 480.f); 155 shrink_transform.Scale(320.f / 640.f, 240.f / 480.f);
156 EXPECT_EQ(shrink_transform, old_layer->GetTargetTransform()); 156 EXPECT_EQ(shrink_transform, old_layer->GetTargetTransform());
157 // New layer animates in to the identity transform. 157 // New layer animates in to the identity transform.
(...skipping 18 matching lines...) Expand all
176 gfx::Transform half_size; 176 gfx::Transform half_size;
177 half_size.Translate(10, 10); 177 half_size.Translate(10, 10);
178 half_size.Scale(0.5f, 0.5f); 178 half_size.Scale(0.5f, 0.5f);
179 window->SetTransform(half_size); 179 window->SetTransform(half_size);
180 window->Show(); 180 window->Show();
181 181
182 Layer* old_layer = window->layer(); 182 Layer* old_layer = window->layer();
183 EXPECT_EQ(1.0f, old_layer->GetTargetOpacity()); 183 EXPECT_EQ(1.0f, old_layer->GetTargetOpacity());
184 184
185 // Cross fade to a larger size, as in a maximize animation. 185 // Cross fade to a larger size, as in a maximize animation.
186 GetWindowState(window.get())->SetBoundsDirectCrossFade( 186 GetWindowState(window.get())
187 gfx::Rect(0, 0, 640, 480)); 187 ->SetBoundsDirectCrossFade(gfx::Rect(0, 0, 640, 480));
188 // Window's layer has been replaced. 188 // Window's layer has been replaced.
189 EXPECT_NE(old_layer, window->layer()); 189 EXPECT_NE(old_layer, window->layer());
190 // Original layer stays opaque and stretches to new size. 190 // Original layer stays opaque and stretches to new size.
191 EXPECT_EQ(1.0f, old_layer->GetTargetOpacity()); 191 EXPECT_EQ(1.0f, old_layer->GetTargetOpacity());
192 EXPECT_EQ("10,10 320x240", old_layer->bounds().ToString()); 192 EXPECT_EQ("10,10 320x240", old_layer->bounds().ToString());
193 EXPECT_EQ(half_size, old_layer->transform()); 193 EXPECT_EQ(half_size, old_layer->transform());
194 194
195 // New layer animates in from the old window's transformed size to the 195 // New layer animates in from the old window's transformed size to the
196 // identity transform. 196 // identity transform.
197 EXPECT_EQ(1.0f, window->layer()->GetTargetOpacity()); 197 EXPECT_EQ(1.0f, window->layer()->GetTargetOpacity());
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 EXPECT_TRUE(layer->GetAnimator()->is_animating()); 276 EXPECT_TRUE(layer->GetAnimator()->is_animating());
277 // Expect default duration (200ms for stock ash minimizing animation). 277 // Expect default duration (200ms for stock ash minimizing animation).
278 EXPECT_EQ(default_duration.InMilliseconds(), 278 EXPECT_EQ(default_duration.InMilliseconds(),
279 layer->GetAnimator()->GetTransitionDuration().InMilliseconds()); 279 layer->GetAnimator()->GetTransitionDuration().InMilliseconds());
280 window->Show(); 280 window->Show();
281 layer->GetAnimator()->StopAnimating(); 281 layer->GetAnimator()->StopAnimating();
282 } 282 }
283 } 283 }
284 284
285 } // namespace ash 285 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/window_animations.cc ('k') | ash/wm/window_cycle_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698