From 1012c8f9bfe0516e19e399a4088922e2df49de68 Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Tue, 26 Aug 2014 00:00:48 +0100 Subject: [PATCH] [test] Refactor Servent startup into separate function --- src/tests/TestServent.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/tests/TestServent.h b/src/tests/TestServent.h index b1bbc000c..2a840b8b8 100644 --- a/src/tests/TestServent.h +++ b/src/tests/TestServent.h @@ -47,12 +47,11 @@ private: "Link-local IPv6 address detected" ); } -private slots: - void testListenAll() + void listenAllBasic( Servent** servent ) { // Instantiate a new instance for each test so we have a sane state. - Servent* servent = new Servent(); - QVERIFY( servent != NULL ); + *servent = new Servent(); + QVERIFY( *servent != NULL ); #if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 ) QHostAddress anyAddress = QHostAddress::Any; @@ -64,9 +63,16 @@ private slots: // With (upnp == false) and (mode == // Tomahawk::Network::ExternalAddress::Upnp) we should not do // any external address detection. - bool ok = servent->startListening( anyAddress, false, 52222, + bool ok = (*servent)->startListening( anyAddress, false, 52222, Tomahawk::Network::ExternalAddress::Upnp, 52222); QVERIFY( ok ); + } + +private slots: + void testListenAll() + { + Servent* servent; + listenAllBasic( &servent ); // Verify that computed external addresses are ok QList externalAddresses = servent->addresses();