diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-12-13 09:09:52 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-12-17 13:58:56 +0100 |
commit | 43a63b725208bfa378355011ea56cb936afa4411 (patch) | |
tree | f0d388cfb59c37e98ae8e2533d18ec649a5287ac /sw/qa/python | |
parent | 397195cd43249851bb89d0a2ba82ffdf975b7317 (diff) |
Allow setting some MediaDescriptor properties during runtime
Change-Id: Id6bb554c0e165c6d1f9c28c48fdbcd7156f42316
Reviewed-on: https://gerrit.libreoffice.org/65256
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sw/qa/python')
-rw-r--r-- | sw/qa/python/check_xmodel.py | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/sw/qa/python/check_xmodel.py b/sw/qa/python/check_xmodel.py new file mode 100644 index 000000000000..c5374c03c350 --- /dev/null +++ b/sw/qa/python/check_xmodel.py @@ -0,0 +1,59 @@ +#! /usr/bin/env python +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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/. +# +import unittest +import unohelper +from org.libreoffice.unotest import UnoInProcess +from com.sun.star.lang import IllegalArgumentException +from com.sun.star.beans import PropertyValue +import uno + + +class TestXModel(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls._uno = UnoInProcess() + cls._uno.setUp() + + @classmethod + def tearDownClass(cls): + cls._uno.tearDown() + + def test_setArgs_valid(self): + xDoc = self._uno.openEmptyWriterDoc() + self.assertIsNotNone(xDoc) + + p1 = PropertyValue(Name="SuggestedSaveAsName", Value="prettyFileName") + p2 = PropertyValue(Name="SuggestedSaveAsDir", Value="/my/dir") + xDoc.setArgs([p1, p2]) + + # Make sure that all properties are returned with getArgs() + args = xDoc.getArgs() + self.assertTrue(p1 in args) + self.assertTrue(p2 in args) + + xDoc.close(True) + + def test_setArgs_invalid(self): + xDoc = self._uno.openEmptyWriterDoc() + self.assertIsNotNone(xDoc) + + # IllegalArgumentException should be thrown when setting a non-existing property + p1 = PropertyValue(Name="PropertyNotExists", Value="doesntmatter") + with self.assertRaises(IllegalArgumentException): + xDoc.setArgs([p1]) + + xDoc.close(True) + + +if __name__ == '__main__': + unittest.main() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |