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

Side by Side Diff: ui/views/animation/square_ink_drop_animation_unittest.cc

Issue 1682893002: Color the ink drop ripple and hover effects based on theming. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unit tests Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_UNITTEST_H_ 5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_UNITTEST_H_
6 #define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_UNITTEST_H_ 6 #define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_UNITTEST_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "ui/gfx/color_palette.h"
11 #include "ui/gfx/geometry/size.h" 12 #include "ui/gfx/geometry/size.h"
12 #include "ui/gfx/geometry/size_f.h" 13 #include "ui/gfx/geometry/size_f.h"
13 #include "ui/views/animation/ink_drop_animation_observer.h" 14 #include "ui/views/animation/ink_drop_animation_observer.h"
14 #include "ui/views/animation/ink_drop_state.h" 15 #include "ui/views/animation/ink_drop_state.h"
15 #include "ui/views/animation/square_ink_drop_animation.h" 16 #include "ui/views/animation/square_ink_drop_animation.h"
16 #include "ui/views/animation/test/square_ink_drop_animation_test_api.h" 17 #include "ui/views/animation/test/square_ink_drop_animation_test_api.h"
17 #include "ui/views/animation/test/test_ink_drop_animation_observer.h" 18 #include "ui/views/animation/test/test_ink_drop_animation_observer.h"
18 19
19 namespace views { 20 namespace views {
20 namespace test { 21 namespace test {
(...skipping 19 matching lines...) Expand all
40 const int kTransformedSize = 2 * kHalfTransformedSize; 41 const int kTransformedSize = 2 * kHalfTransformedSize;
41 42
42 // Constant points in the drawn space that will be transformed. 43 // Constant points in the drawn space that will be transformed.
43 const gfx::Point center(kHalfDrawnSize, kHalfDrawnSize); 44 const gfx::Point center(kHalfDrawnSize, kHalfDrawnSize);
44 const gfx::Point mid_left(0, kHalfDrawnSize); 45 const gfx::Point mid_left(0, kHalfDrawnSize);
45 const gfx::Point mid_right(kDrawnSize, kHalfDrawnSize); 46 const gfx::Point mid_right(kDrawnSize, kHalfDrawnSize);
46 const gfx::Point top_mid(kHalfDrawnSize, 0); 47 const gfx::Point top_mid(kHalfDrawnSize, 0);
47 const gfx::Point bottom_mid(kHalfDrawnSize, kDrawnSize); 48 const gfx::Point bottom_mid(kHalfDrawnSize, kDrawnSize);
48 49
49 scoped_ptr<SquareInkDropAnimation> ink_drop_animation( 50 scoped_ptr<SquareInkDropAnimation> ink_drop_animation(
50 new SquareInkDropAnimation(gfx::Size(kDrawnSize, kDrawnSize), 2, 51 new SquareInkDropAnimation(gfx::kPlaceholderColor,
52 gfx::Size(kDrawnSize, kDrawnSize), 2,
51 gfx::Size(kHalfDrawnSize, kHalfDrawnSize), 1)); 53 gfx::Size(kHalfDrawnSize, kHalfDrawnSize), 1));
52 SquareInkDropAnimationTestApi test_api(ink_drop_animation.get()); 54 SquareInkDropAnimationTestApi test_api(ink_drop_animation.get());
53 55
54 SquareInkDropAnimationTestApi::InkDropTransforms transforms; 56 SquareInkDropAnimationTestApi::InkDropTransforms transforms;
55 test_api.CalculateCircleTransforms( 57 test_api.CalculateCircleTransforms(
56 gfx::Size(kTransformedSize, kTransformedSize), &transforms); 58 gfx::Size(kTransformedSize, kTransformedSize), &transforms);
57 59
58 // Transform variables to reduce verbosity of actual verification code. 60 // Transform variables to reduce verbosity of actual verification code.
59 const gfx::Transform kTopLeftTransform = 61 const gfx::Transform kTopLeftTransform =
60 transforms[SquareInkDropAnimationTestApi::PaintedShape::TOP_LEFT_CIRCLE]; 62 transforms[SquareInkDropAnimationTestApi::PaintedShape::TOP_LEFT_CIRCLE];
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 const int kTransformedHeight = 2 * kHalfTransformedHeight; 148 const int kTransformedHeight = 2 * kHalfTransformedHeight;
147 149
148 // Constant points in the drawn space that will be transformed. 150 // Constant points in the drawn space that will be transformed.
149 const gfx::Point center(kHalfDrawnSize, kHalfDrawnSize); 151 const gfx::Point center(kHalfDrawnSize, kHalfDrawnSize);
150 const gfx::Point mid_left(0, kHalfDrawnSize); 152 const gfx::Point mid_left(0, kHalfDrawnSize);
151 const gfx::Point mid_right(kDrawnSize, kHalfDrawnSize); 153 const gfx::Point mid_right(kDrawnSize, kHalfDrawnSize);
152 const gfx::Point top_mid(kHalfDrawnSize, 0); 154 const gfx::Point top_mid(kHalfDrawnSize, 0);
153 const gfx::Point bottom_mid(kHalfDrawnSize, kDrawnSize); 155 const gfx::Point bottom_mid(kHalfDrawnSize, kDrawnSize);
154 156
155 scoped_ptr<SquareInkDropAnimation> ink_drop_animation( 157 scoped_ptr<SquareInkDropAnimation> ink_drop_animation(
156 new SquareInkDropAnimation(gfx::Size(kDrawnSize, kDrawnSize), 2, 158 new SquareInkDropAnimation(gfx::kPlaceholderColor,
159 gfx::Size(kDrawnSize, kDrawnSize), 2,
157 gfx::Size(kHalfDrawnSize, kHalfDrawnSize), 1)); 160 gfx::Size(kHalfDrawnSize, kHalfDrawnSize), 1));
158 SquareInkDropAnimationTestApi test_api(ink_drop_animation.get()); 161 SquareInkDropAnimationTestApi test_api(ink_drop_animation.get());
159 162
160 SquareInkDropAnimationTestApi::InkDropTransforms transforms; 163 SquareInkDropAnimationTestApi::InkDropTransforms transforms;
161 test_api.CalculateRectTransforms( 164 test_api.CalculateRectTransforms(
162 gfx::Size(kTransformedWidth, kTransformedHeight), kTransformedRadius, 165 gfx::Size(kTransformedWidth, kTransformedHeight), kTransformedRadius,
163 &transforms); 166 &transforms);
164 167
165 // Transform variables to reduce verbosity of actual verification code. 168 // Transform variables to reduce verbosity of actual verification code.
166 const gfx::Transform kTopLeftTransform = 169 const gfx::Transform kTopLeftTransform =
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 EXPECT_EQ(gfx::Point(0, -kHalfTransformedHeight), 234 EXPECT_EQ(gfx::Point(0, -kHalfTransformedHeight),
232 TransformPoint(kVerticalTransform, top_mid)); 235 TransformPoint(kVerticalTransform, top_mid));
233 EXPECT_EQ(gfx::Point(0, kHalfTransformedHeight), 236 EXPECT_EQ(gfx::Point(0, kHalfTransformedHeight),
234 TransformPoint(kVerticalTransform, bottom_mid)); 237 TransformPoint(kVerticalTransform, bottom_mid));
235 } 238 }
236 239
237 } // namespace test 240 } // namespace test
238 } // namespace views 241 } // namespace views
239 242
240 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_UNITTEST_H_ 243 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_UNITTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698