summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/kernel/qnetworkinformation/tst_qnetworkinformation.cpp
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2021-06-03 13:27:56 +0200
committerMårten Nordheim <marten.nordheim@qt.io>2021-06-08 14:54:16 +0200
commit14b74af0608dc833f836acac4ee93f905b449806 (patch)
tree84db5450f302d0de9ba140c8a9d223324e4fe988 /tests/auto/network/kernel/qnetworkinformation/tst_qnetworkinformation.cpp
parentc34b596119b1fd05082b69b77eb86a99f658a22b (diff)
QNetworkInformation: Adjustments to captive portal API
Make it return bool since the TriState was really only used signify that the property was unsupported but there is already a separate way to check if it's supported. More importantly there is no different set of actions available to a user if they're in the Unknown or False state. Because of the change to bool, we also rename the property to have an 'is'-prefix. Change-Id: Iaaaad5ac31e663c36e00223bf5b0e719f412fc69 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'tests/auto/network/kernel/qnetworkinformation/tst_qnetworkinformation.cpp')
-rw-r--r--tests/auto/network/kernel/qnetworkinformation/tst_qnetworkinformation.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/auto/network/kernel/qnetworkinformation/tst_qnetworkinformation.cpp b/tests/auto/network/kernel/qnetworkinformation/tst_qnetworkinformation.cpp
index 188355d373..92dba1e7c1 100644
--- a/tests/auto/network/kernel/qnetworkinformation/tst_qnetworkinformation.cpp
+++ b/tests/auto/network/kernel/qnetworkinformation/tst_qnetworkinformation.cpp
@@ -57,7 +57,7 @@ public:
Q_ASSERT(!instance);
instance = this;
setReachability(QNetworkInformation::Reachability::Online);
- setNewBehindCaptivePortal(QNetworkInformation::TriState::False);
+ setNewBehindCaptivePortal(false);
}
~MockBackend() { instance = nullptr; }
@@ -74,7 +74,7 @@ public:
instance->setReachability(value);
}
- static void setNewBehindCaptivePortal(QNetworkInformation::TriState value)
+ static void setNewBehindCaptivePortal(bool value)
{
Q_ASSERT(instance);
instance->setBehindCaptivePortal(value);
@@ -164,25 +164,25 @@ void tst_QNetworkInformation::reachability()
void tst_QNetworkInformation::behindCaptivePortal()
{
auto info = QNetworkInformation::instance();
- QNetworkInformation::TriState behindPortal = QNetworkInformation::TriState::Unknown;
+ bool behindPortal = false;
bool signalEmitted = false;
- connect(info, &QNetworkInformation::behindCaptivePortalChanged, this,
- [&, info](QNetworkInformation::TriState state) {
+ connect(info, &QNetworkInformation::isBehindCaptivePortalChanged, this,
+ [&, info](bool state) {
signalEmitted = true;
- QCOMPARE(state, info->behindCaptivePortal());
- behindPortal = info->behindCaptivePortal();
+ QCOMPARE(state, info->isBehindCaptivePortal());
+ behindPortal = info->isBehindCaptivePortal();
});
- QCOMPARE(info->behindCaptivePortal(), QNetworkInformation::TriState::False);
- MockBackend::setNewBehindCaptivePortal(QNetworkInformation::TriState::True);
+ QVERIFY(!info->isBehindCaptivePortal());
+ MockBackend::setNewBehindCaptivePortal(true);
QCoreApplication::processEvents();
QVERIFY(signalEmitted);
- QCOMPARE(info->behindCaptivePortal(), QNetworkInformation::TriState::True);
- QCOMPARE(behindPortal, QNetworkInformation::TriState::True);
+ QVERIFY(info->isBehindCaptivePortal());
+ QVERIFY(behindPortal);
// Set the same value again, signal should not be emitted again
signalEmitted = false;
- MockBackend::setNewBehindCaptivePortal(QNetworkInformation::TriState::True);
+ MockBackend::setNewBehindCaptivePortal(true);
QCoreApplication::processEvents();
QVERIFY(!signalEmitted);
}