[Libreoffice-commits] core.git: Branch 'feature/calctiledrendering4' - 5 commits - desktop/source libreofficekit/CppunitTest_libreofficekit_tiledrendering.mk libreofficekit/Executable_lokconf_init.mk libreofficekit/Module_libreofficekit.mk libreofficekit/qa Repository.mk solenv/gbuild

Andrzej Hunt andrzej.hunt at collabora.com
Mon Jul 21 10:52:15 PDT 2014


 Repository.mk                                               |    1 
 desktop/source/app/app.cxx                                  |    2 
 libreofficekit/CppunitTest_libreofficekit_tiledrendering.mk |    3 
 libreofficekit/Executable_lokconf_init.mk                   |   42 ++++++++++++
 libreofficekit/Module_libreofficekit.mk                     |    1 
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx         |    4 +
 libreofficekit/qa/lokconf_init/lokconf_init.cxx             |   41 +++++++++++
 solenv/gbuild/CppunitTest.mk                                |    8 ++
 8 files changed, 100 insertions(+), 2 deletions(-)

New commits:
commit dc1c9770671e0475cc758ccc23df5a1eb8a4337d
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Mon Jul 21 19:46:16 2014 +0200

    DON'T USE: ignore unknown args instead of failure.
    
    The --protector flag ends up here in unit tests, which causes things
    to fail -- either we need to make --protector known, or filter
    it out before hand -- whereby I suspect filtering it out would be
    difficult to do in a reliable fashion.
    
    Change-Id: Iab47a6e24723604df75def2b963e82ba6479318e

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index a2df758..e9098c2 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -656,7 +656,7 @@ void Desktop::Init()
             // 2nd office startup should terminate after sending cmdlineargs through pipe
             SetBootstrapStatus(BS_TERMINATE);
         }
