Skip to content

Commit

Permalink
QT Tests run
Browse files Browse the repository at this point in the history
  • Loading branch information
levoncrypto committed Apr 29, 2024
1 parent 5a2b7e4 commit 466316a
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 11 deletions.
4 changes: 4 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,10 @@ if ENABLE_QT
include Makefile.qt.include
endif

if ENABLE_QT_TESTS
include Makefile.qttest.include
endif

if ENABLE_TESTS
include Makefile.test.include
else
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ endif
qt_firo_qt_LDADD += -ltor

qt_firo_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) \
$(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBFIRO_SIGMA) $(LIBLELANTUS) $(LIBSPARK)\
$(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBFIRO_SIGMA) $(LIBLELANTUS) $(LIBSPARK) \
$(LIBUNIVALUE) $(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) $(BACKTRACE_LIB) $(BOOST_LIBS) $(QT_LIBS) \
$(QT_DBUS_LIBS) $(QR_LIBS) $(BDB_LIBS) $(SSL_LIBS) \
$(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) $(LIBBLSSIG_LIBS) $(LIBBLSSIG_DEPENDS) \
Expand Down
11 changes: 7 additions & 4 deletions src/Makefile.qttest.include
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ TESTS += qt/test/test_bitcoin-qt
TEST_QT_MOC_CPP = \
qt/test/moc_compattests.cpp \
qt/test/moc_rpcnestedtests.cpp \
qt/test/moc_uritests.cpp
qt/test/moc_uritests.cpp \
qt/test/moc_test_sendcoinsentry.cpp

if ENABLE_WALLET
TEST_QT_MOC_CPP +=
Expand All @@ -17,7 +18,8 @@ endif
TEST_QT_H = \
qt/test/compattests.h \
qt/test/rpcnestedtests.h \
qt/test/uritests.h
qt/test/uritests.h \
qt/test/test_sendcoinsentry.h

qt_test_test_bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
$(QT_INCLUDES) $(QT_TEST_INCLUDES)
Expand All @@ -27,6 +29,7 @@ qt_test_test_bitcoin_qt_SOURCES = \
qt/test/rpcnestedtests.cpp \
qt/test/test_main.cpp \
qt/test/uritests.cpp \
qt/test/test_sendcoinsentry.cpp \
$(TEST_QT_H)
if ENABLE_WALLET
qt_test_test_bitcoin_qt_SOURCES +=
Expand All @@ -43,8 +46,8 @@ qt_test_test_bitcoin_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
endif

qt_test_test_bitcoin_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) \
$(LIBBITCOIN_UTIL) $(LIBZEROCOIN) $(LIBBITCOIN_CONSENSUS) \
$(LIBBITCOIN_CRYPTO) $(LIBFIRO_SIGMA) $(LIBLELANTUS) $(LIBUNIVALUE) $(LIBLEVELDB) \
$(LIBBITCOIN_UTIL) $(LIBZEROCOIN) $(LIBBITCOIN_CONSENSUS) $(LIBBLSSIG_LIBS) $(LIBBLSSIG_DEPENDS) \
$(LIBBITCOIN_CRYPTO) $(LIBFIRO_SIGMA) $(LIBLELANTUS) $(LIBUNIVALUE) $(LIBSPARK) $(LIBLEVELDB) \
$(LIBLEVELDB_SSE42) $(LIBMEMENV) $(BOOST_LIBS) $(QT_DBUS_LIBS) $(QT_TEST_LIBS) $(QT_LIBS) \
$(QR_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) \
$(MINIUPNPC_LIBS) $(LIBSECP256K1) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS)
Expand Down
13 changes: 7 additions & 6 deletions src/qt/test/test_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@
#include "util.h"
#include "uritests.h"
#include "compattests.h"

#include "test_sendcoinsentry.h"
#include <QCoreApplication>
#include <QObject>
#include <QTest>

#include <openssl/ssl.h>

#if defined(QT_STATICPLUGIN) && QT_VERSION < 0x050000
Expand All @@ -35,7 +33,7 @@ int main(int argc, char *argv[])
ECC_Start();
SetupEnvironment();
SetupNetworking();
SelectParams(CBaseChainParams::MAIN);
SelectParams(CBaseChainParams::REGTEST);
noui_connect();

bool fInvalid = false;
Expand All @@ -47,10 +45,13 @@ int main(int argc, char *argv[])

SSL_library_init();

URITests test1;
TestSendCoinsEntry test1;
if (QTest::qExec(&test1) != 0)
fInvalid = true;
}

URITests test2;
if (QTest::qExec(&test2) != 0)
fInvalid = true;
RPCNestedTests test3;
if (QTest::qExec(&test3) != 0)
fInvalid = true;
Expand Down
11 changes: 11 additions & 0 deletions src/qt/test/test_sendcoinsentry.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "test_sendcoinsentry.h"

void TestSendCoinsEntry::testGenerateWarningText()
{
SendCoinsEntry* entry;
QCOMPARE(entry->generateWarningText("EXRSxX8yJHudk4QswGf3N5aPVTUi5Q1ZdX56", false), QObject::tr(" You are sending Firo to an Exchange Address. Exchange Addresses can only receive funds from a transparent address."));
QCOMPARE(entry->generateWarningText("TLyNUvysvUyt2u6vL74NEkB6ed8LTQd3mz", false), QObject::tr(" You are sending Firo from a transparent address to another transparent address. To protect your privacy, we recommend using Spark addresses instead."));
QCOMPARE(entry->generateWarningText("sr1ek2uspg2v4qu0lmccrnj90tfkdpp5zmpykr4ffdprqlf0s4devl8n0674s4d4cthxsa5w9p66s5x0zgw982t80xx9uzmxysxuawmupgfa0xecj9shm6pj7l3rshqxqtg94k88fg5u856r", false), QObject::tr(" You are sending Firo from a transparent address to a Spark address."));
QCOMPARE(entry->generateWarningText("sr1ek2uspg2v4qu0lmccrnj90tfkdpp5zmpykr4ffdprqlf0s4devl8n0674s4d4cthxsa5w9p66s5x0zgw982t80xx9uzmxysxuawmupgfa0xecj9shm6pj7l3rshqxqtg94k88fg5u856r", true), QObject::tr(" You are sending Firo from a Spark address to another Spark address. This transaction is fully private."));
QCOMPARE(entry->generateWarningText("TLyNUvysvUyt2u6vL74NEkB6ed8LTQd3mz", true), QObject::tr(" You are sending Firo from a private Spark pool to a transparent address. Please note that some exchanges do not accept direct Spark deposits."));
}
16 changes: 16 additions & 0 deletions src/qt/test/test_sendcoinsentry.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef BITCOIN_QT_TEST_SENDCOINSENTRY_H
#define BITCOIN_QT_TEST_SENDCOINSENTRY_H

#include <QObject>
#include <QTest>
#include "sendcoinsentry.h"

class TestSendCoinsEntry : public QObject
{
Q_OBJECT

private Q_SLOTS:
void testGenerateWarningText();
};

#endif // BITCOIN_QT_TEST_SENDCOINSENTRY_H

0 comments on commit 466316a

Please sign in to comment.