diff options
author | ackepenek <ahmetcan.kepenek@gmail.com> | 2016-04-08 19:48:52 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-05-11 07:25:11 +0000 |
commit | 79e68375e48303ae1a36a0a61814cdb87cca3415 (patch) | |
tree | 4bd809797d5217eeff573b71d10feeb91dcc1229 /sw/qa/python/check_index.py | |
parent | 63ba54a168dbc777cdcec2393be476bdd5f79bc1 (diff) |
tdf#99145 refactored to pep8
Change-Id: I4896cd0bda97331a8291588e6a4f29a881d1229c
Reviewed-on: https://gerrit.libreoffice.org/23925
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sw/qa/python/check_index.py')
-rw-r--r-- | sw/qa/python/check_index.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/sw/qa/python/check_index.py b/sw/qa/python/check_index.py index bdbd8121d128..9c8c01c3963e 100644 --- a/sw/qa/python/check_index.py +++ b/sw/qa/python/check_index.py @@ -5,8 +5,9 @@ from org.libreoffice.unotest import UnoInProcess from com.sun.star.text.ControlCharacter import PARAGRAPH_BREAK from com.sun.star.util import XRefreshListener + class RefreshListener(XRefreshListener, unohelper.Base): - + def __init__(self): self.m_bDisposed = False self.m_bRefreshed = False @@ -16,11 +17,12 @@ class RefreshListener(XRefreshListener, unohelper.Base): def refreshed(self, event): self.m_bRefreshed = True - + def assertRefreshed(self): assert(self.m_bRefreshed) self.m_bRefreshed = False - + + class CheckIndex(unittest.TestCase): @classmethod @@ -31,8 +33,8 @@ class CheckIndex(unittest.TestCase): @classmethod def tearDownClass(cls): - cls._uno.tearDown() - + cls._uno.tearDown() + def test_check_index(self): xDoc = self.__class__._xDoc xIndex = xDoc.createInstance("com.sun.star.text.ContentIndex") @@ -55,7 +57,7 @@ class CheckIndex(unittest.TestCase): test_string = "a heading" xCursor.setString(test_string) xCursor.gotoStartOfParagraph(True) - xCursor.setPropertyValue("ParaStyleName","Heading 1") + xCursor.setPropertyValue("ParaStyleName", "Heading 1") # hope text is in last paragraph... xIndex.refresh() @@ -64,7 +66,7 @@ class CheckIndex(unittest.TestCase): xCursor.gotoStartOfParagraph(True) text = xCursor.getString() # check if we got text with 'test_string' - assert( text.find(test_string) >= 0 ) + assert(text.find(test_string) >= 0) # insert some more heading xCursor.gotoEnd(False) @@ -73,7 +75,7 @@ class CheckIndex(unittest.TestCase): test_string = "yet another heading" xCursor.setString(test_string) xCursor.gotoStartOfParagraph(True) - xCursor.setPropertyValue("ParaStyleName","Heading 1") + xCursor.setPropertyValue("ParaStyleName", "Heading 1") # try again with update xIndex.update() @@ -82,13 +84,13 @@ class CheckIndex(unittest.TestCase): xCursor.gotoStartOfParagraph(True) text = xCursor.getString() # check if we got text with 'test_string' - assert( text.find(test_string) >= 0 ) - + assert(text.find(test_string) >= 0) + # dispose must call the listener assert(not listener.m_bDisposed) xIndex.dispose() assert(listener.m_bDisposed) - + # close the document xDoc.dispose() if __name__ == "__main__": |