solenv/gbuild/CppunitTest.mk | 12 +++++- tubes/qa/test_manager.cxx | 79 ++++++++++++++----------------------------- tubes/source/manager.cxx | 13 ++----- 3 files changed, 42 insertions(+), 62 deletions(-)
New commits: commit 5fe772a23f7de0a75849fa6d770a1ca6dd00bdea Author: Matúš Kukan <[email protected]> Date: Wed Oct 10 20:50:23 2012 +0200 tubes: use only one test method; and also setUp and tearDown Change-Id: I48ae990a870dc6e5c56e901485cb142b51426637 diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx index 04ad98c..5e2ccf7 100644 --- a/tubes/qa/test_manager.cxx +++ b/tubes/qa/test_manager.cxx @@ -49,20 +49,15 @@ class TestTeleTubes: public CppUnit::TestFixture { public: - TestTeleTubes(); - ~TestTeleTubes(); - // This could happen in costructor wasn't there TestTeleTubes instance for each test: - void testContactList(); + virtual void setUp(); + virtual void tearDown(); + void testSession(); - void testFailAlways(); - // Order is significant. + // There is only one method because the code in setUp + // and tearDown is expected to be executed only once. CPPUNIT_TEST_SUITE( TestTeleTubes ); - CPPUNIT_TEST( testContactList ); CPPUNIT_TEST( testSession ); -#if 0 - CPPUNIT_TEST( testFailAlways ); // test failure displays SAL_LOG, uncomment for debugging -#endif CPPUNIT_TEST_SUITE_END(); }; @@ -70,8 +65,6 @@ class TestCollaboration; // static, not members, so they actually survive cppunit test iteration static TestCollaboration* mpCollaboration1 = NULL; static TestCollaboration* mpCollaboration2 = NULL; -static TpAccount* mpOffererAccount = NULL; -static TpContact* mpAccepterContact = NULL; //static bool mbFileSentSuccess = false; static bool mbPacketReceived = false; static OUString maTestConfigIniURL; @@ -97,7 +90,7 @@ static gboolean timed_out( void * ) return FALSE; } -TestTeleTubes::TestTeleTubes() +void TestTeleTubes::setUp() { g_timeout_add_seconds (10, timed_out, NULL); maTestConfigIniURL = OUString( "file://" + @@ -122,8 +115,16 @@ TestTeleTubes::TestTeleTubes() CPPUNIT_ASSERT( TeleManager::init( true)); } -void TestTeleTubes::testContactList() +/* FIXME: do we need the possibility to pass function to Collaboration::SendFile() ? +static void lcl_FileSent( bool success, void * ) { + mbFileSentSuccess = success; +} +*/ + +void TestTeleTubes::testSession() +{ + // First try to get account and contact AccountContactPairV pairs = TeleManager::getContacts(); /* Both our accounts are meant to be signed in, and they both should be * capable of LibreOffice tubes because this test runs after we register @@ -132,7 +133,9 @@ void TestTeleTubes::testContactList() "Make sure both your test accounts are signed in " "and are on each other's contact lists", pairs.size() > 0 ); - CPPUNIT_ASSERT(!mpAccepterContact); + + TpAccount* mpOffererAccount = NULL; + TpContact* mpAccepterContact = NULL; for (guint i = 0; i < pairs.size(); i++) { @@ -160,25 +163,19 @@ void TestTeleTubes::testContactList() "Make sure both your test accounts are signed in " "and are on each other's contact lists", mpAccepterContact); -} - -/* FIXME: do we need the possibility to pass function to Collaboration::SendFile() ? -static void lcl_FileSent( bool success, void * ) -{ - mbFileSentSuccess = success; -} -*/ -void TestTeleTubes::testSession() -{ + // Now we can start session TeleConference* pConference = NULL; - CPPUNIT_ASSERT( mpOffererAccount != 0); - CPPUNIT_ASSERT( mpAccepterContact != 0); pConference = TeleManager::startBuddySession( mpOffererAccount, mpAccepterContact); CPPUNIT_ASSERT( pConference != NULL); mpCollaboration1->SetConference( pConference ); mpCollaboration1->SendFile( mpAccepterContact, maTestConfigIniURL ); + g_object_unref(mpOffererAccount); + mpOffererAccount = NULL; + g_object_unref(mpAccepterContact); + mpAccepterContact = NULL; + //while (!mbFileSentSuccess) // g_main_context_iteration( NULL, TRUE); @@ -196,16 +193,8 @@ void TestTeleTubes::testSession() g_main_context_iteration( NULL, TRUE); } -TestTeleTubes::~TestTeleTubes() +void TestTeleTubes::tearDown() { - if (mpOffererAccount) { - g_object_unref(mpOffererAccount); - mpOffererAccount = NULL; - } - if (mpAccepterContact) { - g_object_unref(mpAccepterContact); - mpAccepterContact = NULL; - } // Closes the TeleConference in destructor: delete mpCollaboration1; delete mpCollaboration2; @@ -213,11 +202,6 @@ TestTeleTubes::~TestTeleTubes() TeleManager::finalize(); } -void TestTeleTubes::testFailAlways() -{ - CPPUNIT_ASSERT( false); -} - CPPUNIT_TEST_SUITE_REGISTRATION( TestTeleTubes); } commit 1ad0aef2ab81eeb96396bd0bce1203f3f6e681af Author: Matúš Kukan <[email protected]> Date: Wed Oct 10 20:28:44 2012 +0200 tubes: getProcessServiceFactory does not return NULL anymore Change-Id: I3e5e2e2c826a732028c1ffc32b9620d22c3409d1 diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx index 8089976..26b4872 100644 --- a/tubes/source/manager.cxx +++ b/tubes/source/manager.cxx @@ -269,26 +269,23 @@ void TeleManager_fileReceived( const OUString& rStr, const OString& rUuid ) } TeleManager::setCurrentUuid( sUuid ); - css::uno::Reference< css::lang::XMultiServiceFactory > rFactory = - ::comphelper::getProcessServiceFactory(); - - // Should happen only for unit test - if (rFactory == NULL) - return; - - css::uno::Sequence < css::beans::PropertyValue > args(0); try { + css::uno::Reference< css::lang::XMultiServiceFactory > rFactory = + comphelper::getProcessServiceFactory(); + css::uno::Reference < css::frame::XComponentLoader > xLoader( ::comphelper::getProcessServiceFactory()->createInstance( "com.sun.star.frame.Desktop" ), css::uno::UNO_QUERY_THROW ); + css::uno::Sequence < css::beans::PropertyValue > args(0); css::uno::Reference < css::util::XCloseable > xDoc( xLoader->loadComponentFromURL( rStr, "_blank", 0, args ), css::uno::UNO_QUERY_THROW ); } catch ( const css::uno::Exception& e ) { + // Expected to happen for unit test SAL_WARN( "tubes", "TeleManager_fileReceived: exception when loading: " << e.Message ); } } commit 6f543a4309115008cf5b5b40eea0fe4dab9eb5c5 Author: Matúš Kukan <[email protected]> Date: Wed Oct 10 20:26:55 2012 +0200 tubes: just hardcode the url Change-Id: I587d83221c702571cdfe4310b27adff1cc3421c1 diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx index 6296eb3..04ad98c 100644 --- a/tubes/qa/test_manager.cxx +++ b/tubes/qa/test_manager.cxx @@ -100,17 +100,8 @@ static gboolean timed_out( void * ) TestTeleTubes::TestTeleTubes() { 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); - } + maTestConfigIniURL = OUString( "file://" + + OUString::createFromAscii( getenv("SRCDIR") ) + "/tubes/qa/test-config.ini"); rtl::Bootstrap aTestConfig( maTestConfigIniURL ); TeleManager::addSuffixToNames( "TeleTest"); commit 19e0289eb7a8fc05e40217a2dbf9eed1be071b59 Author: Matúš Kukan <[email protected]> Date: Wed Oct 10 19:11:14 2012 +0200 gb_CppunitTest_use_api is special Change-Id: I5f4f1a5b78333aa294c334870412599f76573aef diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk index 5d0788a..f4145dc 100644 --- a/solenv/gbuild/CppunitTest.mk +++ b/solenv/gbuild/CppunitTest.mk @@ -196,6 +196,16 @@ $(foreach rdb,$(2),$(call gb_CppunitTest__use_api,$(1),$(rdb))) endef +define gb_CppunitTest_use_udk_api +$(call gb_CppunitTest_use_api,$(1),udkapi) + +endef + +define gb_CppunitTest_use_sdk_api +$(call gb_CppunitTest_use_api,$(1),udkapi offapi) + +endef + define gb_CppunitTest_add_service_rdb $$(call gb_Output_error,\ gb_CppunitTest_add_service_rdb: use gb_CppunitTest_use_rdb instead.) @@ -345,8 +355,6 @@ $(eval $(foreach method,\ disable_standard_system_libs \ use_system_darwin_frameworks \ use_system_win32_libs \ - use_sdk_api \ - use_udk_api \ use_internal_api \ use_internal_bootstrap_api \ use_internal_comprehensive_api \
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
