Keep action rows when their key cannot be read
e3917e6 hid any row whose key failed its seeding read, which also hid
"Link remote controller": an action key has no value to read. Unreadable is
now tracked apart from supported, and only rows that show a value hide on it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
128220dcb7
commit
415c6184b1
3 files changed
+33
-8
No files matched your search
@@ -151,12 +151,24 @@ void main() {
|
||||
final TelemetryReducer r = TelemetryReducer(m);
|
||||
m.keys.setSupported(SettingsKeys.gimbalDialSpeed, true);
|
||||
r.apply(<String, dynamic>{'type': 'key', 'id': SettingsKeys.gimbalDialSpeed.id, 'unreadable': true});
|
||||
expect(m.keys.supported(SettingsKeys.gimbalDialSpeed), isFalse);
|
||||
expect(m.keys.unreadable(SettingsKeys.gimbalDialSpeed), isTrue);
|
||||
final SettingsContext c = SettingsContext(profile: m.profile, keys: m.keys, aircraft: m.aircraft);
|
||||
final SettingSpec dial = spec<SettingSpec>(SettingsTabs.rc, 'gimbalDialSpeed');
|
||||
expect(dial.visible(c), isFalse);
|
||||
r.apply(<String, dynamic>{'type': 'key', 'id': SettingsKeys.gimbalDialSpeed.id, 'value': 40});
|
||||
expect(m.keys.supported(SettingsKeys.gimbalDialSpeed), isNot(isFalse));
|
||||
expect(dial.visible(c), isTrue);
|
||||
expect(m.keys.value(SettingsKeys.gimbalDialSpeed), 40);
|
||||
});
|
||||
|
||||
test('an action row stays when its key cannot be read (it never reads it)', () {
|
||||
final FlightModel m = connectedModel(phantom4);
|
||||
m.keys.setSupported(SettingsKeys.startPairing, true);
|
||||
TelemetryReducer(m).apply(<String, dynamic>{'type': 'key', 'id': SettingsKeys.startPairing.id, 'unreadable': true});
|
||||
final SettingsContext c = SettingsContext(profile: m.profile, keys: m.keys, aircraft: m.aircraft);
|
||||
final SettingSpec link = spec<SettingSpec>(SettingsTabs.rc, 'startPairing');
|
||||
expect(link.visible(c), isTrue);
|
||||
});
|
||||
|
||||
test('subscriptions listen only to supported keys and cancel on dispose', () async {
|
||||
final FakeDjiService dji = FakeDjiService()..unsupportedKeys.add('ESC_BEEPING_ENABLED');
|
||||
final KeyState s = KeyState();
|
||||
|
||||
Reference in new issue
Block a user