| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "CCScrollbarAnimationControllerLinearFade.h" | 7 #include "CCScrollbarAnimationControllerLinearFade.h" |
| 8 | 8 |
| 9 #include "CCScrollbarLayerImpl.h" | 9 #include "CCScrollbarLayerImpl.h" |
| 10 #include "CCSingleThreadProxy.h" | 10 #include "CCSingleThreadProxy.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include <wtf/OwnPtr.h> | |
| 13 | 12 |
| 14 using namespace cc; | 13 using namespace cc; |
| 15 | 14 |
| 16 namespace { | 15 namespace { |
| 17 | 16 |
| 18 class CCScrollbarAnimationControllerLinearFadeTest : public testing::Test { | 17 class CCScrollbarAnimationControllerLinearFadeTest : public testing::Test { |
| 19 protected: | 18 protected: |
| 20 virtual void SetUp() | 19 virtual void SetUp() |
| 21 { | 20 { |
| 22 m_scrollLayer = CCLayerImpl::create(1); | 21 m_scrollLayer = CCLayerImpl::create(1); |
| 23 m_scrollLayer->addChild(CCLayerImpl::create(2)); | 22 m_scrollLayer->addChild(CCLayerImpl::create(2)); |
| 24 m_contentLayer = m_scrollLayer->children()[0]; | 23 m_contentLayer = m_scrollLayer->children()[0]; |
| 25 m_scrollbarLayer = CCScrollbarLayerImpl::create(3); | 24 m_scrollbarLayer = CCScrollbarLayerImpl::create(3); |
| 26 | 25 |
| 27 m_scrollLayer->setMaxScrollPosition(IntSize(50, 50)); | 26 m_scrollLayer->setMaxScrollPosition(IntSize(50, 50)); |
| 28 m_contentLayer->setBounds(IntSize(50, 50)); | 27 m_contentLayer->setBounds(IntSize(50, 50)); |
| 29 | 28 |
| 30 m_scrollbarController = CCScrollbarAnimationControllerLinearFade::create
(m_scrollLayer.get(), 2, 3); | 29 m_scrollbarController = CCScrollbarAnimationControllerLinearFade::create
(m_scrollLayer.get(), 2, 3); |
| 31 m_scrollbarController->setHorizontalScrollbarLayer(m_scrollbarLayer.get(
)); | 30 m_scrollbarController->setHorizontalScrollbarLayer(m_scrollbarLayer.get(
)); |
| 32 } | 31 } |
| 33 | 32 |
| 34 DebugScopedSetImplThread implThread; | 33 DebugScopedSetImplThread implThread; |
| 35 | 34 |
| 36 OwnPtr<CCScrollbarAnimationControllerLinearFade> m_scrollbarController; | 35 scoped_ptr<CCScrollbarAnimationControllerLinearFade> m_scrollbarController; |
| 37 scoped_ptr<CCLayerImpl> m_scrollLayer; | 36 scoped_ptr<CCLayerImpl> m_scrollLayer; |
| 38 CCLayerImpl* m_contentLayer; | 37 CCLayerImpl* m_contentLayer; |
| 39 scoped_ptr<CCScrollbarLayerImpl> m_scrollbarLayer; | 38 scoped_ptr<CCScrollbarLayerImpl> m_scrollbarLayer; |
| 40 | 39 |
| 41 }; | 40 }; |
| 42 | 41 |
| 43 TEST_F(CCScrollbarAnimationControllerLinearFadeTest, verifyHiddenInBegin) | 42 TEST_F(CCScrollbarAnimationControllerLinearFadeTest, verifyHiddenInBegin) |
| 44 { | 43 { |
| 45 m_scrollbarController->animate(0); | 44 m_scrollbarController->animate(0); |
| 46 EXPECT_FLOAT_EQ(0, m_scrollbarLayer->opacity()); | 45 EXPECT_FLOAT_EQ(0, m_scrollbarLayer->opacity()); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 m_scrollbarController->animate(9); | 110 m_scrollbarController->animate(9); |
| 112 EXPECT_FLOAT_EQ(2 / 3.0f, m_scrollbarLayer->opacity()); | 111 EXPECT_FLOAT_EQ(2 / 3.0f, m_scrollbarLayer->opacity()); |
| 113 m_scrollbarController->animate(10); | 112 m_scrollbarController->animate(10); |
| 114 EXPECT_FLOAT_EQ(1 / 3.0f, m_scrollbarLayer->opacity()); | 113 EXPECT_FLOAT_EQ(1 / 3.0f, m_scrollbarLayer->opacity()); |
| 115 m_scrollbarController->animate(11); | 114 m_scrollbarController->animate(11); |
| 116 EXPECT_FLOAT_EQ(0, m_scrollbarLayer->opacity()); | 115 EXPECT_FLOAT_EQ(0, m_scrollbarLayer->opacity()); |
| 117 | 116 |
| 118 } | 117 } |
| 119 | 118 |
| 120 } | 119 } |
| OLD | NEW |