本文整理汇总了C++中Fixture::MakeDeviceContext方法的典型用法代码示例。如果您正苦于以下问题:C++ Fixture::MakeDeviceContext方法的具体用法?C++ Fixture::MakeDeviceContext怎么用?C++ Fixture::MakeDeviceContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fixture
的用法示例。
在下文中一共展示了Fixture::MakeDeviceContext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VerifyEffectRealizationSources
void VerifyEffectRealizationSources(TestEffect* testEffect)
{
Fixture f;
f.m_deviceContext->DrawImageMethod.AllowAnyCall();
bool setInputCalled = false;
bool setInputCountCalled = false;
bool setValueCalled = false;
f.m_deviceContext->CreateEffectMethod.SetExpectedCalls(1,
[&](IID const&, ID2D1Effect** effect)
{
ComPtr<MockD2DEffect> mockEffect = Make<MockD2DEffect>();
mockEffect.CopyTo(effect);
mockEffect->MockSetInput =
[&](UINT32, ID2D1Image*)
{
Assert::IsFalse(setInputCalled);
setInputCalled = true;
};
mockEffect->MockSetInputCount =
[&]
{
Assert::IsFalse(setInputCountCalled);
setInputCountCalled = true;
return S_OK;
};
mockEffect->MockSetValue =
[&](UINT32, D2D1_PROPERTY_TYPE, CONST BYTE*, UINT32)
{
Assert::IsFalse(setValueCalled);
setValueCalled = true;
return S_OK;
};
return S_OK;
});
f.m_drawingSession = nullptr;
f.m_drawingSession = CanvasDrawingSession::CreateNew(f.m_deviceContext.Get(), std::make_shared<StubCanvasDrawingSessionAdapter>());
f.m_drawingSession->DrawImageAtOrigin(testEffect);
Assert::IsTrue(setInputCalled);
Assert::IsTrue(setInputCountCalled);
Assert::IsTrue(setValueCalled);
// Drawing on a second device context that shares the same device should NOT rerealize the effect.
auto deviceContext2 = f.MakeDeviceContext();
deviceContext2->DrawImageMethod.AllowAnyCall();
deviceContext2->CreateEffectMethod.SetExpectedCalls(0);
auto drawingSession2 = CanvasDrawingSession::CreateNew(deviceContext2.Get(), std::make_shared<StubCanvasDrawingSessionAdapter>());
drawingSession2->DrawImageAtOrigin(testEffect);
}