我正在尝试调用当前调用的受保护方法的EXPECT_CALL
。我已经创建了这种方法的暴露者。然后,我将暴露器中的方法添加到了模拟中。
TEST_F(ExposureGainController_Test, SetScale_call_SetExposureGain)
{
TEST_DESCRIPTION("Check logic behind SetScale and auto call of SetExposureGain. ");
ExposureGainControllerExposer c(camMock, scaleFunctionMock,
std::unique_ptr<IMicroscopeOpticsParameters_ImageBrightness_Model>(new ImageBrightness_Model_Mock(0.5)));
EXPECT_CALL(*camMock, RunSetExposureGain()).Times(1);
c.SetScale(5.0);
}
在Exposer中
void RunSetExposureGain()
{
SetExposureGain();
}
// SetScale Function看起来像这样:
void ExposureGainController::SetScale(double scale)
{
if (m_scale != scale)
{
m_scale = scale;
m_gainInDb = ScaleToGainInDb(m_scale);
UpdateResidualScale();
SetExposureGain();
}
}
我正在尝试执行EXPECT_CALL
,但是我无法正确运行它。
我做错了什么?