diff options
author | MÃ¥rten Nordheim <marten.nordheim@qt.io> | 2021-02-05 13:16:02 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-02-07 11:10:31 +0000 |
commit | fcb9a94f83900ffd3809414fe6dcbcb3cdfb208e (patch) | |
tree | e98180b55a504c0fced42cef588c802a48ec5e49 /tests/manual | |
parent | 584541c7e4ad33b53cdaed538b878772115f2107 (diff) |
Switch QNetworkInformation manual test back to using qDebug
It turns out QTextStream on Android isn't as easily visible as it is
when going through qDebug (where it can easily be seen with
`adb logcat -v brief libqnetworkinformation_<arch>.so:* -s`)
Change-Id: I3b495d7a3d331fda6cfe602c461107dd1d0b3faf
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 677797929d8080199990d741773832f80a654265)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual/qnetworkinformation/tst_qnetworkinformation.cpp | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/tests/manual/qnetworkinformation/tst_qnetworkinformation.cpp b/tests/manual/qnetworkinformation/tst_qnetworkinformation.cpp index 6ef337fda9..ab6b5335f9 100644 --- a/tests/manual/qnetworkinformation/tst_qnetworkinformation.cpp +++ b/tests/manual/qnetworkinformation/tst_qnetworkinformation.cpp @@ -27,37 +27,28 @@ ****************************************************************************/ #include <QtCore/qcoreapplication.h> -#include <QtCore/qmetaobject.h> +#include <QtCore/qdebug.h> #include <QtNetwork/qnetworkinformation.h> -QByteArray nameOfEnumValue(QNetworkInformation::Reachability reachability) -{ - return QMetaEnum::fromType<QNetworkInformation::Reachability>().valueToKey(int(reachability)); -} - int main(int argc, char **argv) { QCoreApplication app(argc, argv); - QTextStream writer(stdout); - if (!QNetworkInformation::load(QNetworkInformation::Feature::Reachability)) { qWarning("Failed to load any backend"); - writer << "Backends available: " << QNetworkInformation::availableBackends().join(", ") << '\n'; + qDebug() << "Backends available:" << QNetworkInformation::availableBackends().join(", "); return -1; } QNetworkInformation *info = QNetworkInformation::instance(); - writer << "Backend loaded: " << info->backendName() << '\n'; - writer << "Now you can make changes to the current network connection. Qt should see the " - "changes and notify about it.\n"; + qDebug() << "Backend loaded:" << info->backendName(); + qDebug() << "Now you can make changes to the current network connection. Qt should see the " + "changes and notify about it."; QObject::connect(info, &QNetworkInformation::reachabilityChanged, - [&writer](QNetworkInformation::Reachability newStatus) { - writer << "Updated: " << nameOfEnumValue(newStatus) << '\n'; - writer.flush(); + [](QNetworkInformation::Reachability newStatus) { + qDebug() << "Updated:" << newStatus; }); - writer << "Initial: " << nameOfEnumValue(info->reachability()) << '\n'; - writer.flush(); + qDebug() << "Initial:" << info->reachability(); return app.exec(); } |