mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-13 01:24:11 +02:00
[test] Refactor Servent startup into separate function
This commit is contained in:
@@ -47,12 +47,11 @@ private:
|
|||||||
"Link-local IPv6 address detected" );
|
"Link-local IPv6 address detected" );
|
||||||
}
|
}
|
||||||
|
|
||||||
private slots:
|
void listenAllBasic( Servent** servent )
|
||||||
void testListenAll()
|
|
||||||
{
|
{
|
||||||
// Instantiate a new instance for each test so we have a sane state.
|
// Instantiate a new instance for each test so we have a sane state.
|
||||||
Servent* servent = new Servent();
|
*servent = new Servent();
|
||||||
QVERIFY( servent != NULL );
|
QVERIFY( *servent != NULL );
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
|
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
|
||||||
QHostAddress anyAddress = QHostAddress::Any;
|
QHostAddress anyAddress = QHostAddress::Any;
|
||||||
@@ -64,9 +63,16 @@ private slots:
|
|||||||
// With (upnp == false) and (mode ==
|
// With (upnp == false) and (mode ==
|
||||||
// Tomahawk::Network::ExternalAddress::Upnp) we should not do
|
// Tomahawk::Network::ExternalAddress::Upnp) we should not do
|
||||||
// any external address detection.
|
// any external address detection.
|
||||||
bool ok = servent->startListening( anyAddress, false, 52222,
|
bool ok = (*servent)->startListening( anyAddress, false, 52222,
|
||||||
Tomahawk::Network::ExternalAddress::Upnp, 52222);
|
Tomahawk::Network::ExternalAddress::Upnp, 52222);
|
||||||
QVERIFY( ok );
|
QVERIFY( ok );
|
||||||
|
}
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void testListenAll()
|
||||||
|
{
|
||||||
|
Servent* servent;
|
||||||
|
listenAllBasic( &servent );
|
||||||
|
|
||||||
// Verify that computed external addresses are ok
|
// Verify that computed external addresses are ok
|
||||||
QList<QHostAddress> externalAddresses = servent->addresses();
|
QList<QHostAddress> externalAddresses = servent->addresses();
|
||||||
|
Reference in New Issue
Block a user