Verify the bottom player bar and logarithmic volume output

This commit is contained in:
evgeny committed 2026-11-01 22:23:49 +01:00
1 parent 5a8807bf89
commit b414fc9538
2 files changed
+35 -3

No files matched your search

+2 -1
View File
@@ -201,7 +201,8 @@ StreamPlayerWindow::StreamPlayerWindow(uint64_t group, uint64_t source, uint64_t
volumeLayout->setContentsMargins(0, 0, 0, 0); volumeLayout->setSpacing(0);
auto* volume = new StreamVolumeSlider(volumeBox); volume->setObjectName(QStringLiteral("streamVolume"));
volume->setAccessibleName(text("Stream volume")); volume->setToolTip(QStringLiteral("0 dB")); volumeLayout->addWidget(volume);
auto* volumeLabel = new QLabel(text("Volume"), volumeBox); volumeLabel->setAlignment(Qt::AlignCenter);
auto* volumeLabel = new QLabel(text("Volume"), volumeBox); volumeLabel->setObjectName(QStringLiteral("streamVolumeLabel"));
volumeLabel->setAlignment(Qt::AlignCenter);
volumeLayout->addWidget(volumeLabel); controls->addWidget(volumeBox);
m_fullscreen = new QPushButton(text("Fullscreen"), bar); m_fullscreen->setObjectName(QStringLiteral("streamFullscreen"));
controls->addWidget(m_fullscreen);
+33 -2
View File
@@ -11,6 +11,7 @@
#include <QPointer>
#include <QLabel>
#include <QSlider>
#include <QPushButton>
#include <QPainter>
#include <QWheelEvent>
#include <QWindow>
@@ -545,6 +546,12 @@ private slots:
QTRY_VERIFY(stream_get_info(publisher, &info) == STREAM_OK && info.owners == 2);
QTest::mouseClick(video, Qt::LeftButton);
QTRY_COMPARE(grid.focusedSource(), inst->node_id); QVERIFY(grid.isFullScreen()); QVERIFY(ownTile->isHidden());
auto* fullscreen = remote->findChild<QPushButton*>(QStringLiteral("streamFullscreen"));
auto* close = remote->findChild<QPushButton*>(QStringLiteral("streamClose"));
QVERIFY(fullscreen && fullscreen->isVisible()); QVERIFY(close && close->isVisible());
QVERIFY(grid.findChild<QWidget*>(QStringLiteral("streamGridControls"))->isHidden());
QTest::mouseClick(fullscreen, Qt::LeftButton); QTRY_VERIFY(!grid.isFullScreen());
QTest::mouseClick(fullscreen, Qt::LeftButton); QTRY_VERIFY(grid.isFullScreen());
auto* volume = remote->findChild<QSlider*>(); QVERIFY(volume); volume->setFocus();
QTest::keyClick(volume, Qt::Key_Escape);
QTRY_COMPARE(grid.focusedSource(), uint64_t(0));
@@ -552,7 +559,8 @@ private slots:
QCOMPARE(grid.findChild<StreamPlayerWindow*>(), remote.data());
QCOMPARE(stream_get_info(publisher, &info), STREAM_OK); QCOMPARE(info.owners, 2u);
QTest::mouseClick(video, Qt::LeftButton); QTRY_COMPARE(grid.focusedSource(), inst->node_id);
QTest::mouseClick(video, Qt::LeftButton); QTRY_COMPARE(grid.focusedSource(), uint64_t(0));
QTest::mouseClick(close, Qt::LeftButton); QTRY_COMPARE(grid.focusedSource(), uint64_t(0));
QCOMPARE(grid.findChild<StreamPlayerWindow*>(), remote.data());
video->setFrame(coordinateFrame()); zoomVideo(*video, 12000, video->rect().center());
dragVideo(*video, video->rect().center(), video->rect().center() + QPoint(40, 20));
QTest::qWait(20); QCOMPARE(grid.focusedSource(), uint64_t(0)); // Pan не считается кликом.
@@ -793,6 +801,21 @@ private slots:
QVERIFY(telemetry); QVERIFY(telemetry->text().contains(QStringLiteral("<table")));
QVERIFY(telemetry->text().contains(QStringLiteral("S</td>")) || telemetry->text().contains(QStringLiteral("S</")));
QVERIFY(!telemetry->toolTip().isEmpty());
auto* bar = window.findChild<QWidget*>(QStringLiteral("streamPlayerControls")); QVERIFY(bar);
auto* videoSurface = window.findChild<VideoRenderWidget*>(); QVERIFY(videoSurface);
QVERIFY(bar->geometry().top() > videoSurface->geometry().bottom());
auto* caption = window.findChild<QLabel*>(QStringLiteral("streamSourceName")); QVERIFY(caption);
auto* status = window.findChild<QLabel*>(QStringLiteral("streamPlaybackStatus")); QVERIFY(status);
QVERIFY(caption->mapTo(&window, QPoint()).y() >= bar->geometry().top());
QVERIFY(status->mapTo(&window, QPoint()).y() > caption->mapTo(&window, caption->rect().bottomLeft()).y());
auto* scale = window.findChild<QSlider*>(QStringLiteral("streamVolume")); QVERIFY(scale);
auto* volumeLabel = window.findChild<QLabel*>(QStringLiteral("streamVolumeLabel")); QVERIFY(volumeLabel);
QVERIFY(volumeLabel->mapTo(&window, QPoint()).y() > scale->mapTo(&window, scale->rect().bottomLeft()).y());
QTest::mouseClick(scale, Qt::LeftButton, {}, QPoint(scale->width() / 2, 5)); QCOMPARE(scale->value(), 50);
QCOMPARE(scale->toolTip(), QStringLiteral("-30.0 dB"));
const QString screenshot = qEnvironmentVariable("UTUN_TEST_STREAM_VIEW_SCREENSHOT");
if (!screenshot.isEmpty()) QVERIFY(window.grab().save(screenshot));
scale->setValue(100);
#ifdef TEST_NULL_AUDIO
uint64_t gapsBefore = silenceGaps.load();
#endif
@@ -842,7 +865,15 @@ private slots:
static_cast<double>(leftEnergy.load()) / rightEnergy.load());
QVERIFY2(leftEnergy.load() > rightEnergy.load() * 8 && leftEnergy.load() < rightEnergy.load() * 25,
"Independent stereo channels must reach the playback device without downmix");
auto* volume = window.findChild<QSlider*>(); QVERIFY(volume); volume->setValue(0);
auto* volume = window.findChild<QSlider*>(); QVERIFY(volume);
leftEnergy = 0; QTest::qWait(200); const auto fullVolumeEnergy = leftEnergy.load();
volume->setValue(50); QTest::qWait(50); leftEnergy = 0; QTest::qWait(200);
const auto halfScaleEnergy = leftEnergy.load();
QVERIFY(fullVolumeEnergy > 0 && halfScaleEnergy > 0);
QVERIFY(halfScaleEnergy * 300 < fullVolumeEnergy && halfScaleEnergy * 3000 > fullVolumeEnergy);
DEBUG_INFO(DEBUG_CATEGORY_STREAM, "fixture logarithmic volume full_energy=%llu half_scale_energy=%llu gain_db=-30",
(unsigned long long)fullVolumeEnergy, (unsigned long long)halfScaleEnergy);
volume->setValue(0);
QTest::qWait(50); uint64_t played = nonzeroSamples.load(); QTest::qWait(100); QCOMPARE(nonzeroSamples.load(), played);
#endif
sender.stop(); window.close(); QTest::qWait(20);