QNI: Update the manual test 'transportMedium' naming

I staged the manual test a little too soon, forgetting it's not compiled
in CI

Change-Id: Iaae8b8caaf8433c45e66ff662bb9bb7b25a3b8bd
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Mårten Nordheim 2021-10-05 07:45:46 +02:00
parent 1834fcad33
commit e4a09b0194
2 changed files with 13 additions and 13 deletions

View File

@ -46,7 +46,7 @@ class MainWindow : public QMainWindow
Q_OBJECT Q_OBJECT
using Reachability = QNetworkInformation::Reachability; using Reachability = QNetworkInformation::Reachability;
using TransportMedia = QNetworkInformation::TransportMedia; using TransportMedium = QNetworkInformation::TransportMedium;
public: public:
MainWindow() : QMainWindow(nullptr) MainWindow() : QMainWindow(nullptr)
@ -68,9 +68,9 @@ public slots:
updateText(); updateText();
} }
void updateTransportMedia(TransportMedia newValue) void updateTransportMedium(TransportMedium newValue)
{ {
transportMedia = newValue; transportMedium = newValue;
updateText(); updateText();
} }
@ -78,15 +78,15 @@ private:
void updateText() void updateText()
{ {
QString str = QString str =
QLatin1String("Reachability: %1\nBehind captive portal: %2\nTransport media: %3") QLatin1String("Reachability: %1\nBehind captive portal: %2\nTransport medium: %3")
.arg(enumToString(reachability), QStringView(captive ? u"true" : u"false"), .arg(enumToString(reachability), QStringView(captive ? u"true" : u"false"),
enumToString(transportMedia)); enumToString(transportMedium));
label->setText(str); label->setText(str);
} }
QLabel *const label = new QLabel(this); QLabel *const label = new QLabel(this);
Reachability reachability = Reachability::Unknown; Reachability reachability = Reachability::Unknown;
TransportMedia transportMedia = TransportMedia::Unknown; TransportMedium transportMedium = TransportMedium::Unknown;
bool captive = false; bool captive = false;
}; };

View File

@ -48,7 +48,7 @@ int main(int argc, char **argv)
if (!QNetworkInformation::load(QNetworkInformation::Feature::Reachability if (!QNetworkInformation::load(QNetworkInformation::Feature::Reachability
| QNetworkInformation::Feature::CaptivePortal | QNetworkInformation::Feature::CaptivePortal
| QNetworkInformation::Feature::TransportMedia)) { | QNetworkInformation::Feature::TransportMedium)) {
qWarning("Failed to load any backend"); qWarning("Failed to load any backend");
qDebug() << "Backends available:" << QNetworkInformation::availableBackends().join(", "); qDebug() << "Backends available:" << QNetworkInformation::availableBackends().join(", ");
return -1; return -1;
@ -65,9 +65,9 @@ int main(int argc, char **argv)
QObject::connect(info, &QNetworkInformation::isBehindCaptivePortalChanged, QObject::connect(info, &QNetworkInformation::isBehindCaptivePortalChanged,
[&](bool status) { qDebug() << "Updated, behind captive portal:" << status; }); [&](bool status) { qDebug() << "Updated, behind captive portal:" << status; });
QObject::connect(info, &QNetworkInformation::transportMediaChanged, QObject::connect(info, &QNetworkInformation::transportMediumChanged,
[&](QNetworkInformation::TransportMedia newMedia) { [&](QNetworkInformation::TransportMedium newMedium) {
qDebug() << "Updated, current transport media:" << newMedia; qDebug() << "Updated, current transport medium:" << newMedium;
}); });
#ifdef MOBILE #ifdef MOBILE
@ -76,13 +76,13 @@ int main(int argc, char **argv)
&MainWindow::updateReachability); &MainWindow::updateReachability);
QObject::connect(info, &QNetworkInformation::isBehindCaptivePortalChanged, &window, QObject::connect(info, &QNetworkInformation::isBehindCaptivePortalChanged, &window,
&MainWindow::updateCaptiveState); &MainWindow::updateCaptiveState);
QObject::connect(info, &QNetworkInformation::transportMediaChanged, &window, QObject::connect(info, &QNetworkInformation::transportMediumChanged, &window,
&MainWindow::updateTransportMedia); &MainWindow::updateTransportMedium);
#endif #endif
qDebug() << "Initial reachability:" << info->reachability(); qDebug() << "Initial reachability:" << info->reachability();
qDebug() << "Behind captive portal:" << info->isBehindCaptivePortal(); qDebug() << "Behind captive portal:" << info->isBehindCaptivePortal();
qDebug() << "Transport media:" << info->transportMedia(); qDebug() << "Transport medium:" << info->transportMedium();
return app.exec(); return app.exec();
} }