Allow propagation of sensor updates from secondary to main

This commit is contained in:
Carl Philipp Klemm 2026-04-27 00:27:56 +02:00
parent da50a89866
commit 34f129967b
7 changed files with 45 additions and 8 deletions

View file

@ -362,16 +362,16 @@ private slots:
// Add initial sensor
Sensor initialSensor(Sensor::TYPE_TEMPERATURE, 1, 20.0, "Initial Name", false);
store.sensorGotState(initialSensor, SENSOR_UPDATE_BACKEND);
// Send REMOTE update with new name and hidden state
// Send REMOTE update with new name and hidden state (e.g., from secondary instance)
Sensor remoteUpdate(Sensor::TYPE_TEMPERATURE, 1, 25.0, "Remote Name", true);
store.sensorGotState(remoteUpdate, SENSOR_UPDATE_REMOTE);
// Verify name and hidden were NOT updated
// Verify name, hidden and field were updated (remote updates should sync user-configurable fields)
std::vector<Sensor>* sensors = store.getSensors();
QVERIFY(sensors->size() == 1);
QVERIFY(sensors->at(0).name == "Initial Name");
QVERIFY(sensors->at(0).hidden == false);
QVERIFY(sensors->at(0).name == "Remote Name");
QVERIFY(sensors->at(0).hidden == true);
QVERIFY(sensors->at(0).field == 25.0);
}