OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 scrollAnimatorNone->scroll(HorizontalScrollbar, ScrollByPixel, 100, 1); | 177 scrollAnimatorNone->scroll(HorizontalScrollbar, ScrollByPixel, 100, 1); |
178 EXPECT_EQ(100, scrollAnimatorNone->currentX()); | 178 EXPECT_EQ(100, scrollAnimatorNone->currentX()); |
179 EXPECT_EQ(0, scrollAnimatorNone->currentY()); | 179 EXPECT_EQ(0, scrollAnimatorNone->currentY()); |
180 scrollAnimatorNone->reset(); | 180 scrollAnimatorNone->reset(); |
181 } | 181 } |
182 | 182 |
183 class ScrollAnimatorNoneTest : public testing::Test { | 183 class ScrollAnimatorNoneTest : public testing::Test { |
184 public: | 184 public: |
185 struct SavePerAxisData : public ScrollAnimatorNone::PerAxisData { | 185 struct SavePerAxisData : public ScrollAnimatorNone::PerAxisData { |
186 SavePerAxisData(const ScrollAnimatorNone::PerAxisData& data) | 186 SavePerAxisData(const ScrollAnimatorNone::PerAxisData& data) |
187 : ScrollAnimatorNone::PerAxisData(m_mockScrollAnimatorNone.get(), 0,
768) | 187 : ScrollAnimatorNone::PerAxisData(0, 768) |
188 , m_mockScrollableArea(true) | 188 , m_mockScrollableArea(true) |
189 , m_mockScrollAnimatorNone(MockScrollAnimatorNone::create(&m_mockScr
ollableArea)) | 189 , m_mockScrollAnimatorNone(MockScrollAnimatorNone::create(&m_mockScr
ollableArea)) |
190 { | 190 { |
191 this->m_currentVelocity = data.m_currentVelocity; | 191 this->m_currentVelocity = data.m_currentVelocity; |
192 this->m_desiredPosition = data.m_desiredPosition; | 192 this->m_desiredPosition = data.m_desiredPosition; |
193 this->m_desiredVelocity = data.m_desiredVelocity; | 193 this->m_desiredVelocity = data.m_desiredVelocity; |
194 this->m_startPosition = data.m_startPosition; | 194 this->m_startPosition = data.m_startPosition; |
195 this->m_startTime = data.m_startTime; | 195 this->m_startTime = data.m_startTime; |
196 this->m_startVelocity = data.m_startVelocity; | 196 this->m_startVelocity = data.m_startVelocity; |
197 this->m_animationTime = data.m_animationTime; | 197 this->m_animationTime = data.m_animationTime; |
(...skipping 16 matching lines...) Expand all Loading... |
214 | 214 |
215 ScrollAnimatorNoneTest() | 215 ScrollAnimatorNoneTest() |
216 : m_mockScrollableArea(true) | 216 : m_mockScrollableArea(true) |
217 , m_mockScrollAnimatorNone(MockScrollAnimatorNone::create(&m_mockScrolla
bleArea)) | 217 , m_mockScrollAnimatorNone(MockScrollAnimatorNone::create(&m_mockScrolla
bleArea)) |
218 { | 218 { |
219 } | 219 } |
220 | 220 |
221 virtual void SetUp() | 221 virtual void SetUp() |
222 { | 222 { |
223 m_currentPosition = 100; | 223 m_currentPosition = 100; |
224 m_data = new ScrollAnimatorNone::PerAxisData(m_mockScrollAnimatorNone.ge
t(), &m_currentPosition, 768); | 224 m_data = new ScrollAnimatorNone::PerAxisData(&m_currentPosition, 768); |
225 } | 225 } |
226 virtual void TearDown() | 226 virtual void TearDown() |
227 { | 227 { |
228 delete m_data; | 228 delete m_data; |
229 } | 229 } |
230 | 230 |
231 void reset(); | 231 void reset(); |
232 bool updateDataFromParameters(float step, float multiplier, float scrollable
Size, double currentTime, ScrollAnimatorNone::Parameters*); | 232 bool updateDataFromParameters(float step, float multiplier, float scrollable
Size, double currentTime, ScrollAnimatorNone::Parameters*); |
233 bool animateScroll(double currentTime); | 233 bool animateScroll(double currentTime); |
234 | 234 |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 EXPECT_TRUE(result); | 1049 EXPECT_TRUE(result); |
1050 result = result && animateScroll(t); | 1050 result = result && animateScroll(t); |
1051 double after = m_currentPosition; | 1051 double after = m_currentPosition; |
1052 EXPECT_GE(before, after); | 1052 EXPECT_GE(before, after); |
1053 | 1053 |
1054 t += kAnimationTime; | 1054 t += kAnimationTime; |
1055 for (; result && t < kEndTime; t += kAnimationTime) | 1055 for (; result && t < kEndTime; t += kAnimationTime) |
1056 result = result && animateScroll(t); | 1056 result = result && animateScroll(t); |
1057 EXPECT_GE(before, m_currentPosition); | 1057 EXPECT_GE(before, m_currentPosition); |
1058 } | 1058 } |
OLD | NEW |