tubes/qa/test_manager.cxx | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-)
New commits: commit 4e6907b5d526241c93767fd25d8c2866c034a8d8 Author: Matúš Kukan <matus.ku...@gmail.com> Date: Thu Sep 27 22:24:51 2012 +0200 tubes: let's use ctor, dtor and less methods in the test They are not independent anyway. This way it may fail only once in constructor and avoid segmentation faults. Change-Id: I304f688b187f9870bf664517112550ad9a2a87c7 diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx index 2ccbe32..6296eb3 100644 --- a/tubes/qa/test_manager.cxx +++ b/tubes/qa/test_manager.cxx @@ -49,25 +49,17 @@ class TestTeleTubes: public CppUnit::TestFixture { public: - TestTeleTubes() {} - ~TestTeleTubes() {} + TestTeleTubes(); + ~TestTeleTubes(); // This could happen in costructor wasn't there TestTeleTubes instance for each test: - void testInitialize(); - void testInitTeleManager(); void testContactList(); - void testStartBuddySession(); - void testSendPacket(); - void testDestroyTeleTubes(); + void testSession(); void testFailAlways(); // Order is significant. CPPUNIT_TEST_SUITE( TestTeleTubes ); - CPPUNIT_TEST( testInitialize ); - CPPUNIT_TEST( testInitTeleManager ); CPPUNIT_TEST( testContactList ); - CPPUNIT_TEST( testStartBuddySession ); - CPPUNIT_TEST( testSendPacket ); - CPPUNIT_TEST( testDestroyTeleTubes ); + CPPUNIT_TEST( testSession ); #if 0 CPPUNIT_TEST( testFailAlways ); // test failure displays SAL_LOG, uncomment for debugging #endif @@ -105,7 +97,7 @@ static gboolean timed_out( void * ) return FALSE; } -void TestTeleTubes::testInitialize() +TestTeleTubes::TestTeleTubes() { g_timeout_add_seconds (10, timed_out, NULL); try @@ -135,10 +127,7 @@ void TestTeleTubes::testInitialize() mpCollaboration1 = new TestCollaboration(); mpCollaboration2 = new TestCollaboration(); -} -void TestTeleTubes::testInitTeleManager() -{ CPPUNIT_ASSERT( TeleManager::init( true)); } @@ -189,7 +178,7 @@ static void lcl_FileSent( bool success, void * ) } */ -void TestTeleTubes::testStartBuddySession() +void TestTeleTubes::testSession() { TeleConference* pConference = NULL; CPPUNIT_ASSERT( mpOffererAccount != 0); @@ -209,17 +198,14 @@ void TestTeleTubes::testStartBuddySession() pConference = TeleManager::getConference(); CPPUNIT_ASSERT( pConference != NULL); mpCollaboration2->SetConference( pConference ); -} -void TestTeleTubes::testSendPacket() -{ mpCollaboration1->SendPacket( "from 1 to 2"); while (!mbPacketReceived) g_main_context_iteration( NULL, TRUE); } -void TestTeleTubes::testDestroyTeleTubes() +TestTeleTubes::~TestTeleTubes() { if (mpOffererAccount) { g_object_unref(mpOffererAccount); commit 4917f0ceb2a7b1bb3ba878373f71f38d156278af Author: Matúš Kukan <matus.ku...@gmail.com> Date: Thu Sep 27 22:07:53 2012 +0200 tubes: catch exception to get more info Also add timeout as a first thing to not loop forever if something else goes wrong. Change-Id: I3c752f74bfd32c1a0a6d1ce85408271a530fb379 diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx index 545947d..2ccbe32 100644 --- a/tubes/qa/test_manager.cxx +++ b/tubes/qa/test_manager.cxx @@ -107,9 +107,18 @@ static gboolean timed_out( void * ) void TestTeleTubes::testInitialize() { - utl::LocalFileHelper::ConvertPhysicalNameToURL( - OUString::createFromAscii( getenv("SRCDIR") ) + "/tubes/qa/test-config.ini", - maTestConfigIniURL ); + g_timeout_add_seconds (10, timed_out, NULL); + try + { + utl::LocalFileHelper::ConvertPhysicalNameToURL( + OUString::createFromAscii( getenv("SRCDIR") ) + "/tubes/qa/test-config.ini", + maTestConfigIniURL ); + } + catch (const com::sun::star::uno::Exception& e) + { + CPPUNIT_ASSERT_MESSAGE( OUStringToOString( "Exception while getting config.ini url: " + + e.Message, RTL_TEXTENCODING_UTF8).getStr(), false); + } rtl::Bootstrap aTestConfig( maTestConfigIniURL ); TeleManager::addSuffixToNames( "TeleTest"); @@ -124,7 +133,6 @@ void TestTeleTubes::testInitialize() aTestConfig.getFrom("accepter", aAccepterIdentifier)); maAccepterIdentifier = OUStringToOString( aAccepterIdentifier, RTL_TEXTENCODING_UTF8); - g_timeout_add_seconds (10, timed_out, NULL); mpCollaboration1 = new TestCollaboration(); mpCollaboration2 = new TestCollaboration(); }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits