From e780c96e8d5e6ad6142f328fa850fedb59f5ca97 Mon Sep 17 00:00:00 2001 From: Andrzej Hunt Date: Thu, 31 Jul 2014 10:07:39 +0200 Subject: Use one test instance to run all LOK tests. Recreating Office instances after destruction (when still within the same process) currently fails, hence we need to do all tests at once for now. Change-Id: Ic7652c909e1cd970fe1ee76995e61fb6aae8f96c --- libreofficekit/qa/unit/tiledrendering.cxx | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'libreofficekit') diff --git a/libreofficekit/qa/unit/tiledrendering.cxx b/libreofficekit/qa/unit/tiledrendering.cxx index 0d4aa95a8c31..74e063447cab 100644 --- a/libreofficekit/qa/unit/tiledrendering.cxx +++ b/libreofficekit/qa/unit/tiledrendering.cxx @@ -42,13 +42,28 @@ public: TiledRenderingTest() {} - void testOverlay(); + // Currently it isn't possible to do multiple startup/shutdown + // cycle of LOK in a single process -- hence we run all our tests + // as one test, which simply carries out the individual test + // components on the one Office instance that we retrieve. + void runAllTests(); + + void testOverlay( Office* pOffice ); CPPUNIT_TEST_SUITE(TiledRenderingTest); - CPPUNIT_TEST(testOverlay); + CPPUNIT_TEST(runAllTests); CPPUNIT_TEST_SUITE_END(); }; +void TiledRenderingTest::runAllTests() +{ + scoped_ptr< Office > pOffice( lok_cpp_init( + m_sLOPath.c_str() ) ); + CPPUNIT_ASSERT( pOffice.get() ); + + testOverlay( pOffice.get() ); +} + // Our dumped .png files end up in // workdir/CppunitTest/libreofficekit_tiledrendering.test.core @@ -66,7 +81,7 @@ static void dumpRGBABitmap( const OUString& rPath, const unsigned char* pBuffer, sOutput.Close(); } -void TiledRenderingTest::testOverlay() +void TiledRenderingTest::testOverlay( Office* pOffice ) { const string sDocPath = m_sSrcRoot + "/odk/examples/java/DocumentHandling/test/test1.odt"; const string sLockFile = m_sSrcRoot + "/odk/examples/java/DocumentHandling/test/.~lock.test1.odt#"; @@ -77,10 +92,6 @@ void TiledRenderingTest::testOverlay() // Hence forcefully remove it here. remove( sLockFile.c_str() ); - scoped_ptr< Office > pOffice( lok_cpp_init( - m_sLOPath.c_str() ) ); - CPPUNIT_ASSERT( pOffice.get() ); - scoped_ptr< Document> pDocument( pOffice->documentLoad( sDocPath.c_str() ) ); -- cgit