Skip to content

Commit

Permalink
Replace QSKIPs with QEXPECT_FAIL
Browse files Browse the repository at this point in the history
Where appropriate.
  • Loading branch information
pcolby committed Jan 9, 2025
1 parent 8369b35 commit 4be8cd6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
11 changes: 3 additions & 8 deletions test/unit/cli/testabstractcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,17 +357,12 @@ void TestAbstractCommand::processOptions_timeout()
MockCommand mock;
const int defaultTimeout = mock.discoveryAgent->lowEnergyDiscoveryTimeout(); // eg 20s on Linux.
if (defaultTimeout == -1) {
QSKIP("This platform does not support timeout for BLE device searches.");
// See https://doc.qt.io/qt-5/qbluetoothdevicediscoveryagent.html#lowEnergyDiscoveryTimeout
QTest::ignoreMessage(QtWarningMsg, "Platform does not support Bluetooth scan timeout");
}
const QStringList errors = mock.processOptions(parser);
QCOMPARE(!errors.isEmpty(), expectErrors);
if (expectErrors) {
QCOMPARE(mock.discoveryAgent->lowEnergyDiscoveryTimeout(), defaultTimeout);
} else {
/// \todo Replace the above QSKIP with a QEXPECT_FAIL here.
QCOMPARE(mock.discoveryAgent->lowEnergyDiscoveryTimeout(), expected);
}
QCOMPARE(mock.discoveryAgent->lowEnergyDiscoveryTimeout(),
((expectErrors || defaultTimeout == -1)) ? defaultTimeout : expected);
}

void TestAbstractCommand::tr()
Expand Down
19 changes: 9 additions & 10 deletions test/unit/cli/testinfocommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,24 @@ void TestInfoCommand::serviceDetailsDiscovered()
QFETCH(AbstractCommand::OutputFormat, format);
LOADTESTDATA(expected);

const OutputStreamCapture capture(&std::cout);
InfoCommand command(this);
command.device = new PokitDevice(info, &command);
command.service = command.device->deviceInformation();
command.format = format;
command.serviceDetailsDiscovered();
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
if (!info.deviceUuid().isNull()) {
// Fixed (though not called out) by https://bugreports.qt.io/browse/QTBUG-75348
QSKIP("QLowEnergyController fails to track device UUIDs prior to Qt 5.14.");
QEXPECT_FAIL("", "QLowEnergyController fails to track device UUIDs prior to Qt 5.14.", Continue);
}
#if defined(Q_OS_MACOS)
if (!info.address().isNull()) {
QSKIP("On macOS, QLowEnergyController fails to track device addresses prior to Qt 5.14.");
else if (!info.address().isNull()) {
QEXPECT_FAIL("", "On macOS, QLowEnergyController fails to track device addresses prior to Qt 5.14.", Continue);
}
#endif // macOS
#endif // < Qt 5.14

const OutputStreamCapture capture(&std::cout);
InfoCommand command(this);
command.device = new PokitDevice(info, &command);
command.service = command.device->deviceInformation();
command.format = format;
command.serviceDetailsDiscovered();
/// \todo Consider replacing the above QSKIP/s with QEXPECT_FAIL/s here.
QCOMPARE(QByteArray::fromStdString(capture.data()), expected);
}

Expand Down

0 comments on commit 4be8cd6

Please sign in to comment.