本文整理汇总了C++中testing::AtLeast方法的典型用法代码示例。如果您正苦于以下问题:C++ testing::AtLeast方法的具体用法?C++ testing::AtLeast怎么用?C++ testing::AtLeast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testing
的用法示例。
在下文中一共展示了testing::AtLeast方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: adoptPtrWillBeNoop
TEST(ScrollAnimatorTest, Disabled)
{
OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea::create(false);
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(8);
EXPECT_CALL(*scrollableArea, registerForAnimation()).Times(0);
scrollAnimator->userScroll(HorizontalScrollbar, ScrollByLine, 100, 1);
EXPECT_EQ(100, scrollAnimator->currentPosition().x());
EXPECT_EQ(0, scrollAnimator->currentPosition().y());
reset(*scrollAnimator);
scrollAnimator->userScroll(HorizontalScrollbar, ScrollByPage, 100, 1);
EXPECT_EQ(100, scrollAnimator->currentPosition().x());
EXPECT_EQ(0, scrollAnimator->currentPosition().y());
reset(*scrollAnimator);
scrollAnimator->userScroll(HorizontalScrollbar, ScrollByDocument, 100, 1);
EXPECT_EQ(100, scrollAnimator->currentPosition().x());
EXPECT_EQ(0, scrollAnimator->currentPosition().y());
reset(*scrollAnimator);
scrollAnimator->userScroll(HorizontalScrollbar, ScrollByPixel, 100, 1);
EXPECT_EQ(100, scrollAnimator->currentPosition().x());
EXPECT_EQ(0, scrollAnimator->currentPosition().y());
reset(*scrollAnimator);
}
示例2: so
TEST_F(SimpleObjectTest, erase_opengl_buffers_before_buffer_generating)
{
EXPECT_CALL(gl, gl_GetError()).Times(AnyNumber());
{
InSequence s;
EXPECT_CALL(gl, gl_GetError()).Times(AtLeast(1));
EXPECT_CALL(gl, gl_GenBuffers(_,_)).Times(AtLeast(1));
}
SimpleObject so(to);
}
示例3: domain
TEST_F(JoynrClusterControllerRuntimeTest, registerAndSubscribeToLocalProvider) {
createRuntimeMqttWithHttpBackend();
std::remove(LibjoynrSettings::DEFAULT_SUBSCRIPTIONREQUEST_STORAGE_FILENAME().c_str());
std::string domain("JoynrClusterControllerRuntimeTest.Domain.A");
auto mockTestProvider = std::make_shared<MockTestProvider>();
EXPECT_CALL(
*mockTestProvider,
getLocation(A<std::function<void(const types::Localisation::GpsLocation&)>>(),
A<std::function<void(const joynr::exceptions::ProviderRuntimeException&)>>())
)
.Times(AtLeast(1))
.WillRepeatedly(Invoke(
this,
&JoynrClusterControllerRuntimeTest::invokeOnSuccessWithGpsLocation
));
runtime->startMessaging();
std::string participantId = runtime->registerProvider<tests::testProvider>(
domain,
mockTestProvider
);
ProxyBuilder<tests::testProxy>* testProxyBuilder =
runtime->createProxyBuilder<tests::testProxy>(domain);
DiscoveryQos discoveryQos(1000);
discoveryQos.addCustomParameter("fixedParticipantId", participantId);
discoveryQos.setDiscoveryTimeoutMs(50);
discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::FIXED_PARTICIPANT);
tests::testProxy* testProxy = testProxyBuilder
->setMessagingQos(MessagingQos(5000))
->setCached(false)
->setDiscoveryQos(discoveryQos)
->build();
auto mockSubscriptionListener = std::make_shared<MockGpsSubscriptionListener>();
EXPECT_CALL(*mockSubscriptionListener, onReceive(gpsLocation))
.Times(AtLeast(1));
OnChangeWithKeepAliveSubscriptionQos subscriptionQos(
480, // validity
200, // min interval
200, // max interval
200 // alert after interval
);
std::string subscriptionId = testProxy->subscribeToLocation(mockSubscriptionListener, subscriptionQos);
std::this_thread::sleep_for(std::chrono::milliseconds(250));
testProxy->unsubscribeFromLocation(subscriptionId);
delete testProxy;
delete testProxyBuilder;
}
示例4: domain
TEST_F(JoynrClusterControllerRuntimeTest, registerAndSubscribeToLocalProvider)
{
createRuntimeMqtt();
std::remove(LibjoynrSettings::DEFAULT_SUBSCRIPTIONREQUEST_PERSISTENCE_FILENAME().c_str());
std::string domain("JoynrClusterControllerRuntimeTest.Domain.A");
auto mockTestProvider = std::make_shared<MockTestProvider>();
types::ProviderQos providerQos;
std::chrono::milliseconds millisSinceEpoch =
std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::system_clock::now().time_since_epoch());
providerQos.setPriority(millisSinceEpoch.count());
providerQos.setScope(joynr::types::ProviderScope::GLOBAL);
providerQos.setSupportsOnChangeSubscriptions(true);
EXPECT_CALL(
*mockTestProvider,
getLocation(
A<std::function<void(const types::Localisation::GpsLocation&)>>(),
A<std::function<void(const joynr::exceptions::ProviderRuntimeException&)>>()))
.Times(AtLeast(1))
.WillRepeatedly(Invoke(
this, &JoynrClusterControllerRuntimeTest::invokeOnSuccessWithGpsLocation));
runtime->startExternalCommunication();
std::string participantId =
runtime->registerProvider<tests::testProvider>(domain, mockTestProvider, providerQos);
std::shared_ptr<ProxyBuilder<tests::testProxy>> testProxyBuilder =
runtime->createProxyBuilder<tests::testProxy>(domain);
DiscoveryQos discoveryQos(1000);
discoveryQos.addCustomParameter("fixedParticipantId", participantId);
discoveryQos.setDiscoveryTimeoutMs(50);
discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::FIXED_PARTICIPANT);
std::shared_ptr<tests::testProxy> testProxy(
testProxyBuilder->setMessagingQos(MessagingQos(5000))
->setDiscoveryQos(discoveryQos)
->build());
auto mockSubscriptionListener = std::make_shared<MockGpsSubscriptionListener>();
EXPECT_CALL(*mockSubscriptionListener, onReceive(gpsLocation)).Times(AtLeast(1));
auto subscriptionQos =
std::make_shared<OnChangeWithKeepAliveSubscriptionQos>(480, // validity
1000, // publication ttl
200, // min interval
200, // max interval
200 // alert after interval
);
auto future = testProxy->subscribeToLocation(mockSubscriptionListener, subscriptionQos);
std::string subscriptionId;
JOYNR_ASSERT_NO_THROW({ future->get(5000, subscriptionId); });
示例5: scrollableArea
TEST(ScrollAnimatorEnabled, Enabled)
{
MockScrollableArea scrollableArea(true);
MockScrollAnimatorNone scrollAnimatorNone(&scrollableArea);
EXPECT_CALL(scrollableArea, scrollSize(_)).Times(AtLeast(1)).WillRepeatedly(Return(1000));
EXPECT_CALL(scrollableArea, setScrollOffset(_)).Times(3);
scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByLine, 100, 1);
EXPECT_NE(100, scrollAnimatorNone.currentX());
EXPECT_NE(0, scrollAnimatorNone.currentX());
EXPECT_EQ(0, scrollAnimatorNone.currentY());
scrollAnimatorNone.reset();
scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByPage, 100, 1);
EXPECT_NE(100, scrollAnimatorNone.currentX());
EXPECT_NE(0, scrollAnimatorNone.currentX());
EXPECT_EQ(0, scrollAnimatorNone.currentY());
scrollAnimatorNone.reset();
scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByPixel, 4, 25);
EXPECT_NE(100, scrollAnimatorNone.currentX());
EXPECT_NE(0, scrollAnimatorNone.currentX());
EXPECT_EQ(0, scrollAnimatorNone.currentY());
scrollAnimatorNone.reset();
}
示例6: 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);
}
示例7: addMediaStream
std::shared_ptr<erizo::MockMediaStream> addMediaStream(bool is_publisher, StreamConfig config) {
std::string id = std::to_string(index);
std::string label = std::to_string(index);
uint32_t video_sink_ssrc = getSsrcFromIndex(index);
uint32_t audio_sink_ssrc = getSsrcFromIndex(index) + 1;
uint32_t video_source_ssrc = getSsrcFromIndex(index) + 2;
uint32_t audio_source_ssrc = getSsrcFromIndex(index) + 3;
auto media_stream = std::make_shared<erizo::MockMediaStream>(nullptr, nullptr, id, label,
rtp_maps, is_publisher);
media_stream->setVideoSinkSSRC(video_sink_ssrc);
media_stream->setAudioSinkSSRC(audio_sink_ssrc);
media_stream->setVideoSourceSSRC(video_source_ssrc);
media_stream->setAudioSourceSSRC(audio_source_ssrc);
EXPECT_CALL(*media_stream, getMaxVideoBW()).Times(AtLeast(0)).WillRepeatedly(Return(config.max_video_bw));
EXPECT_CALL(*media_stream, getVideoBitrate()).Times(AtLeast(0)).WillRepeatedly(Return(config.bitrate_sent));
EXPECT_CALL(*media_stream, getBitrateFromMaxQualityLayer()).Times(AtLeast(0))
.WillRepeatedly(Return(config.max_quality_bitrate));
EXPECT_CALL(*media_stream, isSlideShowModeEnabled()).Times(AtLeast(0)).WillRepeatedly(Return(config.slideshow));
EXPECT_CALL(*media_stream, isSimulcast()).Times(AtLeast(0)).WillRepeatedly(Return(config.simulcast));
index++;
return media_stream;
}
示例8: addMediaStream
std::shared_ptr<erizo::MockMediaStream> addMediaStream(bool is_publisher, uint32_t max_video_bw) {
std::string id = std::to_string(index);
std::string label = std::to_string(index);
uint32_t video_sink_ssrc = getSsrcFromIndex(index);
uint32_t audio_sink_ssrc = getSsrcFromIndex(index) + 1;
uint32_t video_source_ssrc = getSsrcFromIndex(index) + 2;
uint32_t audio_source_ssrc = getSsrcFromIndex(index) + 3;
auto media_stream = std::make_shared<erizo::MockMediaStream>(nullptr, nullptr, id, label,
rtp_maps, is_publisher);
media_stream->setVideoSinkSSRC(video_sink_ssrc);
media_stream->setAudioSinkSSRC(audio_sink_ssrc);
media_stream->setVideoSourceSSRC(video_source_ssrc);
media_stream->setAudioSourceSSRC(audio_source_ssrc);
EXPECT_CALL(*media_stream, getMaxVideoBW()).Times(AtLeast(0)).WillRepeatedly(Return(max_video_bw));
index++;
return media_stream;
}
示例9: adoptPtr
TEST(ScrollAnimatorTest, Enabled)
{
OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea::create(true);
OwnPtr<ScrollAnimator> scrollAnimator = adoptPtr(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(12);
EXPECT_CALL(*scrollableArea, registerForAnimation()).Times(3);
EXPECT_FALSE(scrollAnimator->hasRunningAnimation());
ScrollResultOneDimensional result = scrollAnimator->userScroll(HorizontalScrollbar, ScrollByLine, 100, -1);
EXPECT_FALSE(scrollAnimator->hasRunningAnimation());
EXPECT_FALSE(result.didScroll);
EXPECT_FLOAT_EQ(-100.0, result.unusedScrollDelta);
result = scrollAnimator->userScroll(HorizontalScrollbar, ScrollByLine, 100, 1);
EXPECT_TRUE(scrollAnimator->hasRunningAnimation());
EXPECT_TRUE(result.didScroll);
EXPECT_FLOAT_EQ(0.0, result.unusedScrollDelta);
gMockedTime += 0.05;
scrollAnimator->serviceScrollAnimations();
EXPECT_NE(100, scrollAnimator->currentPosition().x());
EXPECT_NE(0, scrollAnimator->currentPosition().x());
EXPECT_EQ(0, scrollAnimator->currentPosition().y());
reset(*scrollAnimator);
scrollAnimator->userScroll(HorizontalScrollbar, ScrollByPage, 100, 1);
EXPECT_TRUE(scrollAnimator->hasRunningAnimation());
gMockedTime += 0.05;
scrollAnimator->serviceScrollAnimations();
EXPECT_NE(100, scrollAnimator->currentPosition().x());
EXPECT_NE(0, scrollAnimator->currentPosition().x());
EXPECT_EQ(0, scrollAnimator->currentPosition().y());
reset(*scrollAnimator);
scrollAnimator->userScroll(HorizontalScrollbar, ScrollByPixel, 4, 25);
EXPECT_TRUE(scrollAnimator->hasRunningAnimation());
gMockedTime += 0.05;
scrollAnimator->serviceScrollAnimations();
EXPECT_NE(100, scrollAnimator->currentPosition().x());
EXPECT_NE(0, scrollAnimator->currentPosition().x());
EXPECT_EQ(0, scrollAnimator->currentPosition().y());
gMockedTime += 1.0;
scrollAnimator->serviceScrollAnimations();
EXPECT_FALSE(scrollAnimator->hasRunningAnimation());
EXPECT_EQ(100, scrollAnimator->currentPosition().x());
reset(*scrollAnimator);
scrollAnimator->userScroll(HorizontalScrollbar, ScrollByPrecisePixel, 4, 25);
EXPECT_FALSE(scrollAnimator->hasRunningAnimation());
EXPECT_EQ(100, scrollAnimator->currentPosition().x());
EXPECT_NE(0, scrollAnimator->currentPosition().x());
EXPECT_EQ(0, scrollAnimator->currentPosition().y());
reset(*scrollAnimator);
}