[Libreoffice-commits] core.git: 5 commits - chart2/source uitest/calc_tests uitest/demo_ui uitest/libreoffice uitest/test_main.py uitest/uitest xmloff/source

Markus Mohrhard markus.mohrhard at googlemail.com
Tue Oct 11 02:19:15 UTC 2016


 chart2/source/controller/main/ChartController.cxx |    4 +-
 uitest/calc_tests/tdf96453.py                     |    9 ++----
 uitest/demo_ui/handle_multiple_files.py           |    9 +-----
 uitest/libreoffice/connection.py                  |    3 ++
 uitest/test_main.py                               |    2 -
 uitest/uitest/path.py                             |   31 ++++++++++++++++++++++
 xmloff/source/chart/PropertyMaps.cxx              |   11 ++++++-
 7 files changed, 51 insertions(+), 18 deletions(-)

New commits:
commit 49b50720880b3c6b685568b998282b2b394f2913
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Oct 11 04:13:13 2016 +0200

    make it easier to read the logs
    
    Not yet perfect but already better.
    
    Change-Id: I5309947333aa2cce6526335b603ef316226e490c

diff --git a/uitest/test_main.py b/uitest/test_main.py
index 7dcbb3b..b3aad3c 100644
--- a/uitest/test_main.py
+++ b/uitest/test_main.py
@@ -106,7 +106,7 @@ if __name__ == '__main__':
     if "-d" in opts or "--debug" in opts:
         uitest.config.use_sleep = True
 
-    result = unittest.TextTestRunner(verbosity=2).run(test_suite)
+    result = unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run(test_suite)
     print("Tests run: %d" % result.testsRun)
     print("Tests failed: %d" % len(result.failures))
     print("Tests errors: %d" % len(result.errors))
commit 74bf4ca9f382fa12481fda18b57cdce4c0d5422b
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Oct 11 04:11:53 2016 +0200

    avoid infinite loop if the instance stopped already
    
    Change-Id: I03f78e592f3f182f34ea05829131357cabcc4c7b

diff --git a/uitest/libreoffice/connection.py b/uitest/libreoffice/connection.py
index a39b42f..7b36479 100644
--- a/uitest/libreoffice/connection.py
+++ b/uitest/libreoffice/connection.py
@@ -74,6 +74,9 @@ class OfficeConnection:
         url = "uno:" + socket + ";urp;StarOffice.ComponentContext"
         print("OfficeConnection: connecting to: " + url)
         while True:
+            if self.soffice.poll() is not None:
+                raise Exception("soffice has stopped.")
+
             try:
                 xContext = xUnoResolver.resolve(url)
                 return xContext
commit f6624944219da151c10c3c8b5decaa0abbef1b45
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Oct 11 04:09:46 2016 +0200

    pathlib is only in python 3.4+
    
    We still use 3.3 on windows.
    
    Change-Id: I32adabe1eb12d8803d61458fcb1a228b3ff045e0

diff --git a/uitest/calc_tests/tdf96453.py b/uitest/calc_tests/tdf96453.py
index 020b901..fb8e404 100644
--- a/uitest/calc_tests/tdf96453.py
+++ b/uitest/calc_tests/tdf96453.py
@@ -11,16 +11,13 @@ import os
 import pathlib
 
 from uitest.uihelper.common import get_state_as_dict
+from uitest.path import get_srcdir_url
+
 from libreoffice.calc.document import get_sheet_from_doc
 from libreoffice.calc.conditional_format import get_conditional_format_from_sheet
 
-def get_data_dir():
-    current_dir = os.path.dirname(os.path.realpath(__file__))
-    return os.path.join(current_dir, "data")
-
 def get_url_for_data_file(file_name):
-    path = os.path.join(get_data_dir(), file_name)
-    return pathlib.Path(path).as_uri()
+    return get_srcdir_url() + "/uitest/calc_tests/data/" + file_name
 
 class ConditionalFormatDlgTest(UITestCase):
 
diff --git a/uitest/demo_ui/handle_multiple_files.py b/uitest/demo_ui/handle_multiple_files.py
index ab56c55..dd4cba7 100644
--- a/uitest/demo_ui/handle_multiple_files.py
+++ b/uitest/demo_ui/handle_multiple_files.py
@@ -11,18 +11,13 @@ from libreoffice.uno.eventlistener import EventListener
 from uitest.framework import UITestCase
 
 from uitest.debug import sleep
