diff --git a/tools/chatgui/tests/test_stream_publish.cpp b/tools/chatgui/tests/test_stream_publish.cpp index fc2bc7917..7e028cd02 100644 --- a/tools/chatgui/tests/test_stream_publish.cpp +++ b/tools/chatgui/tests/test_stream_publish.cpp @@ -315,7 +315,7 @@ private slots: QSize selectedSize; { StreamPublishEngine engine; - if (StreamPublishEngine::supported()) QTRY_VERIFY_WITH_TIMEOUT(!engine.sources().isEmpty(), 5000); + if (StreamPublishEngine::supported()) QTRY_VERIFY_WITH_TIMEOUT(!engine.sources().isEmpty(), 5000); StreamPublishWindow controls(&engine, group); connect(&controls, &StreamPublishWindow::settingsChanged, this, [&saved](const QString& value) { saved = value; }); auto* codec = menu(controls, "streamVideoCodec"); @@ -489,13 +489,13 @@ private slots: config.source.kind = StreamVideoSource::Camera; config.source.id = "utun-missing-camera"; config.video.codec = 1; config.video.width = 640; config.video.height = 480; QSignalSpy errors(&engine, &StreamPublishEngine::errorOccurred); - QVERIFY(!engine.start(group, config)); - QCOMPARE(errors.size(), 1); + QVERIFY(engine.start(group, config)); // Запуск принят; отсутствие камеры сообщает изолированный worker. + QTRY_COMPARE_WITH_TIMEOUT(errors.size(), 1, 3000); const QString message = errors.front().front().toString(); const QString expected = QCoreApplication::translate("ChatGui", "Camera connection error: %1"); if (language == "ru") QCOMPARE(expected, QStringLiteral("Ошибка подключения к камере: %1")); QVERIFY(message.startsWith(expected.left(expected.indexOf("%1")))); - QVERIFY(message.contains(QCoreApplication::translate("ChatGui", "Could not open the selected capture device"))); + QVERIFY(message.contains(QStringLiteral("Camera is unavailable"))); QTRY_VERIFY_WITH_TIMEOUT(!engine.active(), 3000); DEBUG_INFO(DEBUG_CATEGORY_STREAM, "missing camera has readable context: %s", qUtf8Printable(message)); #else @@ -504,7 +504,8 @@ private slots: } void screenSelectionAndRefresh() { StreamPublishEngine engine; - if (StreamPublishEngine::supported()) QTRY_VERIFY_WITH_TIMEOUT(!engine.sources().isEmpty(), 5000); StreamPublishWindow controls(&engine, group); + if (StreamPublishEngine::supported()) QTRY_VERIFY_WITH_TIMEOUT(!engine.sources().isEmpty(), 5000); + StreamPublishWindow controls(&engine, group); auto* sourceBox = menu(controls, "streamVideoSource"); auto* resolution = menu(controls, "streamVideoResolution"); auto sources = engine.sources(); @@ -525,7 +526,8 @@ private slots: } void compactControlMenus() { StreamPublishEngine engine; - if (StreamPublishEngine::supported()) QTRY_VERIFY_WITH_TIMEOUT(!engine.sources().isEmpty(), 5000); StreamPublishWindow controls(&engine, group); controls.show(); + if (StreamPublishEngine::supported()) QTRY_VERIFY_WITH_TIMEOUT(!engine.sources().isEmpty(), 5000); + StreamPublishWindow controls(&engine, group); controls.show(); controls.resize(controls.minimumSize()); QTest::qWait(20); auto* bar = controls.findChild("streamControls"); QVERIFY(bar); auto* start = controls.findChild("streamStart"); QVERIFY(start); @@ -706,7 +708,7 @@ private slots: QVERIFY(otherOverlay.draw(otherFrame)); QCOMPARE(otherFrame, blank); } StreamPublishEngine engine; - if (StreamPublishEngine::supported()) QTRY_VERIFY_WITH_TIMEOUT(!engine.sources().isEmpty(), 5000); QTRY_VERIFY_WITH_TIMEOUT(!engine.codecs().isEmpty(), 15000); + if (StreamPublishEngine::supported()) QTRY_VERIFY_WITH_TIMEOUT(!engine.sources().isEmpty(), 5000); QTRY_VERIFY_WITH_TIMEOUT(!engine.codecs().isEmpty(), 15000); StreamPublishConfig config; config.audio = false; for (const auto& source : engine.sources()) if (source.kind == StreamVideoSource::Screen && testScreen(source) == screen) config.source = source; QVERIFY(testScreen(config.source)); QVERIFY(config.showCursor); @@ -777,7 +779,7 @@ private slots: QImage blank = frame; QVERIFY(otherOverlay.draw(frame)); QCOMPARE(frame, blank); } StreamPublishEngine engine; - if (StreamPublishEngine::supported()) QTRY_VERIFY_WITH_TIMEOUT(!engine.sources().isEmpty(), 5000); + if (StreamPublishEngine::supported()) QTRY_VERIFY_WITH_TIMEOUT(!engine.sources().isEmpty(), 5000); for (const auto& source : engine.sources()) { if (source.kind != StreamVideoSource::Screen || testScreen(source) != screen) continue; QVERIFY(StreamPublishEngine::cursorSupported(source)); @@ -1102,7 +1104,8 @@ private slots: failHardware = true; softwareOpens = 0; audioEncodes = 0; auto reset = qScopeGuard([] { failHardware = false; }); StreamPublishEngine engine; - if (StreamPublishEngine::supported()) QTRY_VERIFY_WITH_TIMEOUT(!engine.sources().isEmpty(), 5000); StreamPublishWindow controls(&engine, group); controls.show(); + if (StreamPublishEngine::supported()) QTRY_VERIFY_WITH_TIMEOUT(!engine.sources().isEmpty(), 5000); + StreamPublishWindow controls(&engine, group); controls.show(); QSignalSpy errors(&engine, &StreamPublishEngine::errorOccurred); QSignalSpy requests(&engine, &StreamPublishEngine::softwareEncodingRequested); StreamPublishConfig config; config.audio = false; config.video.width = 320; config.video.height = 180; config.video.fps = 15; @@ -1159,7 +1162,8 @@ private slots: failHardware = suppressMicrophone = silentMicrophone = slowCaptureClose = false; sound->shutdown(); }); StreamPublishEngine engine; - if (StreamPublishEngine::supported()) QTRY_VERIFY_WITH_TIMEOUT(!engine.sources().isEmpty(), 5000); StreamPublishWindow controls(&engine, group); + if (StreamPublishEngine::supported()) QTRY_VERIFY_WITH_TIMEOUT(!engine.sources().isEmpty(), 5000); + StreamPublishWindow controls(&engine, group); QSignalSpy errors(&engine, &StreamPublishEngine::errorOccurred); QSignalSpy requests(&engine, &StreamPublishEngine::softwareEncodingRequested); StreamPublishConfig config; config.video.width = 320; config.video.height = 180; config.video.fps = 15;