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

Side by Side Diff: ui/gfx/animation/multi_animation_unittest.cc

Issue 1710253003: Misc. Tab-related cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Better structure for #ifdefs Created 4 years, 9 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 | « ui/gfx/animation/multi_animation.h ('k') | ui/views/controls/glow_hover_controller.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/gfx/animation/multi_animation.h" 5 #include "ui/gfx/animation/multi_animation.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/gfx/animation/animation_container_element.h" 8 #include "ui/gfx/animation/animation_container_element.h"
9 9
10 namespace gfx { 10 namespace gfx {
(...skipping 22 matching lines...) Expand all
33 // Step to 320, which is 20% through the second part. 33 // Step to 320, which is 20% through the second part.
34 as_element->Step(base::TimeTicks() + 34 as_element->Step(base::TimeTicks() +
35 base::TimeDelta::FromMilliseconds(320)); 35 base::TimeDelta::FromMilliseconds(320));
36 EXPECT_DOUBLE_EQ(Tween::CalculateValue(Tween::EASE_OUT, .2), 36 EXPECT_DOUBLE_EQ(Tween::CalculateValue(Tween::EASE_OUT, .2),
37 animation.GetCurrentValue()); 37 animation.GetCurrentValue());
38 } 38 }
39 39
40 TEST(MultiAnimationTest, DifferingStartAndEnd) { 40 TEST(MultiAnimationTest, DifferingStartAndEnd) {
41 // Create a MultiAnimation with two parts. 41 // Create a MultiAnimation with two parts.
42 MultiAnimation::Parts parts; 42 MultiAnimation::Parts parts;
43 parts.push_back(MultiAnimation::Part(200, Tween::LINEAR)); 43 parts.push_back(MultiAnimation::Part(200, 100, 400, Tween::LINEAR));
44 parts[0].start_time_ms = 100;
45 parts[0].end_time_ms = 400;
46 44
47 MultiAnimation animation(parts, MultiAnimation::GetDefaultTimerInterval()); 45 MultiAnimation animation(parts, MultiAnimation::GetDefaultTimerInterval());
48 AnimationContainerElement* as_element = 46 AnimationContainerElement* as_element =
49 static_cast<AnimationContainerElement*>(&animation); 47 static_cast<AnimationContainerElement*>(&animation);
50 as_element->SetStartTime(base::TimeTicks()); 48 as_element->SetStartTime(base::TimeTicks());
51 49
52 // Step to 0. Because the start_time is 100, this should be 100ms into the 50 // Step to 0. Because the start_time is 100, this should be 100ms into the
53 // animation 51 // animation
54 as_element->Step(base::TimeTicks()); 52 as_element->Step(base::TimeTicks());
55 EXPECT_EQ(.25, animation.GetCurrentValue()); 53 EXPECT_EQ(.25, animation.GetCurrentValue());
(...skipping 27 matching lines...) Expand all
83 AnimationContainerElement* as_element = 81 AnimationContainerElement* as_element =
84 static_cast<AnimationContainerElement*>(&animation); 82 static_cast<AnimationContainerElement*>(&animation);
85 as_element->SetStartTime(base::TimeTicks()); 83 as_element->SetStartTime(base::TimeTicks());
86 84
87 // Step to 300, which is greater than the cycle time. 85 // Step to 300, which is greater than the cycle time.
88 as_element->Step(base::TimeTicks() + base::TimeDelta::FromMilliseconds(300)); 86 as_element->Step(base::TimeTicks() + base::TimeDelta::FromMilliseconds(300));
89 EXPECT_EQ(.5, animation.GetCurrentValue()); 87 EXPECT_EQ(.5, animation.GetCurrentValue());
90 } 88 }
91 89
92 } // namespace gfx 90 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/animation/multi_animation.h ('k') | ui/views/controls/glow_hover_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698