+from uitest.path import get_srcdir_url
 
 import time
 import os
-import pathlib
-
-def get_data_dir():
-    current_dir = os.path.dirname(os.path.realpath(__file__))
-    return os.path.join(current_dir, "data")
 
 def get_url_for_data_file(file_name):
-    path = os.path.join(get_data_dir(), file_name)
-    return pathlib.Path(path).as_uri()
+    return get_srcdir_url() + "/uitest/demo_ui/data/" + file_name
 
 class HandleFiles(UITestCase):
 
diff --git a/uitest/uitest/path.py b/uitest/uitest/path.py
new file mode 100644
index 0000000..19eea2a
--- /dev/null
+++ b/uitest/uitest/path.py
@@ -0,0 +1,31 @@
+# -*- Mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+#
+# 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/.
+#
+
+import os
+from urllib.parse import urljoin
+from urllib.request import pathname2url
+
+def get_src_dir_fallback():
+    current_dir = os.path.dirname(os.path.realpath(__file__))
+    return os.path.abspath(os.path.join(current_dir, "../../"))
+
+def path2url(path):
+        return urljoin('file:', pathname2url(path))
+
+def get_workdir_url():
+    workdir_path = os.environ.get('WORKDIR', os.path.join(get_src_dir_fallback(), 'workdir'))
+    return path2url(workdir_path)
+
+def get_srcdir_url():
+    srcdir_path = os.environ.get('SRCDIR', get_src_dir_fallback())
+    return path2url(srcdir_path)
+
+def get_instdir_url():
+    instdir_path = os.environ.get('INSTDIR', os.path.join(get_src_dir_fallback(), 'instdir'))
+    return path2url(instdir_path)
+
+# vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 0ab45be62bc1ffcbdd13aca7375fdcd1bbccb79a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Oct 10 00:58:42 2016 +0200

    catch the exception to prevent broken charts, tdf#98690
    
    Change-Id: I5958c87ca793c19d5c78dc829eb0ff0a1e04dffa

diff --git a/xmloff/source/chart/PropertyMaps.cxx b/xmloff/source/chart/PropertyMaps.cxx
index 72dcf2c..30ff2a6 100644
--- a/xmloff/source/chart/PropertyMaps.cxx
+++ b/xmloff/source/chart/PropertyMaps.cxx
@@ -360,8 +360,15 @@ OUString convertRange( const OUString & rRange, const uno::Reference< chart2::XC
         return aResult;
     uno::Reference< chart2::data::XRangeXMLConversion > xConversion(
         xDoc->getDataProvider(), uno::UNO_QUERY );
-    if( xConversion.is())
-        aResult = xConversion->convertRangeToXML( rRange );
+    try
+    {
+        if( xConversion.is())
+            aResult = xConversion->convertRangeToXML( rRange );
+    }
+    catch (css::lang::IllegalArgumentException&)
+    {
+    }
+
     return aResult;
 }
 
commit c3cc9429d136178996d797ef8fd6d740b39cc94e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Oct 9 00:57:13 2016 +0200

    avoid crashes on broken charts, related tdf#98690
    
    Change-Id: If81f963babc15fc549d9daa904fd9836ea02ecef

diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 0f9dd7c..1e2de86 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -309,7 +309,7 @@ OUString ChartController::GetContextName()
 
     ObjectType eObjectID = ObjectIdentifier::getObjectType(aCID);
 
-    css::uno::Reference<css::chart2::XChartType> xChartType = getChartType(css::uno::Reference<css::chart2::XChartDocument>(getModel(), uno::UNO_QUERY_THROW));
+    css::uno::Reference<css::chart2::XChartType> xChartType = getChartType(css::uno::Reference<css::chart2::XChartDocument>(getModel(), uno::UNO_QUERY));
     switch (eObjectID)
     {
         case OBJECTTYPE_DATA_SERIES:
@@ -324,7 +324,7 @@ OUString ChartController::GetContextName()
         case OBJECTTYPE_GRID:
             return OUString("Grid");
         case OBJECTTYPE_DIAGRAM:
-            if (xChartType->getChartType() == "com.sun.star.chart2.PieChartType")
+            if (xChartType.is() && xChartType->getChartType() == "com.sun.star.chart2.PieChartType")
                 return OUString("ChartElements");
             break;
         case OBJECTTYPE_DATA_CURVE:


More information about the Libreoffice-commits mailing list