#! /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
# 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())
# 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())
# 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)
# 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)
# perform unit test: # it is able to set modified flag using text editing despite # ODT file was marked to be opened as read-only
self.assertTrue(xDoc.isSetModifiedEnabled())
self.assertFalse(xDoc.isModified())
cursor = xDoc.Text.createTextCursor()
xDoc.Text.insertString(cursor, "The first paragraph", 0)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.