Posts

Things to know if you are a new contributor to LibreOffice code

When I began contributing code to LibreOffice, I faced some issues because I didn't know several facts that the other active contributors knew. This blog post summarizes some of those facts, and I hope it will be useful for other new contributors! 1) The data types LibreOffice code uses - If you have already browsed through the codebase of LibreOffice, you might have realized that the code doesn't generally use data types like int, float, double, et cetera like we use in small C++ programs. LibreOffice has its own classes, typedefs and structs defined and most of the code use them instead of the trivial data types. Some of those are OUString (instead of string), sal_uInt32 (instead of unsigned int), etc.

An overview of how UI logging works in LibreOffice

Logging in LibreOffice is mainly handled by a class called UITestLogger, defined here . The logger class logs the user actions only if the member flag mbValid is set to true. The flag can be turned on by setting the environment variable LO_COLLECT_UIINFO to a file name where the logs should be collected (see the constructor of UITestLogger, defined here ). We maintain a pointer to an instance of UITestLogger class here . To use the logger object, the static function getInstance can be used to get access to the pointer. The function logAction, defined in the same class, is used to log events from the classes which extend the class vcl::Control. The log statements corresponding to a particular class can be found in the function get_action of the UI wrapper classes. Most of the wrapper classes can be found with this OpenGrok search. The log statements get generated when VCL events get broadcasted. A list of the VCL events can be found in the enum class VclEventId here . ...

GSoC final report - UI logger

Overview The idea of this GSoC project was to implement a feature which logs the interaction of users with the UI elements in an interpretable Domain Specific Language (DSL), and an interpreter which converts the log into a file into something which will help in replaying the user actions. The project involved working with the UI elements and the UI testing framework of LibreOffice. Achievements The logger - The logging for the following is currently supported - The UI elements of Visual Component Library like Buttons, Checkboxes, Radio-buttons, Listboxes, Comboboxes, Spinbuttons, etc. Keys pressed in different UI elements UNO commands sent with parameters Selection of Objects Opening of Sidebar/Deck Some application-specific events can also be logged - Writer - Goto Page, Set Zoom, Text Selection Calc - Autofilter Launch, Selection of cells/range of cells, Switching of Sheet Math - Selection of elements from the element selector panel Impress - Set Zoom Addi...

GSoC work report - Week 11

This week, I first completed the patch - https://gerrit.libreoffice.org/#/c/57857/ This adds a new function to call UNO commands with parameters in the UI tests. Then, I completed the patch - https://gerrit.libreoffice.org/#/c/57368/ This involved adding logging for the opening of sidebar/deck in the LO apps, changing the log for object selection and UNO commands to make them interpretable, and removing the function logObjectSelection to merge it in the logEvent function. Now, I am working on improving the log interpreter - https://gerrit.libreoffice.org/#/c/58340/ This fixes a crash on certain inputs and adds support for interpreting UNO command parameters, along with some other minor changes.

GSoC work report - Week 10

I first worked on adding logs for more events. The selection of symbols from "element_selector" in the math app now gets logged. Also, the selection of objects now gets logged in the writer, calc and impress. The patch is here - https://gerrit.libreoffice.org/#/c/57368/ I also worked on changing from multiple functions for logging to one generic function logEvent in the same patch. Additionally, I also did some work for adding support of sending parameters in executeCommand function of the UI testing framework. The progress can be seen here - https://gerrit.libreoffice.org/#/c/57857/

GSoC work report - Week 9

At first, I worked on the keylogging issue. Key presses are now logged according to DSL inside the dialogs too (in ComboBoxes and SpinFields). The patch is here - https://gerrit.libreoffice.org/#/c/57233/ Then I worked on logging more events (https://gerrit.libreoffice.org/#/c/57368/). These are the events which this patch logs - Writer Goto Page Set Zoom Calc Launch Autofilter Select Cell/Range/Table Impress Set Zoom In addition to this, I realized that we might also need to log the arguments sent with a UNO command, in addition to the UNO command itself. The patch has also done some work in that direction.

GSoC work report - Week 8

This week, I first worked on improving the log interpreter. It can now open existing files (in addition to starting with blank documents). I then moved the logAction function from ImplCallEventListenersAndHandler to CallEventListeners. Events from down in the class hierarchy which directly called CallEventListeners from vcl::Window (or ImplCallEventListenersAndHandler from Control) will now get interrupted by the new function, register a log statement, and then go to the class Window. This also allowed to log SpinFieldUp and SpinFieldDown. According to the feedback from Raal, I worked on resolving the ID conflicts of UI elements in the same dialog. The patch can be seen here . For week 9, I will keep working on improving UI testing, including the key input inside dialogs as suggested by Markus.

GSoC work report - Week 7

During the 7th week, I sent 3 patches. 1) Gerrit change #56776 This change adds more features to the log interpreter. UNO commands, closing dialogs through buttons, sending UNO commands to open dialogs via keycode is now supported. 2) Gerrit change #56777 This change makes command-line argument parsing of interpreter more standard. 3) Gerrit change #56789 This change adds support for starting any of the 6 apps of LibreOffice through the create_doc_in_start_center() function. Let's also have a look at a log file and the generated test file.  Log File - ButtonUIObject Action:CLICK Id:writer_all Parent: CommandSent Name: . uno:FontDialog ModalDialogExecuted Id:CharacterPropertiesDialog RadioButtonUIObject Action:CLICK Id: 90 deg Parent:CharacterPropertiesDialog ListBoxUIObject Action:SELECT Id:linestylelb Parent:CharacterPropertiesDialog { "POS" : "6" } ButtonUIObject Action:CLICK Id:ok Parent:CharacterPropertiesDialog DialogClosed Test...

GSoC work report - 24th June

Since my last update, I have (1) Fixed the parent printing issue when logging keys - Gerrit #55675 (2) Made an interpreter for log statements - Gerrit #56120 (3) Changed some log statements - Gerrit #56305

GSoC work report - Week 4

This week involved completing the UI wrapper classes for combo-box and tab-control. The code can be found here . I have proposed two ways for logging actions for the main LibreOffice writer window. The first one is by writing separate logger for the LibreOffice writer analogous to the VCL logger. The patch is here . The second is by simply sending log statements when the functions for "Go to Page" or "Zoom" are called. The patch is here . Of course, we will push only one of these two patches to master after the code review.

GSoC work report - Week 3

This week started with extending the UI logging infrastructure for logging list-box related events. The events ListboxSelect and ListboxFocus will now be recorded in the log file. Here's the patch. Next, I started to develop logging framework for LibreOffice's writer. The idea is to enumerate the events we need for logging and then have a logger similar to what we have for VCL events. The code can be found here . The patch is under review. The patch sent in the last week has received a positive review and is ready to be merged.

GSoC 18 work report - 23rd May

Image
The coding period of GSoC started 10 days ago. I'm working with LibreOffice's UI logger. The aim of first two weeks is to support logging for UNO commands, dialogs, radiobuttons, checkboxes, and buttons. To get a summary of what has been done so far, let's perform a couple of steps and look at the generated log file.