[Libreoffice-commits] core.git: writerperfect/Module_writerperfect.mk writerperfect/qa writerperfect/source writerperfect/UITest_writerperfect_epubexport.mk

Miklos Vajna vmiklos at collabora.co.uk
Thu Sep 21 20:23:07 UTC 2017


 writerperfect/Module_writerperfect.mk                 |    4 ++
 writerperfect/UITest_writerperfect_epubexport.mk      |   16 +++++++++
 writerperfect/qa/uitest/epubexport/epubexport.py      |   30 ++++++++++++++++++
 writerperfect/source/writer/EPUBExportUIComponent.cxx |    2 +
 4 files changed, 52 insertions(+)

New commits:
commit 9d98df77ec7b62e8847f5bad8c98983493018a4f
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Sep 21 18:16:46 2017 +0200

    writerperfect: add initial UITest_writerperfect_epubexport
    
    Fails when EPUBExportDialog::VersionSelectHdl() does not take the
    version from the VCL widget.
    
    Change-Id: I8f77643ffbd7766ecec7bc2e148259765ab635b8
    Reviewed-on: https://gerrit.libreoffice.org/42600
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/writerperfect/Module_writerperfect.mk b/writerperfect/Module_writerperfect.mk
index 015c3fdda44b..01f8a0dc5e59 100644
--- a/writerperfect/Module_writerperfect.mk
+++ b/writerperfect/Module_writerperfect.mk
@@ -47,4 +47,8 @@ $(eval $(call gb_Module_add_slowcheck_targets,writerperfect,\
 	Library_wpftqahelper \
 ))
 
+$(eval $(call gb_Module_add_uicheck_targets,writerperfect,\
+    UITest_writerperfect_epubexport \
+))
+
 # vim: set noet sw=4 ts=4:
diff --git a/writerperfect/UITest_writerperfect_epubexport.mk b/writerperfect/UITest_writerperfect_epubexport.mk
new file mode 100644
index 000000000000..ebec0bf7613d
--- /dev/null
+++ b/writerperfect/UITest_writerperfect_epubexport.mk
@@ -0,0 +1,16 @@
+# -*- 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_UITest_UITest,writerperfect_epubexport))
+
+$(eval $(call gb_UITest_add_modules,writerperfect_epubexport,$(SRCDIR)/writerperfect/qa/uitest,\
+	epubexport/ \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/writerperfect/qa/uitest/epubexport/epubexport.py b/writerperfect/qa/uitest/epubexport/epubexport.py
new file mode 100644
index 000000000000..67437b48f827
--- /dev/null
+++ b/writerperfect/qa/uitest/epubexport/epubexport.py
@@ -0,0 +1,30 @@
+#
+# 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/.
+#
+
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.framework import UITestCase
+
+
+def handleDialog(dialog):
+    # Select the second entry to request EPUB2, not EPUB3.
+    dialog.getChild("versionlb").executeAction("SELECT", mkPropertyValues({"POS": "1"}))
+    dialog.getChild("ok").executeAction("CLICK", tuple())
+
+
+# Test for EPUBExportDialog and EPUBExportUIComponent.
+class EPUBExportTest(UITestCase):
+
+    def testUIComponent(self):
+
+        uiComponent = self.ui_test._xContext.ServiceManager.createInstanceWithContext("com.sun.star.comp.Writer.EPUBExportUIComponent", self.ui_test._xContext)
+        self.ui_test.execute_blocking_action(action=uiComponent.execute, dialog_handler=handleDialog)
+        propertyValues = uiComponent.getPropertyValues()
+        filterData = [i.Value for i in propertyValues if i.Name == "FilterData"][0]
+        epubVersion = [i.Value for i in filterData if i.Name == "EPUBVersion"][0]
+        # This was 30, EPUBExportDialog::VersionSelectHdl() did not set the version.
+        self.assertEqual(20, epubVersion)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/writerperfect/source/writer/EPUBExportUIComponent.cxx b/writerperfect/source/writer/EPUBExportUIComponent.cxx
index 0be6aacc1ca8..b38ebf799859 100644
--- a/writerperfect/source/writer/EPUBExportUIComponent.cxx
+++ b/writerperfect/source/writer/EPUBExportUIComponent.cxx
@@ -74,6 +74,8 @@ void EPUBExportUIComponent::setTitle(const OUString &/*rTitle*/)
 
 sal_Int16 EPUBExportUIComponent::execute()
 {
+    SolarMutexGuard aGuard;
+
     ScopedVclPtrInstance<EPUBExportDialog> pDialog(Application::GetDefDialogParent(), maFilterData);
     if (pDialog->Execute() == RET_OK)
         return ui::dialogs::ExecutableDialogResults::OK;


More information about the Libreoffice-commits mailing list