Browse Source

Merge pull request #1658 from TheBlueMatt/qttest

Fix several issues in the Qt unit tests.
miguelfreitas
Jeff Garzik 13 years ago
parent
commit
2c006b0b3e
  1. 7
      src/makefile.linux-mingw
  2. 6
      src/qt/guiutil.cpp
  3. 4
      src/qt/sendcoinsdialog.cpp
  4. 7
      src/qt/test/test_main.cpp
  5. 2
      src/qt/test/uritests.cpp

7
src/makefile.linux-mingw

@ -7,11 +7,12 @@ DEPSDIR:=/usr/i586-mingw32msvc @@ -7,11 +7,12 @@ DEPSDIR:=/usr/i586-mingw32msvc
USE_UPNP:=0
INCLUDEPATHS= \
-I"$(CURDIR)" \
-I"$(CURDIR)"/obj \
-I"$(DEPSDIR)/boost_1_49_0" \
-I"$(DEPSDIR)/db-4.8.30.NC/build_unix" \
-I"$(DEPSDIR)/openssl-1.0.1b/include" \
-I"$(DEPSDIR)" \
-I"$(CURDIR)"/obj \
-I"$(DEPSDIR)"
LIBPATHS= \
-L"$(DEPSDIR)/boost_1_49_0/stage/lib" \
@ -88,7 +89,7 @@ obj-test/%.o: test/%.cpp $(HEADERS) @@ -88,7 +89,7 @@ obj-test/%.o: test/%.cpp $(HEADERS)
i586-mingw32msvc-g++ -c $(TESTDEFS) $(CFLAGS) -o $@ $<
test_bitcoin.exe: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%))
i586-mingw32msvc-g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ -lboost_unit_test_framework $(LIBS)
i586-mingw32msvc-g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ -lboost_unit_test_framework-mt-s $(LIBS)
clean:

6
src/qt/guiutil.cpp

@ -4,7 +4,6 @@ @@ -4,7 +4,6 @@
#include "bitcoinunits.h"
#include "util.h"
#include "init.h"
#include "base58.h"
#include <QString>
#include <QDateTime>
@ -81,11 +80,6 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out) @@ -81,11 +80,6 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
if(uri.scheme() != QString("bitcoin"))
return false;
// check if the address is valid
CBitcoinAddress addressFromUri(uri.path().toStdString());
if (!addressFromUri.IsValid())
return false;
SendCoinsRecipient rv;
rv.address = uri.path();
rv.amount = 0;

4
src/qt/sendcoinsdialog.cpp

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
#include "sendcoinsentry.h"
#include "guiutil.h"
#include "askpassphrasedialog.h"
#include "base58.h"
#include <QMessageBox>
#include <QLocale>
@ -273,6 +274,9 @@ bool SendCoinsDialog::handleURI(const QString &uri) @@ -273,6 +274,9 @@ bool SendCoinsDialog::handleURI(const QString &uri)
// URI has to be valid
if (GUIUtil::parseBitcoinURI(uri, &rv))
{
CBitcoinAddress address(rv.address.toStdString());
if (!address.IsValid())
return false;
pasteEntry(rv);
return true;
}

7
src/qt/test/test_main.cpp

@ -6,6 +6,11 @@ @@ -6,6 +6,11 @@
// This is all you need to run all the tests
int main(int argc, char *argv[])
{
bool fInvalid = false;
URITests test1;
QTest::qExec(&test1);
if (QTest::qExec(&test1) != 0)
fInvalid = true;
return fInvalid;
}

2
src/qt/test/uritests.cpp

@ -47,7 +47,7 @@ void URITests::uriTests() @@ -47,7 +47,7 @@ void URITests::uriTests()
uri.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=100&label=Wikipedia Example"));
QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));
QVERIFY(rv.address == QString("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W"));
QVERIFY(rv.amount == 10000000000);
QVERIFY(rv.amount == 10000000000LL);
QVERIFY(rv.label == QString("Wikipedia Example"));
uri.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?message=Wikipedia Example Address"));

Loading…
Cancel
Save