mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-04 13:55:23 -05:00
Merge bitcoin-core/gui#839: qt6, test: Handle deprecated code
5625840c11
qt6, test: Handle deprecated `QVERIFY_EXCEPTION_THROWN` (Hennadii Stepanov)cb750b4b40
qt6, test: Use `qWarning()` instead of `QWARN()` macro (Hennadii Stepanov) Pull request description: Split from https://github.com/bitcoin/bitcoin/pull/30997. This PR ensures compatibility across all supported Qt versions. --- This PR can be tested on macOS using the first commit from https://github.com/bitcoin/bitcoin/pull/30997 and Homebrew's `qt` package. ACKs for top commit: promag: Code review ACK5625840c11
. Sjors: tACK5625840c11
Tree-SHA512: e7307eaf0027c6addc9481ba91ed31b81554ffb0d2ba77938e68915c9d490a7962e55a330f97ea31d49bbfb30f92773c3af3afc867a4215d00752405d7e3bb6d
This commit is contained in:
commit
4be785b3e3
5 changed files with 12 additions and 7 deletions
|
@ -222,8 +222,8 @@ void AddressBookTests::addressBookTests()
|
||||||
// framework when it tries to look up unimplemented cocoa functions,
|
// framework when it tries to look up unimplemented cocoa functions,
|
||||||
// and fails to handle returned nulls
|
// and fails to handle returned nulls
|
||||||
// (https://bugreports.qt.io/browse/QTBUG-49686).
|
// (https://bugreports.qt.io/browse/QTBUG-49686).
|
||||||
QWARN("Skipping AddressBookTests on mac build with 'minimal' platform set due to Qt bugs. To run AppTests, invoke "
|
qWarning() << "Skipping AddressBookTests on mac build with 'minimal' platform set due to Qt bugs. To run AppTests, invoke "
|
||||||
"with 'QT_QPA_PLATFORM=cocoa test_bitcoin-qt' on mac, or else use a linux or windows build.");
|
"with 'QT_QPA_PLATFORM=cocoa test_bitcoin-qt' on mac, or else use a linux or windows build.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -60,8 +60,8 @@ void AppTests::appTests()
|
||||||
// framework when it tries to look up unimplemented cocoa functions,
|
// framework when it tries to look up unimplemented cocoa functions,
|
||||||
// and fails to handle returned nulls
|
// and fails to handle returned nulls
|
||||||
// (https://bugreports.qt.io/browse/QTBUG-49686).
|
// (https://bugreports.qt.io/browse/QTBUG-49686).
|
||||||
QWARN("Skipping AppTests on mac build with 'minimal' platform set due to Qt bugs. To run AppTests, invoke "
|
qWarning() << "Skipping AppTests on mac build with 'minimal' platform set due to Qt bugs. To run AppTests, invoke "
|
||||||
"with 'QT_QPA_PLATFORM=cocoa test_bitcoin-qt' on mac, or else use a linux or windows build.");
|
"with 'QT_QPA_PLATFORM=cocoa test_bitcoin-qt' on mac, or else use a linux or windows build.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -127,6 +127,11 @@ void RPCNestedTests::rpcNestedTests()
|
||||||
RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest( abc , cba )");
|
RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest( abc , cba )");
|
||||||
QVERIFY(result == "[\"abc\",\"cba\"]");
|
QVERIFY(result == "[\"abc\",\"cba\"]");
|
||||||
|
|
||||||
|
// Handle deprecated macro, can be removed once minimum Qt is at least 6.3.0.
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 3, 0))
|
||||||
|
#undef QVERIFY_EXCEPTION_THROWN
|
||||||
|
#define QVERIFY_EXCEPTION_THROWN(expression, exceptiontype) QVERIFY_THROWS_EXCEPTION(exceptiontype, expression)
|
||||||
|
#endif
|
||||||
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo() .\n"), std::runtime_error); //invalid syntax
|
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo() .\n"), std::runtime_error); //invalid syntax
|
||||||
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo() getblockchaininfo()"), std::runtime_error); //invalid syntax
|
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo() getblockchaininfo()"), std::runtime_error); //invalid syntax
|
||||||
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo("); //tolerate non closing brackets if we have no arguments
|
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo("); //tolerate non closing brackets if we have no arguments
|
||||||
|
|
|
@ -58,7 +58,7 @@ int main(int argc, char* argv[])
|
||||||
gArgs.ForceSetArg("-natpmp", "0");
|
gArgs.ForceSetArg("-natpmp", "0");
|
||||||
|
|
||||||
std::string error;
|
std::string error;
|
||||||
if (!gArgs.ReadConfigFiles(error, true)) QWARN(error.c_str());
|
if (!gArgs.ReadConfigFiles(error, true)) qWarning() << error.c_str();
|
||||||
|
|
||||||
// Prefer the "minimal" platform for the test instead of the normal default
|
// Prefer the "minimal" platform for the test instead of the normal default
|
||||||
// platform ("xcb", "windows", or "cocoa") so tests can't unintentionally
|
// platform ("xcb", "windows", or "cocoa") so tests can't unintentionally
|
||||||
|
|
|
@ -475,8 +475,8 @@ void WalletTests::walletTests()
|
||||||
// framework when it tries to look up unimplemented cocoa functions,
|
// framework when it tries to look up unimplemented cocoa functions,
|
||||||
// and fails to handle returned nulls
|
// and fails to handle returned nulls
|
||||||
// (https://bugreports.qt.io/browse/QTBUG-49686).
|
// (https://bugreports.qt.io/browse/QTBUG-49686).
|
||||||
QWARN("Skipping WalletTests on mac build with 'minimal' platform set due to Qt bugs. To run AppTests, invoke "
|
qWarning() << "Skipping WalletTests on mac build with 'minimal' platform set due to Qt bugs. To run AppTests, invoke "
|
||||||
"with 'QT_QPA_PLATFORM=cocoa test_bitcoin-qt' on mac, or else use a linux or windows build.");
|
"with 'QT_QPA_PLATFORM=cocoa test_bitcoin-qt' on mac, or else use a linux or windows build.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue