OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "CCLayerTreeHostImpl.h" | 7 #include "CCLayerTreeHostImpl.h" |
8 | 8 |
9 #include "CCAnimationTestCommon.h" | 9 #include "CCAnimationTestCommon.h" |
10 #include "CCHeadsUpDisplayLayerImpl.h" | 10 #include "CCHeadsUpDisplayLayerImpl.h" |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 | 373 |
374 // This point would fall into the non-fast scrollable region except that we'
ve moved the layer down by 25 pixels. | 374 // This point would fall into the non-fast scrollable region except that we'
ve moved the layer down by 25 pixels. |
375 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(40, 10), CCInputHandlerClient::Wh
eel), CCInputHandlerClient::ScrollStarted); | 375 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(40, 10), CCInputHandlerClient::Wh
eel), CCInputHandlerClient::ScrollStarted); |
376 m_hostImpl->scrollBy(IntPoint(), IntSize(0, 1)); | 376 m_hostImpl->scrollBy(IntPoint(), IntSize(0, 1)); |
377 m_hostImpl->scrollEnd(); | 377 m_hostImpl->scrollEnd(); |
378 | 378 |
379 // This point is still inside the non-fast region. | 379 // This point is still inside the non-fast region. |
380 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(10, 10), CCInputHandlerClient::Wh
eel), CCInputHandlerClient::ScrollOnMainThread); | 380 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(10, 10), CCInputHandlerClient::Wh
eel), CCInputHandlerClient::ScrollOnMainThread); |
381 } | 381 } |
382 | 382 |
| 383 TEST_F(CCLayerTreeHostImplTest, maxScrollPositionChangedByDeviceScaleFactor) |
| 384 { |
| 385 setupScrollAndContentsLayers(IntSize(100, 100)); |
| 386 |
| 387 float deviceScaleFactor = 2; |
| 388 IntSize layoutViewport(25, 25); |
| 389 IntSize deviceViewport(layoutViewport); |
| 390 deviceViewport.scale(deviceScaleFactor); |
| 391 m_hostImpl->setViewportSize(layoutViewport, deviceViewport); |
| 392 m_hostImpl->setDeviceScaleFactor(deviceScaleFactor); |
| 393 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollPosition(), IntSize(25, 25)); |
| 394 |
| 395 deviceScaleFactor = 1; |
| 396 m_hostImpl->setViewportSize(layoutViewport, layoutViewport); |
| 397 m_hostImpl->setDeviceScaleFactor(deviceScaleFactor); |
| 398 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollPosition(), IntSize(75, 75)); |
| 399 } |
| 400 |
383 TEST_F(CCLayerTreeHostImplTest, pinchGesture) | 401 TEST_F(CCLayerTreeHostImplTest, pinchGesture) |
384 { | 402 { |
385 setupScrollAndContentsLayers(IntSize(100, 100)); | 403 setupScrollAndContentsLayers(IntSize(100, 100)); |
386 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); | 404 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); |
387 initializeRendererAndDrawFrame(); | 405 initializeRendererAndDrawFrame(); |
388 | 406 |
389 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); | 407 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); |
390 ASSERT(scrollLayer); | 408 ASSERT(scrollLayer); |
391 | 409 |
392 const float minPageScale = 0.5, maxPageScale = 4; | 410 const float minPageScale = 0.5, maxPageScale = 4; |
(...skipping 3716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4109 while (removeRenderPassesCases[testCaseIndex].name) { | 4127 while (removeRenderPassesCases[testCaseIndex].name) { |
4110 RenderPassRemovalTestData testData; | 4128 RenderPassRemovalTestData testData; |
4111 configureRenderPassTestData(removeRenderPassesCases[testCaseIndex].initS
cript, testData, renderer.get()); | 4129 configureRenderPassTestData(removeRenderPassesCases[testCaseIndex].initS
cript, testData, renderer.get()); |
4112 CCLayerTreeHostImpl::removeRenderPasses(CCLayerTreeHostImpl::CullRenderP
assesWithCachedTextures(*renderer), testData); | 4130 CCLayerTreeHostImpl::removeRenderPasses(CCLayerTreeHostImpl::CullRenderP
assesWithCachedTextures(*renderer), testData); |
4113 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat
a); | 4131 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat
a); |
4114 testCaseIndex++; | 4132 testCaseIndex++; |
4115 } | 4133 } |
4116 } | 4134 } |
4117 | 4135 |
4118 } // namespace | 4136 } // namespace |
OLD | NEW |