diff --git a/src/AppSettings/pages/Video.SettingsUI.json b/src/AppSettings/pages/Video.SettingsUI.json index 5a44c56b549..0c18474fb78 100644 --- a/src/AppSettings/pages/Video.SettingsUI.json +++ b/src/AppSettings/pages/Video.SettingsUI.json @@ -51,19 +51,19 @@ }, { "setting": "videoSettings.disableWhenDisarmed", - "showWhen": "!autoStreamConfig && isStreamSource" + "showWhen": "isStreamSource" }, { "setting": "videoSettings.lowLatencyMode", - "showWhen": "!autoStreamConfig && isStreamSource && QGroundControl.settingsManager.videoSettings.lowLatencyMode.userVisible" + "showWhen": "isStreamSource" }, { "setting": "videoSettings.rtpJitterLatencyMs", - "showWhen": "!autoStreamConfig && isStreamSource && rtpLatencyVisible && QGroundControl.settingsManager.videoSettings.rtpJitterLatencyMs.userVisible" + "showWhen": "isStreamSource && rtpLatencyVisible" }, { "setting": "videoSettings.rtspAutoReconnect", - "showWhen": "!autoStreamConfig && isStreamSource" + "showWhen": "isStreamSource" }, { "setting": "videoSettings.forceCpuVideoPath", diff --git a/test/QmlUITests/TopLevelViewsTest.cc b/test/QmlUITests/TopLevelViewsTest.cc index f6c130cd1bd..51c67dafd10 100644 --- a/test/QmlUITests/TopLevelViewsTest.cc +++ b/test/QmlUITests/TopLevelViewsTest.cc @@ -289,3 +289,48 @@ void TopLevelViewsTest::_testSettingsSearchExcludesHiddenSections() searchField->setProperty("text", QString()); QTRY_VERIFY(findVisibleItem(_rootItem, QStringLiteral("settingsButton_Video"), 0)); } + +void TopLevelViewsTest::_testDiscoveredCameraReceiverSettingsVisible() +{ +#ifndef QGC_GST_STREAMING + QSKIP("GStreamer receiver settings are unavailable in this build"); +#else + const auto restoreVideoSource = setVideoSourceWithRestore(VideoSettings::videoSourceRTSP); + + Fact* const lowLatencyMode = SettingsManager::instance()->videoSettings()->lowLatencyMode(); + const QVariant savedLowLatencyMode = lowLatencyMode->rawValue(); + const auto restoreLowLatencyMode = + qScopeGuard([lowLatencyMode, savedLowLatencyMode] { lowLatencyMode->setRawValue(savedLowLatencyMode); }); + lowLatencyMode->setRawValue(false); + + startUI(); + if (QTest::currentTestFailed()) + return; + + QVERIFY(clickToolSelectDropdownButton(QStringLiteral("toolbar_viewSettings"))); + if (!_clickSettingsButton(QStringLiteral("Video"))) { + return; + } + + QQuickItem* const videoPage = findVisibleItem(_rootItem, QStringLiteral("settingsPage_Video")); + QVERIFY(videoPage); + QVERIFY(videoPage->property("isStreamSource").toBool()); + + // autoStreamConfig mirrors the read-only VideoManager property. Override the + // page binding to isolate these UI visibility rules from camera transport. + QVERIFY(videoPage->setProperty("autoStreamConfig", true)); + + QQuickItem* const sourceGroup = findVisibleItem(_rootItem, QStringLiteral("settingsGroup_VideoSource")); + QVERIFY(sourceGroup); + QTRY_VERIFY(!sourceGroup->isEnabled()); + QTRY_VERIFY(!findVisibleItem(_rootItem, QStringLiteral("settingsGroup_Connection"), 0)); + QTRY_VERIFY(!findVisibleItem(_rootItem, QStringLiteral("settingsTextField_aspectRatio"), 0)); + + QTRY_VERIFY(findVisibleItem(_rootItem, QStringLiteral("settingsCheckBox_disableWhenDisarmed"), 0)); + QTRY_VERIFY(findVisibleItem(_rootItem, QStringLiteral("settingsCheckBox_lowLatencyMode"), 0)); + QTRY_VERIFY(findVisibleItem(_rootItem, QStringLiteral("settingsTextField_rtpJitterLatencyMs"), 0)); + QTRY_VERIFY(findVisibleItem(_rootItem, QStringLiteral("settingsCheckBox_rtspAutoReconnect"), 0)); + + stopUI(); +#endif +} diff --git a/test/QmlUITests/TopLevelViewsTest.h b/test/QmlUITests/TopLevelViewsTest.h index 25f56a4c1bb..9015e7063a6 100644 --- a/test/QmlUITests/TopLevelViewsTest.h +++ b/test/QmlUITests/TopLevelViewsTest.h @@ -21,6 +21,7 @@ private slots: void _testSettingsSectionCollapseToSingle(); void _testSettingsPageUnavailableFallback(); void _testSettingsSearchExcludesHiddenSections(); + void _testDiscoveredCameraReceiverSettingsVisible(); private: QQuickItem* _clickSettingsButton(const QString& pageName);