diff options
-rw-r--r-- | libreofficekit/CppunitTest_libreofficekit_tiledrendering.mk | 5 | ||||
-rw-r--r-- | libreofficekit/Module_libreofficekit.mk | 6 | ||||
-rw-r--r-- | libreofficekit/qa/unit/tiledrendering.cxx | 61 |
3 files changed, 48 insertions, 24 deletions
diff --git a/libreofficekit/CppunitTest_libreofficekit_tiledrendering.mk b/libreofficekit/CppunitTest_libreofficekit_tiledrendering.mk index acc708ff8abe..783074fc455c 100644 --- a/libreofficekit/CppunitTest_libreofficekit_tiledrendering.mk +++ b/libreofficekit/CppunitTest_libreofficekit_tiledrendering.mk @@ -29,8 +29,6 @@ $(eval $(call gb_CppunitTest_use_libraries,libreofficekit_tiledrendering, \ $(gb_UWINAPI) \ )) -# unotest \ - ifeq ($(OS),LINUX) $(eval $(call gb_CppunitTest_add_libs,libreofficekit_tiledrendering,\ -lm \ @@ -42,13 +40,10 @@ endif $(eval $(call gb_CppunitTest_use_sdk_api,libreofficekit_tiledrendering)) $(eval $(call gb_CppunitTest_use_ure,libreofficekit_tiledrendering)) -#$(eval $(call gb_CppunitTest_use_vcl,libreofficekit_tiledrendering)) # Depend on ~everything, as tiled rendering can use most parts of LO. $(eval $(call gb_CppunitTest_use_rdb,libreofficekit_tiledrendering,services)) $(eval $(call gb_CppunitTest_use_configuration,libreofficekit_tiledrendering)) -$(eval $(call gb_CppunitTest_use_confpreinit,libreofficekit_tiledrendering)) - # vim: set noet sw=4 ts=4: diff --git a/libreofficekit/Module_libreofficekit.mk b/libreofficekit/Module_libreofficekit.mk index fe5ee151f2be..ad2064fd8970 100644 --- a/libreofficekit/Module_libreofficekit.mk +++ b/libreofficekit/Module_libreofficekit.mk @@ -11,9 +11,9 @@ $(eval $(call gb_Module_Module,libreofficekit)) ifeq ($(OS),LINUX) -# $(eval $(call gb_Module_add_check_targets,libreofficekit,\ -# CppunitTest_libreofficekit_tiledrendering \ -# )) +$(eval $(call gb_Module_add_slowcheck_targets,libreofficekit,\ + CppunitTest_libreofficekit_tiledrendering \ +)) ifneq ($(ENABLE_GTK),) $(eval $(call gb_Module_add_targets,libreofficekit,\ diff --git a/libreofficekit/qa/unit/tiledrendering.cxx b/libreofficekit/qa/unit/tiledrendering.cxx index 0b9b28898e8c..44f1bed222bb 100644 --- a/libreofficekit/qa/unit/tiledrendering.cxx +++ b/libreofficekit/qa/unit/tiledrendering.cxx @@ -21,15 +21,28 @@ #include <vcl/salbtype.hxx> #include <vcl/bmpacc.hxx> #include <vcl/pngwrite.hxx> +#include <osl/file.hxx> +#include <rtl/bootstrap.hxx> #define LOK_USE_UNSTABLE_API #include <LibreOfficeKit/LibreOfficeKitInit.h> #include <LibreOfficeKit/LibreOfficeKit.hxx> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> using namespace ::boost; using namespace ::lok; using namespace ::std; +OUString getFileURLFromSystemPath(OUString const & path) +{ + OUString url; + osl::FileBase::RC e = osl::FileBase::getFileURLFromSystemPath(path, url); + CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, e); + if (!url.endsWith("/")) + url += "/"; + return url; +} + // We specifically don't use the usual BootStrapFixture, as LOK does // all it's own setup and bootstrapping, and should be useable in a // raw C++ program. @@ -51,7 +64,9 @@ public: void testDocumentLoadFail( Office* pOffice ); void testDocumentTypes( Office* pOffice ); void testImpressSlideNames( Office* pOffice ); +#if 0 void testOverlay( Office* pOffice ); +#endif CPPUNIT_TEST_SUITE(TiledRenderingTest); CPPUNIT_TEST(runAllTests); @@ -60,6 +75,16 @@ public: void TiledRenderingTest::runAllTests() { + // set UserInstallation to user profile dir in test/user-template + const char* pWorkdirRoot = getenv("WORKDIR_FOR_BUILD"); + OUString aWorkdirRootPath = OUString::createFromAscii(pWorkdirRoot); + OUString aWorkdirRootURL = getFileURLFromSystemPath(aWorkdirRootPath); + OUString sUserInstallURL = aWorkdirRootURL + "/unittest"; + rtl::Bootstrap::set(OUString("UserInstallation"), sUserInstallURL); + + // No restart in desktop. + setenv("LOK_TEST", "1", true); + scoped_ptr< Office > pOffice( lok_cpp_init( m_sLOPath.c_str() ) ); CPPUNIT_ASSERT( pOffice.get() ); @@ -67,7 +92,9 @@ void TiledRenderingTest::runAllTests() testDocumentLoadFail( pOffice.get() ); testDocumentTypes( pOffice.get() ); testImpressSlideNames( pOffice.get() ); +#if 0 testOverlay( pOffice.get() ); +#endif } void TiledRenderingTest::testDocumentLoadFail( Office* pOffice ) @@ -84,21 +111,7 @@ void TiledRenderingTest::testDocumentLoadFail( Office* pOffice ) // Our dumped .png files end up in // workdir/CppunitTest/libreofficekit_tiledrendering.test.core -static void dumpRGBABitmap( const OUString& rPath, const unsigned char* pBuffer, - const int nWidth, const int nHeight ) -{ - Bitmap aBitmap( Size( nWidth, nHeight ), 32 ); - Bitmap::ScopedWriteAccess pWriteAccess( aBitmap ); - memcpy( pWriteAccess->GetBuffer(), pBuffer, 4*nWidth*nHeight ); - - BitmapEx aBitmapEx( aBitmap ); - vcl::PNGWriter aWriter( aBitmapEx ); - SvFileStream sOutput( rPath, StreamMode::WRITE ); - aWriter.Write( sOutput ); - sOutput.Close(); -} - -LibreOfficeKitDocumentType getDocumentType( Office* pOffice, const string& rPath ) +int getDocumentType( Office* pOffice, const string& rPath ) { scoped_ptr< Document> pDocument( pOffice->documentLoad( rPath.c_str() ) ); CPPUNIT_ASSERT( pDocument.get() ); @@ -147,7 +160,22 @@ void TiledRenderingTest::testImpressSlideNames( Office* pOffice ) // have a localised version of "Slide 3". } -void TiledRenderingTest::testOverlay( Office* pOffice ) +#if 0 +static void dumpRGBABitmap( const OUString& rPath, const unsigned char* pBuffer, + const int nWidth, const int nHeight ) +{ + Bitmap aBitmap( Size( nWidth, nHeight ), 32 ); + Bitmap::ScopedWriteAccess pWriteAccess( aBitmap ); + memcpy( pWriteAccess->GetBuffer(), pBuffer, 4*nWidth*nHeight ); + + BitmapEx aBitmapEx( aBitmap ); + vcl::PNGWriter aWriter( aBitmapEx ); + SvFileStream sOutput( rPath, StreamMode::WRITE ); + aWriter.Write( sOutput ); + sOutput.Close(); +} + +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#"; @@ -227,6 +255,7 @@ void TiledRenderingTest::testOverlay( Office* pOffice ) } } } +#endif CPPUNIT_TEST_SUITE_REGISTRATION(TiledRenderingTest); |