2012-03-25 23:25:10 +02:00
|
|
|
#include "uritests.h"
|
2013-04-13 07:13:08 +02:00
|
|
|
|
|
|
|
#include "guiutil.h"
|
|
|
|
#include "walletmodel.h"
|
2012-02-10 23:25:36 +01:00
|
|
|
|
|
|
|
#include <QUrl>
|
|
|
|
|
2012-03-25 23:25:10 +02:00
|
|
|
void URITests::uriTests()
|
2012-02-10 23:25:36 +01:00
|
|
|
{
|
|
|
|
SendCoinsRecipient rv;
|
2012-03-25 23:25:10 +02:00
|
|
|
QUrl uri;
|
2015-02-25 18:24:15 +01:00
|
|
|
uri.setUrl(QString("darkcoin:XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg?req-dontexist="));
|
2012-03-25 23:25:10 +02:00
|
|
|
QVERIFY(!GUIUtil::parseBitcoinURI(uri, &rv));
|
2012-02-10 23:25:36 +01:00
|
|
|
|
2015-02-25 18:24:15 +01:00
|
|
|
uri.setUrl(QString("darkcoin:XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg?dontexist="));
|
2012-03-25 23:25:10 +02:00
|
|
|
QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));
|
2015-02-25 18:24:15 +01:00
|
|
|
QVERIFY(rv.address == QString("XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg"));
|
2012-02-10 23:25:36 +01:00
|
|
|
QVERIFY(rv.label == QString());
|
|
|
|
QVERIFY(rv.amount == 0);
|
|
|
|
|
2015-02-25 18:24:15 +01:00
|
|
|
uri.setUrl(QString("darkcoin:XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg?label=Some Example Address"));
|
2012-03-25 23:25:10 +02:00
|
|
|
QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));
|
2015-02-25 18:24:15 +01:00
|
|
|
QVERIFY(rv.address == QString("XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg"));
|
|
|
|
QVERIFY(rv.label == QString("Some Example Address"));
|
2012-02-10 23:25:36 +01:00
|
|
|
QVERIFY(rv.amount == 0);
|
|
|
|
|
2015-02-25 18:24:15 +01:00
|
|
|
uri.setUrl(QString("darkcoin:XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg?amount=0.001"));
|
2012-03-25 23:25:10 +02:00
|
|
|
QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));
|
2015-02-25 18:24:15 +01:00
|
|
|
QVERIFY(rv.address == QString("XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg"));
|
2012-02-10 23:25:36 +01:00
|
|
|
QVERIFY(rv.label == QString());
|
|
|
|
QVERIFY(rv.amount == 100000);
|
|
|
|
|
2015-02-25 18:24:15 +01:00
|
|
|
uri.setUrl(QString("darkcoin:XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg?amount=1.001"));
|
2012-03-25 23:25:10 +02:00
|
|
|
QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));
|
2015-02-25 18:24:15 +01:00
|
|
|
QVERIFY(rv.address == QString("XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg"));
|
2012-02-10 23:25:36 +01:00
|
|
|
QVERIFY(rv.label == QString());
|
|
|
|
QVERIFY(rv.amount == 100100000);
|
|
|
|
|
2015-02-25 18:24:15 +01:00
|
|
|
uri.setUrl(QString("darkcoin:XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg?amount=100&label=Some Example"));
|
2012-03-25 23:25:10 +02:00
|
|
|
QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));
|
2015-02-25 18:24:15 +01:00
|
|
|
QVERIFY(rv.address == QString("XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg"));
|
2012-08-07 16:43:58 +02:00
|
|
|
QVERIFY(rv.amount == 10000000000LL);
|
2015-02-25 18:24:15 +01:00
|
|
|
QVERIFY(rv.label == QString("Some Example"));
|
2012-02-10 23:25:36 +01:00
|
|
|
|
2015-02-25 18:24:15 +01:00
|
|
|
uri.setUrl(QString("darkcoin:XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg?message=Some Example Address"));
|
2012-03-25 23:25:10 +02:00
|
|
|
QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));
|
2015-02-25 18:24:15 +01:00
|
|
|
QVERIFY(rv.address == QString("XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg"));
|
2012-02-10 23:25:36 +01:00
|
|
|
QVERIFY(rv.label == QString());
|
2012-02-17 15:26:20 +01:00
|
|
|
|
2015-02-25 18:24:15 +01:00
|
|
|
QVERIFY(GUIUtil::parseBitcoinURI("darkcoin://XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg?message=Some Example Address", &rv));
|
|
|
|
QVERIFY(rv.address == QString("XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg"));
|
2012-02-10 23:25:36 +01:00
|
|
|
QVERIFY(rv.label == QString());
|
|
|
|
|
2015-02-25 18:24:15 +01:00
|
|
|
uri.setUrl(QString("darkcoin:XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg?req-message=Some Example Address"));
|
2013-10-18 13:44:27 +02:00
|
|
|
QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));
|
2012-02-10 23:25:36 +01:00
|
|
|
|
2015-02-25 18:24:15 +01:00
|
|
|
uri.setUrl(QString("darkcoin:XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg?amount=1,000&label=Some Example"));
|
2012-03-25 23:25:10 +02:00
|
|
|
QVERIFY(!GUIUtil::parseBitcoinURI(uri, &rv));
|
2012-02-10 23:25:36 +01:00
|
|
|
|
2015-02-25 18:24:15 +01:00
|
|
|
uri.setUrl(QString("darkcoin:XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg?amount=1,000.0&label=Some Example"));
|
2012-03-25 23:25:10 +02:00
|
|
|
QVERIFY(!GUIUtil::parseBitcoinURI(uri, &rv));
|
2012-02-10 23:25:36 +01:00
|
|
|
}
|