本文整理汇总了C++中OwnPtrWillBeRawPtr::hasAnimationThatRequiresService方法的典型用法代码示例。如果您正苦于以下问题:C++ OwnPtrWillBeRawPtr::hasAnimationThatRequiresService方法的具体用法?C++ OwnPtrWillBeRawPtr::hasAnimationThatRequiresService怎么用?C++ OwnPtrWillBeRawPtr::hasAnimationThatRequiresService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OwnPtrWillBeRawPtr
的用法示例。
在下文中一共展示了OwnPtrWillBeRawPtr::hasAnimationThatRequiresService方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ScrollAnimator
// Test that a smooth scroll offset animation is aborted when followed by a
// non-smooth scroll offset animation.
TEST(ScrollAnimatorTest, AnimatedScrollAborted)
{
OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea =
MockScrollableArea::create(true);
OwnPtrWillBeRawPtr<ScrollAnimator> scrollAnimator = adoptPtrWillBeNoop(
new ScrollAnimator(scrollableArea.get(), getMockedTime));
EXPECT_CALL(*scrollableArea, minimumScrollPosition()).Times(AtLeast(1))
.WillRepeatedly(Return(IntPoint()));
EXPECT_CALL(*scrollableArea, maximumScrollPosition()).Times(AtLeast(1))
.WillRepeatedly(Return(IntPoint(1000, 1000)));
EXPECT_CALL(*scrollableArea, setScrollOffset(_, _)).Times(3);
EXPECT_CALL(*scrollableArea, registerForAnimation()).Times(2);
EXPECT_CALL(*scrollableArea, scheduleAnimation()).Times(AtLeast(1))
.WillRepeatedly(Return(true));
EXPECT_FALSE(scrollAnimator->hasAnimationThatRequiresService());
// Smooth scroll.
ScrollResultOneDimensional result = scrollAnimator->userScroll(
HorizontalScrollbar, ScrollByLine, 100, 1);
EXPECT_TRUE(scrollAnimator->hasAnimationThatRequiresService());
EXPECT_TRUE(result.didScroll);
EXPECT_FLOAT_EQ(0.0, result.unusedScrollDelta);
EXPECT_TRUE(scrollAnimator->hasRunningAnimation());
gMockedTime += 0.05;
scrollAnimator->updateCompositorAnimations();
scrollAnimator->tickAnimation(getMockedTime());
EXPECT_NE(100, scrollAnimator->currentPosition().x());
EXPECT_NE(0, scrollAnimator->currentPosition().x());
EXPECT_EQ(0, scrollAnimator->currentPosition().y());
float x = scrollAnimator->currentPosition().x();
// Instant scroll.
result = scrollAnimator->userScroll(
HorizontalScrollbar, ScrollByPrecisePixel, 100, 1);
EXPECT_TRUE(result.didScroll);
EXPECT_FALSE(scrollAnimator->hasRunningAnimation());
EXPECT_EQ(x + 100, scrollAnimator->currentPosition().x());
EXPECT_EQ(0, scrollAnimator->currentPosition().y());
reset(*scrollAnimator);
}