From d19307846e6e360aacdec7fc81e3a923d387d1d2 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Wed, 21 Dec 2016 14:34:42 +0100 Subject: uitest: add an optional way to print all received event names Change-Id: I8180d131c2f4dbc9759ca1166192970bc06231c0 Reviewed-on: https://gerrit.libreoffice.org/32280 Tested-by: Jenkins Reviewed-by: Markus Mohrhard --- uitest/libreoffice/uno/eventlistener.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/uitest/libreoffice/uno/eventlistener.py b/uitest/libreoffice/uno/eventlistener.py index 8338f6f123c5..2dbdd68f086e 100644 --- a/uitest/libreoffice/uno/eventlistener.py +++ b/uitest/libreoffice/uno/eventlistener.py @@ -18,12 +18,13 @@ except ImportError: class EventListener(XDocumentEventListener,unohelper.Base): - def __init__(self, xContext, eventNames): + def __init__(self, xContext, eventNames, **kwargs): self.xGEB = xContext.ServiceManager.createInstanceWithContext( "com.sun.star.frame.GlobalEventBroadcaster", xContext) self.xContext = xContext self.executed = False self.eventExecuted = [] + self.printEvents = kwargs.get('printNames', False) if isinstance(eventNames, str): self.eventNames = [eventNames] elif isinstance(eventNames, list): @@ -37,6 +38,9 @@ class EventListener(XDocumentEventListener,unohelper.Base): self.xGEB.removeDocumentEventListener(self) def documentEventOccured(self, event): + if self.printEvents is True: + print(event.EventName) + if event.EventName in self.eventNames: self.executed = True self.eventExecuted.append(event.EventName) -- cgit