// same as above: The script didn't close the context, but the OOo framework should have
assertEquals( "undo context was not auto-closed as expected", 0, m_undoListener.getCurrentUndoContextDepth() );
// .............................................................................................................
// scenario 3: assigning the script to some document event, and triggering this event
final XEventsSupplier eventSupplier = UnoRuntime.queryInterface( XEventsSupplier.class, m_currentDocument.getDocument() );
final XNameReplace events = UnoRuntime.queryInterface( XNameReplace.class, eventSupplier.getEvents() );
final NamedValue[] scriptDescriptor = new NamedValue[] {
new NamedValue( "EventType", "Script" ),
new NamedValue( "Script", scriptURI )
};
events.replaceByName( "OnViewCreated", scriptDescriptor );