calling 'setTimeout' on bad self (cpp class not export)
This commit is contained in:
parent
b303764a88
commit
80e02de00b
|
@ -419,6 +419,11 @@ struct LuaSensor final : public StoredValueSensor {
|
|||
return m_isRedundant;
|
||||
}
|
||||
|
||||
// do we need method defined exactly on LuaSensor for Luaa to be happy?
|
||||
void setTimeout(int timeoutMs) override {
|
||||
StoredValueSensor::setTimeout(timeoutMs);
|
||||
}
|
||||
|
||||
void setRedundant(bool value) {
|
||||
m_isRedundant = value;
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
|
||||
void showInfo(const char*) const override { }
|
||||
|
||||
void setTimeout(int timeoutMs) {
|
||||
virtual void setTimeout(int timeoutMs) {
|
||||
m_timeoutPeriod = MS2NT(timeoutMs);
|
||||
}
|
||||
|
||||
|
|
|
@ -109,6 +109,15 @@ TEST(LuaBasic, ExpectNumOrNilReturnsNothing) {
|
|||
)"), unexpected);
|
||||
}
|
||||
|
||||
TEST(LuaSensor, Timeout) {
|
||||
EXPECT_FLOAT_EQ(0.0f, testLuaReturnsNumberOrNil(R"(
|
||||
function testFunc()
|
||||
cltSensor = Sensor.new("clt")
|
||||
cltSensor:setTimeout(3000)
|
||||
end
|
||||
)").value_or(0));
|
||||
}
|
||||
|
||||
TEST(SystemLua, ScriptLoads) {
|
||||
startLua();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue