Skip to content

Commit 4be785b

Browse files
committed
Merge bitcoin-core#839: qt6, test: Handle deprecated code
5625840 qt6, test: Handle deprecated `QVERIFY_EXCEPTION_THROWN` (Hennadii Stepanov) cb750b4 qt6, test: Use `qWarning()` instead of `QWARN()` macro (Hennadii Stepanov) Pull request description: Split from bitcoin/bitcoin#30997. This PR ensures compatibility across all supported Qt versions. --- This PR can be tested on macOS using the first commit from bitcoin/bitcoin#30997 and Homebrew's `qt` package. ACKs for top commit: promag: Code review ACK 5625840. Sjors: tACK 5625840 Tree-SHA512: e7307eaf0027c6addc9481ba91ed31b81554ffb0d2ba77938e68915c9d490a7962e55a330f97ea31d49bbfb30f92773c3af3afc867a4215d00752405d7e3bb6d
2 parents f117f3f + 5625840 commit 4be785b

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

src/qt/test/addressbooktests.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ void AddressBookTests::addressBookTests()
222222
// framework when it tries to look up unimplemented cocoa functions,
223223
// and fails to handle returned nulls
224224
// (https://bugreports.qt.io/browse/QTBUG-49686).
225-
QWARN("Skipping AddressBookTests on mac build with 'minimal' platform set due to Qt bugs. To run AppTests, invoke "
226-
"with 'QT_QPA_PLATFORM=cocoa test_bitcoin-qt' on mac, or else use a linux or windows build.");
225+
qWarning() << "Skipping AddressBookTests on mac build with 'minimal' platform set due to Qt bugs. To run AppTests, invoke "
226+
"with 'QT_QPA_PLATFORM=cocoa test_bitcoin-qt' on mac, or else use a linux or windows build.";
227227
return;
228228
}
229229
#endif

src/qt/test/apptests.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ void AppTests::appTests()
6060
// framework when it tries to look up unimplemented cocoa functions,
6161
// and fails to handle returned nulls
6262
// (https://bugreports.qt.io/browse/QTBUG-49686).
63-
QWARN("Skipping AppTests on mac build with 'minimal' platform set due to Qt bugs. To run AppTests, invoke "
64-
"with 'QT_QPA_PLATFORM=cocoa test_bitcoin-qt' on mac, or else use a linux or windows build.");
63+
qWarning() << "Skipping AppTests on mac build with 'minimal' platform set due to Qt bugs. To run AppTests, invoke "
64+
"with 'QT_QPA_PLATFORM=cocoa test_bitcoin-qt' on mac, or else use a linux or windows build.";
6565
return;
6666
}
6767
#endif

src/qt/test/rpcnestedtests.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ void RPCNestedTests::rpcNestedTests()
127127
RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest( abc , cba )");
128128
QVERIFY(result == "[\"abc\",\"cba\"]");
129129

130+
// Handle deprecated macro, can be removed once minimum Qt is at least 6.3.0.
131+
#if (QT_VERSION >= QT_VERSION_CHECK(6, 3, 0))
132+
#undef QVERIFY_EXCEPTION_THROWN
133+
#define QVERIFY_EXCEPTION_THROWN(expression, exceptiontype) QVERIFY_THROWS_EXCEPTION(exceptiontype, expression)
134+
#endif
130135
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo() .\n"), std::runtime_error); //invalid syntax
131136
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo() getblockchaininfo()"), std::runtime_error); //invalid syntax
132137
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo("); //tolerate non closing brackets if we have no arguments

src/qt/test/test_main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ int main(int argc, char* argv[])
5858
gArgs.ForceSetArg("-natpmp", "0");
5959

6060
std::string error;
61-
if (!gArgs.ReadConfigFiles(error, true)) QWARN(error.c_str());
61+
if (!gArgs.ReadConfigFiles(error, true)) qWarning() << error.c_str();
6262

6363
// Prefer the "minimal" platform for the test instead of the normal default
6464
// platform ("xcb", "windows", or "cocoa") so tests can't unintentionally

src/qt/test/wallettests.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,8 @@ void WalletTests::walletTests()
475475
// framework when it tries to look up unimplemented cocoa functions,
476476
// and fails to handle returned nulls
477477
// (https://bugreports.qt.io/browse/QTBUG-49686).
478-
QWARN("Skipping WalletTests on mac build with 'minimal' platform set due to Qt bugs. To run AppTests, invoke "
479-
"with 'QT_QPA_PLATFORM=cocoa test_bitcoin-qt' on mac, or else use a linux or windows build.");
478+
qWarning() << "Skipping WalletTests on mac build with 'minimal' platform set due to Qt bugs. To run AppTests, invoke "
479+
"with 'QT_QPA_PLATFORM=cocoa test_bitcoin-qt' on mac, or else use a linux or windows build.";
480480
return;
481481
}
482482
#endif

0 commit comments

Comments
 (0)