aboutsummaryrefslogtreecommitdiff
path: root/src/qt/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/test')
-rw-r--r--src/qt/test/CMakeLists.txt56
-rw-r--r--src/qt/test/Makefile6
-rw-r--r--src/qt/test/test_main.cpp16
-rw-r--r--src/qt/test/wallettests.cpp8
4 files changed, 61 insertions, 25 deletions
diff --git a/src/qt/test/CMakeLists.txt b/src/qt/test/CMakeLists.txt
new file mode 100644
index 0000000000..582ed71466
--- /dev/null
+++ b/src/qt/test/CMakeLists.txt
@@ -0,0 +1,56 @@
+# Copyright (c) 2024-present The Bitcoin Core developers
+# Distributed under the MIT software license, see the accompanying
+# file COPYING or https://opensource.org/license/mit/.
+
+add_executable(test_bitcoin-qt
+ apptests.cpp
+ optiontests.cpp
+ rpcnestedtests.cpp
+ test_main.cpp
+ uritests.cpp
+ util.cpp
+ ../../init/bitcoin-qt.cpp
+)
+
+target_link_libraries(test_bitcoin-qt
+ core_interface
+ bitcoinqt
+ test_util
+ bitcoin_node
+ Boost::headers
+ Qt5::Test
+)
+
+import_plugins(test_bitcoin-qt)
+
+if(ENABLE_WALLET)
+ target_sources(test_bitcoin-qt
+ PRIVATE
+ addressbooktests.cpp
+ wallettests.cpp
+ ../../wallet/test/wallet_test_fixture.cpp
+ )
+endif()
+
+if(NOT QT_IS_STATIC)
+ add_custom_command(
+ TARGET test_bitcoin-qt POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_PROPERTY:Qt5::QMinimalIntegrationPlugin,LOCATION_$<UPPER_CASE:$<CONFIG>>> $<TARGET_FILE_DIR:test_bitcoin-qt>/plugins/platforms
+ VERBATIM
+ )
+endif()
+
+add_test(NAME test_bitcoin-qt
+ COMMAND test_bitcoin-qt
+)
+if(WIN32 AND VCPKG_TARGET_TRIPLET)
+ # On Windows, vcpkg configures Qt with `-opengl dynamic`, which makes
+ # the "minimal" platform plugin unusable due to internal Qt bugs.
+ set_tests_properties(test_bitcoin-qt PROPERTIES
+ ENVIRONMENT "QT_QPA_PLATFORM=windows"
+ )
+endif()
+
+install(TARGETS test_bitcoin-qt
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+)
diff --git a/src/qt/test/Makefile b/src/qt/test/Makefile
deleted file mode 100644
index a02f86b62a..0000000000
--- a/src/qt/test/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-all:
- $(MAKE) -C ../../ test_bitcoin_qt
-clean:
- $(MAKE) -C ../../ test_bitcoin_qt_clean
-check:
- $(MAKE) -C ../../ test_bitcoin_qt_check
diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp
index f310d0a02b..958cc7ae88 100644
--- a/src/qt/test/test_main.cpp
+++ b/src/qt/test/test_main.cpp
@@ -28,22 +28,6 @@
#include <functional>
-#if defined(QT_STATICPLUGIN)
-#include <QtPlugin>
-#if defined(QT_QPA_PLATFORM_MINIMAL)
-Q_IMPORT_PLUGIN(QMinimalIntegrationPlugin);
-#endif
-#if defined(QT_QPA_PLATFORM_XCB)
-Q_IMPORT_PLUGIN(QXcbIntegrationPlugin);
-#elif defined(QT_QPA_PLATFORM_WINDOWS)
-Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
-#elif defined(QT_QPA_PLATFORM_COCOA)
-Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin);
-#elif defined(QT_QPA_PLATFORM_ANDROID)
-Q_IMPORT_PLUGIN(QAndroidPlatformIntegrationPlugin)
-#endif
-#endif
-
const std::function<void(const std::string&)> G_TEST_LOG_FUN{};
const std::function<std::vector<const char*>()> G_TEST_COMMAND_LINE_ARGUMENTS{};
diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp
index 603df0b15f..6a573d284c 100644
--- a/src/qt/test/wallettests.cpp
+++ b/src/qt/test/wallettests.cpp
@@ -199,7 +199,7 @@ std::shared_ptr<CWallet> SetupLegacyWatchOnlyWallet(interfaces::Node& node, Test
wallet->SetupLegacyScriptPubKeyMan();
// Add watched key
CPubKey pubKey = test.coinbaseKey.GetPubKey();
- bool import_keys = wallet->ImportPubKeys({pubKey.GetID()}, {{pubKey.GetID(), pubKey}} , /*key_origins=*/{}, /*add_keypool=*/false, /*internal=*/false, /*timestamp=*/1);
+ bool import_keys = wallet->ImportPubKeys({{pubKey.GetID(), false}}, {{pubKey.GetID(), pubKey}} , /*key_origins=*/{}, /*add_keypool=*/false, /*timestamp=*/1);
assert(import_keys);
wallet->SetLastBlockProcessed(105, WITH_LOCK(node.context()->chainman->GetMutex(), return node.context()->chainman->ActiveChain().Tip()->GetBlockHash()));
}
@@ -218,8 +218,10 @@ std::shared_ptr<CWallet> SetupDescriptorsWallet(interfaces::Node& node, TestChai
// Add the coinbase key
FlatSigningProvider provider;
std::string error;
- std::unique_ptr<Descriptor> desc = Parse("combo(" + EncodeSecret(test.coinbaseKey) + ")", provider, error, /* require_checksum=*/ false);
- assert(desc);
+ auto descs = Parse("combo(" + EncodeSecret(test.coinbaseKey) + ")", provider, error, /* require_checksum=*/ false);
+ assert(!descs.empty());
+ assert(descs.size() == 1);
+ auto& desc = descs.at(0);
WalletDescriptor w_desc(std::move(desc), 0, 0, 1, 1);
if (!wallet->AddWalletDescriptor(w_desc, provider, "", false)) assert(false);
CTxDestination dest = GetDestinationForKey(test.coinbaseKey.GetPubKey(), wallet->m_default_address_type);