diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-09-25 18:10:31 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-09-26 09:04:46 +0200 |
commit | 07fd83987a38edb21fc7a8b7d7efe44e0a25e347 (patch) | |
tree | c9d5bd2c8c992c3cb108880594c2c489d44dcef9 /writerperfect | |
parent | 423ee1020afe1bca896f2ecfc67ffbd49db5081c (diff) |
EPUB export: add testcase for EPUBExportUIComponent::setPropertyValues()
Making sure python produces sequence<PropertyValue> and not
sequence<any> is a bit tricky.
Change-Id: I1f3ee4664202576ab6777b719b3712b164c5002d
Reviewed-on: https://gerrit.libreoffice.org/42759
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerperfect')
-rw-r--r-- | writerperfect/qa/uitest/epubexport/epubexport.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/writerperfect/qa/uitest/epubexport/epubexport.py b/writerperfect/qa/uitest/epubexport/epubexport.py index 67437b48f827..d5109a4bd395 100644 --- a/writerperfect/qa/uitest/epubexport/epubexport.py +++ b/writerperfect/qa/uitest/epubexport/epubexport.py @@ -4,8 +4,10 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # +from com.sun.star.beans import PropertyValue from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.framework import UITestCase +import uno def handleDialog(dialog): @@ -20,6 +22,13 @@ class EPUBExportTest(UITestCase): def testUIComponent(self): uiComponent = self.ui_test._xContext.ServiceManager.createInstanceWithContext("com.sun.star.comp.Writer.EPUBExportUIComponent", self.ui_test._xContext) + + # Make sure we get what we asked for. + self.assertEqual("com.sun.star.comp.Writer.EPUBExportUIComponent", uiComponent.getImplementationName()) + self.assertEqual(True, uiComponent.supportsService("com.sun.star.ui.dialogs.FilterOptionsDialog")) + # Just make sure this doesn't fail. + uiComponent.setTitle(str()) + 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] @@ -27,4 +36,21 @@ class EPUBExportTest(UITestCase): # This was 30, EPUBExportDialog::VersionSelectHdl() did not set the version. self.assertEqual(20, epubVersion) + def testCustomProperties(self): + uiComponent = self.ui_test._xContext.ServiceManager.createInstanceWithContext("com.sun.star.comp.Writer.EPUBExportUIComponent", self.ui_test._xContext) + + # Make sure that by default the version is not altered. + propertyValues = uiComponent.getPropertyValues() + filterData = [i.Value for i in propertyValues if i.Name == "FilterData"][0] + self.assertEqual(0, len([i.Value for i in filterData if i.Name == "EPUBVersion"])) + + # But if we set it explicitly, then it's retained, even without interacting with the UI. + filterData = (PropertyValue(Name="EPUBVersion", Value=30),) + propertyValues = (PropertyValue(Name="FilterData", Value=uno.Any("[]com.sun.star.beans.PropertyValue", filterData)),) + uiComponent.setPropertyValues(propertyValues) + 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] + self.assertEqual(30, epubVersion) + # vim: set shiftwidth=4 softtabstop=4 expandtab: |