diff options
author | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-10-03 16:54:13 +0200 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-10-03 16:54:13 +0200 |
commit | 60de083e9f8d2f3b7e5a475cd94d165844ac6faa (patch) | |
tree | da99b73d3c046db64550161d07bb1b8c675f20d6 /sw/qa | |
parent | 006b023184afddf072979d2c8e2c08484780877d (diff) |
fix DOS lineends
Change-Id: Ib6ec8c705beaf97293bd761fa74e66535733121e
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/python/check_xmodifiable2.py | 390 | ||||
-rw-r--r-- | sw/qa/python/check_xrefreshable.py | 220 |
2 files changed, 305 insertions, 305 deletions
diff --git a/sw/qa/python/check_xmodifiable2.py b/sw/qa/python/check_xmodifiable2.py index e8b95dc2b329..53082fc2865e 100644 --- a/sw/qa/python/check_xmodifiable2.py +++ b/sw/qa/python/check_xmodifiable2.py @@ -1,195 +1,195 @@ -#! /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
-from org.libreoffice.unotest import UnoInProcess
-
-
-class XModifiable2(unittest.TestCase):
-
- @classmethod
- def setUpClass(cls):
- cls._uno = UnoInProcess()
- cls._uno.setUp()
-
- @classmethod
- def tearDownClass(cls):
- cls._uno.tearDown()
-
- def test_XModifiable2(self):
- # initialization
- xDoc = self._uno.openEmptyWriterDoc()
-
- # perform unit test
- self.assertTrue(xDoc.isSetModifiedEnabled())
-
- self.assertTrue(xDoc.disableSetModified())
- self.assertFalse(xDoc.isSetModifiedEnabled())
-
- self.assertFalse(xDoc.enableSetModified())
- self.assertTrue(xDoc.isSetModifiedEnabled())
-
- # clean up
- xDoc.close(True)
-
- def test_XModifiable2_Double(self):
- # initialization
- xDoc = self._uno.openEmptyWriterDoc()
-
- # perform unit test
- self.assertTrue(xDoc.isSetModifiedEnabled())
-
- # try to disable
- # Expected return value:
- # `TRUE` the changing of the modified state was disabled
- self.assertTrue(xDoc.disableSetModified())
- self.assertFalse(xDoc.isSetModifiedEnabled())
-
- # try to disable twice
- # Expected return value:
- # `FALSE` the changing of the modified state was already disabled
- self.assertFalse(xDoc.disableSetModified())
- self.assertFalse(xDoc.isSetModifiedEnabled())
-
- # try to disable third time
- # Expected return value:
- # `FALSE` the changing of the modified state was already disabled
- # i.e. the same as in previous call
- self.assertFalse(xDoc.disableSetModified())
- self.assertFalse(xDoc.isSetModifiedEnabled())
-
- # try to enable
- # Expected return value:
- # `FALSE` the changing of the modified state was enabled
- self.assertFalse(xDoc.enableSetModified())
- self.assertTrue(xDoc.isSetModifiedEnabled())
-
- # try to enable twice
- # Expected return value:
- # `TRUE` the changing of the modified state was already enabled
- self.assertTrue(xDoc.enableSetModified())
- self.assertTrue(xDoc.isSetModifiedEnabled())
-
- # try to enable third time
- # Expected return value:
- # `TRUE` the changing of the modified state was already enabled
- # i.e. the same as in previous call
- self.assertTrue(xDoc.enableSetModified())
- self.assertTrue(xDoc.isSetModifiedEnabled())
-
- # clean up
- xDoc.close(True)
-
- def test_XModifiable2_setModified(self):
- # initialization
- xDoc = self._uno.openEmptyWriterDoc()
-
- # perform unit test
- # try to set modified flag when modification enabled
- self.assertTrue(xDoc.isSetModifiedEnabled())
-
- self.assertFalse(xDoc.isModified())
- xDoc.setModified(True)
- self.assertTrue(xDoc.isModified())
-
- xDoc.setModified(False)
- self.assertFalse(xDoc.isModified())
-
- # try to set modified flag when modification disabled
- self.assertTrue(xDoc.disableSetModified())
- self.assertFalse(xDoc.isSetModifiedEnabled())
-
- self.assertFalse(xDoc.isModified())
- xDoc.setModified(True)
- self.assertFalse(xDoc.isModified())
-
- self.assertFalse(xDoc.enableSetModified())
- self.assertTrue(xDoc.isSetModifiedEnabled())
-
- # document is still not modified
- self.assertFalse(xDoc.isModified())
-
- # try to set modified flag when modification enabled
- # and when we have changed the modification possibility
- self.assertTrue(xDoc.isSetModifiedEnabled())
-
- self.assertFalse(xDoc.isModified())
- xDoc.setModified(True)
- self.assertTrue(xDoc.isModified())
-
- xDoc.setModified(False)
- self.assertFalse(xDoc.isModified())
-
- # clean up
- xDoc.close(True)
-
- def test_setModified_ByContent(self):
- # initialization
- xDoc = self._uno.openEmptyWriterDoc()
-
- # perform unit test:
- # set modified flag using text editing
- # when modification of the flag is enabled
- self.assertTrue(xDoc.isSetModifiedEnabled())
- self.assertFalse(xDoc.isModified())
-
- cursor = xDoc.Text.createTextCursor()
- xDoc.Text.insertString(cursor, "The first paragraph", 0)
-
- self.assertTrue(xDoc.isSetModifiedEnabled())
- self.assertTrue(xDoc.isModified())
-
- # clean up
- xDoc.close(True)
-
- def test_setModified_ByContent_Blocked(self):
- # initialization
- xDoc = self._uno.openEmptyWriterDoc()
-
- # perform unit test:
- # it is unable to set modified flag using text editing
- # when modification of the flag was disabled
- self.assertTrue(xDoc.disableSetModified())
- self.assertFalse(xDoc.isSetModifiedEnabled())
- self.assertFalse(xDoc.isModified())
-
- cursor = xDoc.Text.createTextCursor()
- xDoc.Text.insertString(cursor, "The first paragraph", 0)
-
- self.assertFalse(xDoc.isSetModifiedEnabled())
- self.assertFalse(xDoc.isModified())
-
- # clean up
- xDoc.close(True)
-
- def test_WriteProtectedDocument(self):
- # initialization
- xDoc = self._uno.openTemplateFromTDOC('WriteProtected.odt')
-
- # perform unit test:
- # it is unable to set modified flag using text editing
- # when modification of the flag was disabled as
- # ODT file was marked to be opened as read-only
- self.assertFalse(xDoc.isSetModifiedEnabled())
- self.assertFalse(xDoc.isModified())
-
- cursor = xDoc.Text.createTextCursor()
- xDoc.Text.insertString(cursor, "The first paragraph", 0)
-
- self.assertFalse(xDoc.isSetModifiedEnabled())
- self.assertFalse(xDoc.isModified())
-
- # clean up
- xDoc.close(True)
-
-
-if __name__ == '__main__':
- unittest.main()
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
+#! /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 +from org.libreoffice.unotest import UnoInProcess + + +class XModifiable2(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls._uno = UnoInProcess() + cls._uno.setUp() + + @classmethod + def tearDownClass(cls): + cls._uno.tearDown() + + def test_XModifiable2(self): + # initialization + xDoc = self._uno.openEmptyWriterDoc() + + # perform unit test + self.assertTrue(xDoc.isSetModifiedEnabled()) + + self.assertTrue(xDoc.disableSetModified()) + self.assertFalse(xDoc.isSetModifiedEnabled()) + + self.assertFalse(xDoc.enableSetModified()) + self.assertTrue(xDoc.isSetModifiedEnabled()) + + # clean up + xDoc.close(True) + + def test_XModifiable2_Double(self): + # initialization + xDoc = self._uno.openEmptyWriterDoc() + + # perform unit test + self.assertTrue(xDoc.isSetModifiedEnabled()) + + # try to disable + # Expected return value: + # `TRUE` the changing of the modified state was disabled + self.assertTrue(xDoc.disableSetModified()) + self.assertFalse(xDoc.isSetModifiedEnabled()) + + # try to disable twice + # Expected return value: + # `FALSE` the changing of the modified state was already disabled + self.assertFalse(xDoc.disableSetModified()) + self.assertFalse(xDoc.isSetModifiedEnabled()) + + # try to disable third time + # Expected return value: + # `FALSE` the changing of the modified state was already disabled + # i.e. the same as in previous call + self.assertFalse(xDoc.disableSetModified()) + self.assertFalse(xDoc.isSetModifiedEnabled()) + + # try to enable + # Expected return value: + # `FALSE` the changing of the modified state was enabled + self.assertFalse(xDoc.enableSetModified()) + self.assertTrue(xDoc.isSetModifiedEnabled()) + + # try to enable twice + # Expected return value: + # `TRUE` the changing of the modified state was already enabled + self.assertTrue(xDoc.enableSetModified()) + self.assertTrue(xDoc.isSetModifiedEnabled()) + + # try to enable third time + # Expected return value: + # `TRUE` the changing of the modified state was already enabled + # i.e. the same as in previous call + self.assertTrue(xDoc.enableSetModified()) + self.assertTrue(xDoc.isSetModifiedEnabled()) + + # clean up + xDoc.close(True) + + def test_XModifiable2_setModified(self): + # initialization + xDoc = self._uno.openEmptyWriterDoc() + + # perform unit test + # try to set modified flag when modification enabled + self.assertTrue(xDoc.isSetModifiedEnabled()) + + self.assertFalse(xDoc.isModified()) + xDoc.setModified(True) + self.assertTrue(xDoc.isModified()) + + xDoc.setModified(False) + self.assertFalse(xDoc.isModified()) + + # try to set modified flag when modification disabled + self.assertTrue(xDoc.disableSetModified()) + self.assertFalse(xDoc.isSetModifiedEnabled()) + + self.assertFalse(xDoc.isModified()) + xDoc.setModified(True) + self.assertFalse(xDoc.isModified()) + + self.assertFalse(xDoc.enableSetModified()) + self.assertTrue(xDoc.isSetModifiedEnabled()) + + # document is still not modified + self.assertFalse(xDoc.isModified()) + + # try to set modified flag when modification enabled + # and when we have changed the modification possibility + self.assertTrue(xDoc.isSetModifiedEnabled()) + + self.assertFalse(xDoc.isModified()) + xDoc.setModified(True) + self.assertTrue(xDoc.isModified()) + + xDoc.setModified(False) + self.assertFalse(xDoc.isModified()) + + # clean up + xDoc.close(True) + + def test_setModified_ByContent(self): + # initialization + xDoc = self._uno.openEmptyWriterDoc() + + # perform unit test: + # set modified flag using text editing + # when modification of the flag is enabled + self.assertTrue(xDoc.isSetModifiedEnabled()) + self.assertFalse(xDoc.isModified()) + + cursor = xDoc.Text.createTextCursor() + xDoc.Text.insertString(cursor, "The first paragraph", 0) + + self.assertTrue(xDoc.isSetModifiedEnabled()) + self.assertTrue(xDoc.isModified()) + + # clean up + xDoc.close(True) + + def test_setModified_ByContent_Blocked(self): + # initialization + xDoc = self._uno.openEmptyWriterDoc() + + # perform unit test: + # it is unable to set modified flag using text editing + # when modification of the flag was disabled + self.assertTrue(xDoc.disableSetModified()) + self.assertFalse(xDoc.isSetModifiedEnabled()) + self.assertFalse(xDoc.isModified()) + + cursor = xDoc.Text.createTextCursor() + xDoc.Text.insertString(cursor, "The first paragraph", 0) + + self.assertFalse(xDoc.isSetModifiedEnabled()) + self.assertFalse(xDoc.isModified()) + + # clean up + xDoc.close(True) + + def test_WriteProtectedDocument(self): + # initialization + xDoc = self._uno.openTemplateFromTDOC('WriteProtected.odt') + + # perform unit test: + # it is unable to set modified flag using text editing + # when modification of the flag was disabled as + # ODT file was marked to be opened as read-only + self.assertFalse(xDoc.isSetModifiedEnabled()) + self.assertFalse(xDoc.isModified()) + + cursor = xDoc.Text.createTextCursor() + xDoc.Text.insertString(cursor, "The first paragraph", 0) + + self.assertFalse(xDoc.isSetModifiedEnabled()) + self.assertFalse(xDoc.isModified()) + + # clean up + xDoc.close(True) + + +if __name__ == '__main__': + unittest.main() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/python/check_xrefreshable.py b/sw/qa/python/check_xrefreshable.py index 2d79a947ad1a..0b7b89652c9e 100644 --- a/sw/qa/python/check_xrefreshable.py +++ b/sw/qa/python/check_xrefreshable.py @@ -1,110 +1,110 @@ -#! /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.util import XRefreshListener
-
-
-refreshed = 0
-
-
-class XRefreshListenerExtended(unohelper.Base, XRefreshListener):
- @classmethod
- def refreshed(self, Event):
- global refreshed
- refreshed += 1
-
- @classmethod
- def disposing(self, event):
- pass
-
-
-class XRefreshable(unittest.TestCase):
-
- @classmethod
- def setUpClass(cls):
- cls._uno = UnoInProcess()
- cls._uno.setUp()
-
- @classmethod
- def tearDownClass(cls):
- cls._uno.tearDown()
-
- def test_None(self):
- global refreshed
- refreshed = 0
- xDoc = self._uno.openEmptyWriterDoc()
-
- # attempt to add/remove none
- xDoc.addRefreshListener(None)
- xDoc.removeRefreshListener(None)
-
- # refresh without listeners
- xDoc.refresh()
- xDoc.close(True)
-
- def test_refresh(self):
- global refreshed
- refreshed = 0
-
- xDoc = self._uno.openEmptyWriterDoc()
- xListener = XRefreshListenerExtended()
- xDoc.addRefreshListener(xListener)
- xDoc.refresh()
- xDoc.removeRefreshListener(xListener)
- self.assertEqual(1, refreshed)
- xDoc.refresh()
- self.assertEqual(1, refreshed)
- xDoc.close(True)
-
- def test_refreshTwice(self):
- global refreshed
- refreshed = 0
-
- xDoc = self._uno.openEmptyWriterDoc()
- xListener = XRefreshListenerExtended()
- xDoc.addRefreshListener(xListener)
- xDoc.refresh()
- xDoc.refresh()
- xDoc.removeRefreshListener(xListener)
- self.assertEqual(2, refreshed)
- xDoc.refresh()
- self.assertEqual(2, refreshed)
- xDoc.close(True)
-
- def test_DoubleInstances(self):
- global refreshed
- refreshed = 0
-
- xDoc = self._uno.openEmptyWriterDoc()
- xListener = XRefreshListenerExtended()
-
- xDoc.addRefreshListener(xListener)
- xDoc.addRefreshListener(xListener)
- xDoc.addRefreshListener(xListener)
-
- xDoc.refresh()
- xDoc.refresh()
- self.assertEqual(3*2, refreshed)
-
- refreshed = 0
- xDoc.removeRefreshListener(xListener)
- xDoc.refresh()
- # two instances should remain in the list
- self.assertEqual(2, refreshed)
-
- xDoc.close(True)
-
-
-if __name__ == '__main__':
- unittest.main()
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
+#! /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.util import XRefreshListener + + +refreshed = 0 + + +class XRefreshListenerExtended(unohelper.Base, XRefreshListener): + @classmethod + def refreshed(self, Event): + global refreshed + refreshed += 1 + + @classmethod + def disposing(self, event): + pass + + +class XRefreshable(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls._uno = UnoInProcess() + cls._uno.setUp() + + @classmethod + def tearDownClass(cls): + cls._uno.tearDown() + + def test_None(self): + global refreshed + refreshed = 0 + xDoc = self._uno.openEmptyWriterDoc() + + # attempt to add/remove none + xDoc.addRefreshListener(None) + xDoc.removeRefreshListener(None) + + # refresh without listeners + xDoc.refresh() + xDoc.close(True) + + def test_refresh(self): + global refreshed + refreshed = 0 + + xDoc = self._uno.openEmptyWriterDoc() + xListener = XRefreshListenerExtended() + xDoc.addRefreshListener(xListener) + xDoc.refresh() + xDoc.removeRefreshListener(xListener) + self.assertEqual(1, refreshed) + xDoc.refresh() + self.assertEqual(1, refreshed) + xDoc.close(True) + + def test_refreshTwice(self): + global refreshed + refreshed = 0 + + xDoc = self._uno.openEmptyWriterDoc() + xListener = XRefreshListenerExtended() + xDoc.addRefreshListener(xListener) + xDoc.refresh() + xDoc.refresh() + xDoc.removeRefreshListener(xListener) + self.assertEqual(2, refreshed) + xDoc.refresh() + self.assertEqual(2, refreshed) + xDoc.close(True) + + def test_DoubleInstances(self): + global refreshed + refreshed = 0 + + xDoc = self._uno.openEmptyWriterDoc() + xListener = XRefreshListenerExtended() + + xDoc.addRefreshListener(xListener) + xDoc.addRefreshListener(xListener) + xDoc.addRefreshListener(xListener) + + xDoc.refresh() + xDoc.refresh() + self.assertEqual(3*2, refreshed) + + refreshed = 0 + xDoc.removeRefreshListener(xListener) + xDoc.refresh() + # two instances should remain in the list + self.assertEqual(2, refreshed) + + xDoc.close(True) + + +if __name__ == '__main__': + unittest.main() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |