improve logging in UITests

(1) log useful stuff that is happening instead of logging events that
are __not__ interesting

(2) add the UIObject title to the event so we know who the event belongs
to

Change-Id: Iea4b70c03482b10731f186d730afa12dac760fa4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165435
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2024-03-27 21:56:15 +02:00
parent 9b98856c59
commit 8093bd7017
2 changed files with 5 additions and 6 deletions

View file

@ -36,15 +36,11 @@ class EventListener(XDocumentEventListener,unohelper.Base):
self.xGEB.removeDocumentEventListener(self)
def documentEventOccured(self, event):
if self.printEvents is True:
print(event.EventName)
print("documentEventOccured: name=" + event.EventName + ", title=" + str(event.Supplement))
print("documentEventOccured: found event we are waiting for")
if event.EventName in self.eventNames:
self.executed = True
self.eventExecuted.append(event.EventName)
else:
print(self.eventNames)
print(event.EventName)
def hasExecuted(self, eventName):
return eventName in self.eventExecuted

View file

@ -632,6 +632,7 @@ void Dialog::dispose()
css::uno::Reference<css::frame::XGlobalEventBroadcaster> xEventBroadcaster(css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_SET_THROW);
css::document::DocumentEvent aObject;
aObject.EventName = "DialogClosed";
aObject.Supplement <<= GetText(); // title
xEventBroadcaster->documentEventOccured(aObject);
UITestLogger::getInstance().log(u"Close Dialog");
@ -1029,6 +1030,7 @@ bool Dialog::ImplStartExecute()
css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_SET_THROW);
css::document::DocumentEvent aObject;
aObject.EventName = "DialogExecute";
aObject.Supplement <<= GetText(); // title
xEventBroadcaster->documentEventOccured(aObject);
if (bModal)
UITestLogger::getInstance().log(Concat2View("Open Modal " + get_id()));
@ -1651,6 +1653,7 @@ void Dialog::Activate()
css::uno::Reference<css::frame::XGlobalEventBroadcaster> xEventBroadcaster(css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_SET_THROW);
css::document::DocumentEvent aObject;
aObject.EventName = "ModelessDialogVisible";
aObject.Supplement <<= GetText(); // title
xEventBroadcaster->documentEventOccured(aObject);
}
SystemWindow::Activate();