-        else if ( !rCmdLineArgs.GetUnknown().isEmpty()
+        else if ( (!rCmdLineArgs.GetUnknown().isEmpty() && false)
                   || rCmdLineArgs.IsHelp() || rCmdLineArgs.IsVersion() )
         {
             // disable IPC thread in an instance that is just showing a help message
commit 3a5a4689c102e375c8d30e2498b73fd449d1cb32
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Mon Jul 21 19:39:49 2014 +0200

    gtktiledviewer: make sure we clean up the office instance.
    
    Change-Id: I12c3e9df8b8fcf8dcd6fb5fa781c2f7c10ab0a0c

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 74661f1..27227b4 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -226,5 +226,9 @@ int main( int argc, char* argv[] )
 
     gtk_main();
 
+    pOffice->pClass->destroy( pOffice );
+
     return 0;
 }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit d28e19069c065ba74f31834142f7eca88a25c9e2
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Mon Jul 21 19:36:11 2014 +0200

    Use gb_CppunitTest_use_confpreinit for LOK tiled rendering.
    
    Now that we use the event loop for LOK we need to make sure that
    it is able to run successfully first time, as unit tests start
    with a completely clean config.
    
    Change-Id: If9ddcb75fe8286381d71ecdc76ac7eb3697960d0

diff --git a/libreofficekit/CppunitTest_libreofficekit_tiledrendering.mk b/libreofficekit/CppunitTest_libreofficekit_tiledrendering.mk
index 4b77fbf..9159a24 100644
--- a/libreofficekit/CppunitTest_libreofficekit_tiledrendering.mk
+++ b/libreofficekit/CppunitTest_libreofficekit_tiledrendering.mk
@@ -29,7 +29,6 @@ $(eval $(call gb_CppunitTest_use_libraries,libreofficekit_tiledrendering, \
 	$(gb_UWINAPI) \
 ))
 
-
 # 	unotest \
 
 ifeq ($(OS),LINUX)
@@ -54,4 +53,6 @@ $(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:
commit f8a1d9d6c363140a316a5d2e0f5562127799b93d
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Mon Jul 21 19:35:13 2014 +0200

    Add gb_CppunitTest_use_confpreinit:
    
    For unit tests that use the VCL event loop we can use this to
    avoid the otherwise required restart.
    
    Change-Id: I48265d7e7188a4efaa6f87432c762320331c0c78

diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index 622e16d..137a347 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -75,6 +75,8 @@ $(call gb_CppunitTest_get_target,%) :| $(gb_CppunitTest_CPPTESTDEPS)
 	$(call gb_Helper_abbreviate_dirs,\
 		mkdir -p $(dir $@) && \
 		rm -fr $@.user && mkdir $@.user && \
+		$(if $(gb_CppunitTest__use_confpreinit), \
+		    $(INSTDIR)/program/lokconf_init $(call gb_CppunitTest__make_args) &&) \
 		$(if $(gb_CppunitTest__interactive),, \
 			$(if $(value gb_CppunitTest_postprocess), \
 				rm -fr $@.core && mkdir $@.core && cd $@.core &&)) \
@@ -165,6 +167,12 @@ endif
 
 endef
 
+define gb_CppunitTest_use_confpreinit
+$(call gb_CppunitTest_use_executable,$(1),lokconf_init)
+$(call gb_CppunitTest_get_target,$(1)) : gb_CppunitTest__use_confpreinit := TRUE
+
+endef
+
 define gb_CppunitTest_use_vcl
 $(call gb_CppunitTest__use_vcl,$(1),$(true))
 
commit 3789f4d80d5401df80a356daf081541e488861e4
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Mon Jul 21 19:34:09 2014 +0200

    Implement lokconf_init.
    
    This is a simple executable which can be used to ensure there is a
    pe-pared configuration for unit-tests to avoid the usually required
    re-start on the first run.
    
    Change-Id: I49b706e8daa93bc34db508a24615b63b9babddba

diff --git a/Repository.mk b/Repository.mk
index 53d124b..cf99b2a 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -101,6 +101,7 @@ $(eval $(call gb_Helper_register_executables,OOO, \
 	uri-encode \
 	ui-previewer \
 	tiledrendering \
+	$(if $(filter LINUX,$(OS)), lokconf_init) \
 	$(if $(and $(ENABLE_GTK), $(filter LINUX,$(OS))), gtktiledviewer) \
 	$(if $(filter DESKTOP,$(BUILD_TYPE)),unopkg_bin) \
 	xpdfimport \
diff --git a/libreofficekit/Executable_lokconf_init.mk b/libreofficekit/Executable_lokconf_init.mk
new file mode 100644
index 0000000..3e25f13
--- /dev/null
+++ b/libreofficekit/Executable_lokconf_init.mk
@@ -0,0 +1,42 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Executable_Executable,lokconf_init))
+
+$(eval $(call gb_Executable_set_include,lokconf_init,\
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_Executable_use_libraries,lokconf_init, \
+	cppu \
+	sal \
+))
+
+$(eval $(call gb_Executable_use_static_libraries,lokconf_init,\
+    libreofficekit \
+))
+
+$(eval $(call gb_Executable_add_libs,lokconf_init,\
+    -lSM \
+    -lICE \
+))
+
+ifeq ($(OS),LINUX)
+$(eval $(call gb_Executable_add_libs,lokconf_init,\
+    -lm \
+    -ldl \
+    -lpthread \
+))
+endif
+
+$(eval $(call gb_Executable_add_exception_objects,lokconf_init,\
+    libreofficekit/qa/lokconf_init/lokconf_init \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/libreofficekit/Module_libreofficekit.mk b/libreofficekit/Module_libreofficekit.mk
index 2d9b98c..071ea93 100644
--- a/libreofficekit/Module_libreofficekit.mk
+++ b/libreofficekit/Module_libreofficekit.mk
@@ -13,6 +13,7 @@ ifeq ($(OS),LINUX)
 
 $(eval $(call gb_Module_add_targets,libreofficekit,\
     StaticLibrary_libreofficekit \
+    Executable_lokconf_init \
 ))
 
 $(eval $(call gb_Module_add_check_targets,libreofficekit,\
diff --git a/libreofficekit/qa/lokconf_init/lokconf_init.cxx b/libreofficekit/qa/lokconf_init/lokconf_init.cxx
new file mode 100644
index 0000000..9677159
--- /dev/null
+++ b/libreofficekit/qa/lokconf_init/lokconf_init.cxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <stdio.h>
+#include <string>
+#include <string.h>
+
+#include <sal/main.h>
+
+#include <LibreOfficeKit/LibreOfficeKit.h>
+
+using namespace std;
+
+// Using SAL_IMPLEMENT_MAIN means that we can directly use the same
+// arguments as would be provided to cppunittester, i.e. ensuring
+// that we're operating with the correct directories etc.
+SAL_IMPLEMENT_MAIN()
+{
+    string sPath( getenv("INSTDIR") );
+    sPath += "/program";
+
+    LibreOfficeKit* pOffice = lok_init( sPath.c_str() );
+
+    // As this is the first init, pOffice should be NULL.
+    // However there's no reason we shouldn't be able to operate
+    // even if it isn't the first init.
+    if ( pOffice )
+    {
+        pOffice->pClass->destroy( pOffice );
+        pOffice = 0;
+    }
+    return 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list