mirror of https://github.com/nymea/nymea.git
fixes
parent
5002fad6d9
commit
399f406d10
|
|
@ -1697,19 +1697,19 @@ void ThingManagerImplementation::onAutoThingDisappeared(const ThingId &thingId)
|
|||
Thing *thing = m_configuredThings.value(thingId);
|
||||
|
||||
if (!thing) {
|
||||
qWarning(dcThingManager) << "Received an autoThingDisappeared signal but this thing is unknown:" << thingId;
|
||||
qCWarning(dcThingManager) << "Received an autoThingDisappeared signal but this thing is unknown:" << thingId;
|
||||
return;
|
||||
}
|
||||
|
||||
ThingClass thingClass = m_supportedThings.value(thing->thingClassId());
|
||||
|
||||
if (thingClass.pluginId() != plugin->pluginId()) {
|
||||
qWarning(dcThingManager) << "Received a autoThingDisappeared signal but emitting plugin does not own the thing";
|
||||
qCWarning(dcThingManager) << "Received a autoThingDisappeared signal but emitting plugin does not own the thing";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!thing->autoCreated()) {
|
||||
qWarning(dcThingManager) << "Received an autoThingDisappeared signal but thing creationMethod is not CreateMothodAuto";
|
||||
qCWarning(dcThingManager) << "Received an autoThingDisappeared signal but thing creationMethod is not CreateMothodAuto";
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -171,11 +171,11 @@ bool StateDescriptor::operator ==(const State &state) const
|
|||
if ((m_stateTypeId != state.stateTypeId()) || (m_thingId != state.thingId())) {
|
||||
return false;
|
||||
}
|
||||
if (!m_stateValue.canConvert(state.value().type())) {
|
||||
QVariant convertedValue = m_stateValue;
|
||||
bool res = convertedValue.convert(state.value().type());
|
||||
if (!res) {
|
||||
return false;
|
||||
}
|
||||
QVariant convertedValue = m_stateValue;
|
||||
convertedValue.convert(state.value().type());
|
||||
switch (m_operatorType) {
|
||||
case Types::ValueOperatorEquals:
|
||||
return convertedValue == state.value();
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@
|
|||
"name": "double",
|
||||
"displayName": "Dummy double state",
|
||||
"displayNameEvent": "Dummy double state changed",
|
||||
"type": "int",
|
||||
"type": "double",
|
||||
"minValue": 0,
|
||||
"maxValue": 100,
|
||||
"defaultValue": 2.7
|
||||
|
|
|
|||
|
|
@ -382,10 +382,10 @@ void TestIntegrations::addThing_data()
|
|||
QTest::newRow("User, JustAdd, wrong param") << mockThingClassId << invalidThingParams << true << Thing::ThingErrorInvalidParameter;
|
||||
|
||||
thingParams.clear(); thingParams << httpportParam << fakeparam;
|
||||
QTest::newRow("USer, JustAdd, additional invalid param") << mockThingClassId << thingParams << false << Thing::ThingErrorNoError;
|
||||
QTest::newRow("USer, JustAdd, additional invalid param") << mockThingClassId << thingParams << false << Thing::ThingErrorInvalidParameter;
|
||||
|
||||
thingParams.clear(); thingParams << httpportParam << fakeparam2;
|
||||
QTest::newRow("USer, JustAdd, additional param, valid but unused") << mockThingClassId << thingParams << true << Thing::ThingErrorNoError;
|
||||
QTest::newRow("USer, JustAdd, duplicate param") << mockThingClassId << thingParams << true << Thing::ThingErrorInvalidParameter;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -265,13 +265,14 @@ void TestRules::setWritableStateValue(const ThingId &thingId, const StateTypeId
|
|||
QVariantList stateChangedVariants = checkNotifications(stateSpy, "Integrations.StateChanged");
|
||||
QVERIFY2(stateChangedVariants.count() == 1, "Did not get Integrations.StateChanged notification.");
|
||||
|
||||
qCDebug(dcTests()) << "Notification content:" << qUtf8Printable(QJsonDocument::fromVariant(stateChangedVariants).toJson());
|
||||
QVariantMap notification = stateChangedVariants.first().toMap().value("params").toMap();
|
||||
QVERIFY2(notification.contains("thingId"), "Integrations.StateChanged notification does not contain thingId");
|
||||
QVERIFY2(ThingId(notification.value("thingId").toString()) == thingId, "Integrations.StateChanged notification does not contain the correct thingId");
|
||||
QVERIFY2(notification.contains("stateTypeId"), "Integrations.StateChanged notification does not contain stateTypeId");
|
||||
QVERIFY2(StateTypeId(notification.value("stateTypeId").toString()) == stateTypeId, "Integrations.StateChanged notification does not contain the correct stateTypeId");
|
||||
QVERIFY2(notification.contains("value"), "Integrations.StateChanged notification does not contain new state value");
|
||||
QVERIFY2(notification.value("value") == QVariant(value), "Integrations.StateChanged notification does not contain the new value");
|
||||
QVERIFY2(notification.value("value") == QVariant(value), QString("Integrations.StateChanged notification does not contain the new value. Got: %1, Expected: %2").arg(notification.value("value").toString()).arg(QVariant(value).toString()).toUtf8());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1990,11 +1991,11 @@ void TestRules::testChildEvaluator_data()
|
|||
QTest::addColumn<bool>("trigger");
|
||||
QTest::addColumn<bool>("active");
|
||||
|
||||
QTest::newRow("Unchanged | 2 | 2.5 | String value 1 | #FF0000") << testThingId << ruleMap << 2 << 2.5 << "String value 1" << "#FF0000" << false << false;
|
||||
QTest::newRow("Unchanged | 60 | 2.5 | String value 2 | #FF0000") << testThingId << ruleMap << 60 << 2.5 << "String value 2" << "#FF0000" << false << false;
|
||||
QTest::newRow("Unchanged | 60 | 20.5 | String value 2 | #FF0000") << testThingId << ruleMap << 60 << 20.5 << "String value 2" << "#FF0000" << false << false;
|
||||
QTest::newRow("Active | 60 | 20.5 | String value 2 | #00FF00") << testThingId << ruleMap << 60 << 20.5 << "String value 2" << "#00FF00" << true << true;
|
||||
QTest::newRow("Active | 60 | 20.5 | String value 2 | #00FF00") << testThingId << ruleMap << 60 << 20.5 << "String value 2" << "#00FF00" << true << true;
|
||||
QTest::newRow("Unchanged | 2 | 2.5 | String value 1 | #FF0000") << testThingId << ruleMap << 2 << 2.5 << "String value 1" << "#ff0000" << false << false;
|
||||
QTest::newRow("Unchanged | 60 | 2.5 | String value 2 | #FF0000") << testThingId << ruleMap << 60 << 2.5 << "String value 2" << "#ff0000" << false << false;
|
||||
QTest::newRow("Unchanged | 60 | 20.5 | String value 2 | #FF0000") << testThingId << ruleMap << 60 << 20.5 << "String value 2" << "#ff0000" << false << false;
|
||||
QTest::newRow("Active | 60 | 20.5 | String value 2 | #00FF00") << testThingId << ruleMap << 60 << 20.5 << "String value 2" << "#00ff00" << true << true;
|
||||
QTest::newRow("Active | 60 | 20.5 | String value 2 | #00FF00") << testThingId << ruleMap << 60 << 20.5 << "String value 2" << "#00ff00" << true << true;
|
||||
}
|
||||
|
||||
void TestRules::testChildEvaluator()
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ protected:
|
|||
// just for debugging
|
||||
inline void printJson(const QVariant &response) {
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromVariant(response);
|
||||
qDebug() << jsonDoc.toJson();
|
||||
qCDebug(dcTests()) << jsonDoc.toJson();
|
||||
}
|
||||
|
||||
void waitForDBSync();
|
||||
|
|
|
|||
Loading…
Reference in New Issue