[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - 2 commits - desktop/source libreofficekit/CppunitTest_libreofficekit_tiledrendering.mk libreofficekit/Module_libreofficekit.mk libreofficekit/qa
Miklos Vajna
vmiklos at collabora.co.uk
Tue Mar 3 02:58:57 PST 2015
desktop/source/app/check_ext_deps.cxx | 6 -
libreofficekit/CppunitTest_libreofficekit_tiledrendering.mk | 5
libreofficekit/Module_libreofficekit.mk | 6 -
libreofficekit/qa/unit/tiledrendering.cxx | 61 ++++++++----
4 files changed, 52 insertions(+), 26 deletions(-)
New commits:
commit 5f94189a4099a2bf043d1fab6b888dccad333c7a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Mar 3 11:13:32 2015 +0100
CppunitTest_libreofficekit_tiledrendering: fix up and enable this again
The main problem was that UserInstallation did not point to the usual
workdir/unittest/, so initialization failed early, not finding the
soffice.cfg directory under
workdir/CppunitTest/libreofficekit_tiledrendering.test.user/.
Disable one testcase that still fails, though.
Change-Id: I3fdae5ead47dd2a805a0ed8d3cb407938f868e3b
diff --git a/libreofficekit/CppunitTest_libreofficekit_tiledrendering.mk b/libreofficekit/CppunitTest_libreofficekit_tiledrendering.mk
index acc708f..783074f 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 fe5ee15..ad2064f 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 0b9b288..44f1bed 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);
commit c6f19ef1f439ca67c76298899059a429a1b35326
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Mar 3 11:03:21 2015 +0100
desktop: avoid restart when running in a LOK unit test
Cppunit tests just don't run the desktop logic to determine whether to
restart normally, but for LOK, that happens. Without this, if versionrc
changes, a LOK-using unit test would fail. Simple reproducer:
sed -i "s|\(buildid=\).*|\1$(echo $RANDOM|sha1sum -|sed 's/ .*//')|" instdir/program/versionrc
make -sr CppunitTest_libreofficekit_tiledrendering
Should be an acceptable alternative approach to commit
5acadbfb0c79fe51f8025b065b46b0ccd25c804d (Implement lokconf_init.,
2014-07-21).
Change-Id: I4354e646d3bcc0c1199db5a175708206b4a30294
diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx
index ad2d72b..2ddbf04 100644
--- a/desktop/source/app/check_ext_deps.cxx
+++ b/desktop/source/app/check_ext_deps.cxx
@@ -422,8 +422,10 @@ void Desktop::SynchronizeExtensionRepositories()
deployment::ExtensionManager::get(context)->reinstallDeployedExtensions(
true, "user", Reference<task::XAbortChannel>(), silent);
#if !HAVE_FEATURE_MACOSX_SANDBOX
- task::OfficeRestartManager::get(context)->requestRestart(
- silent->getInteractionHandler());
+ // getenv is a hack to detect if we're running in a LOK unit test
+ if (!getenv("LOK_TEST"))
+ task::OfficeRestartManager::get(context)->requestRestart(
+ silent->getInteractionHandler());
#endif
} else {
// reinstallDeployedExtensions above already calls syncRepositories
More information about the Libreoffice-commits
mailing list