UI test logger has wrong expectations on vertical tabs

Ilmari Lauhakangas ilmari.lauhakangas at libreoffice.org
Thu Feb 17 15:32:09 UTC 2022


On 1.12.2021 20.45, Ilmari Lauhakangas wrote:
> I was going to write a small Python UI test concerning Writer hyperlink 
> tab focus and decided to try our test logger. It turns out the 
> log-to-test converter expects some UI element ID values to be numeric 
> while they are not. I couldn't figure out how to fix it.
> 
> I followed 
> https://wiki.documentfoundation.org/Development/UITests#Tools_for_writing_a_test 
> 
> 
> Installed python-textx package.
> 
> PYTHONPATH=/home/user/libreoffice/instdir/program 
> URE_BOOTSTRAP=file:////home/user/libreoffice/instdir/program/fundamentalrc 
> LO_COLLECT_UIINFO="test.log" SAL_USE_VCLPLUGIN=gen instdir/program/soffice
> 
> Opened Writer and Ctrl-K to insert hyperlink, canceled and quit.
> 
> cd uitest/ui_logger_dsl
> 
> python dsl_core.py /home/user/libreoffice/instdir/uitest/test.log 
> /home/user/libreoffice/sw/qa/uitest/hyperlink.py
> 
> The log file has a line:
> Choose Tab number internet in 'tabcontrol' from
> 
> and dsl_core.py fails on the line with:
> textx.exceptions.TextXSyntaxError: None:6:19: error: Expected INT at 
> position /home/user/libreoffice/instdir/uitest/test.log:(6, 19) => 'ab 
> number *internet i'.
> 
> In uitest/ui_logger_dsl/UI_Object_commands.tx we have:
> TabControlUIObject:
>     'Choose Tab number' tab_page_number=INT 'in' tab_id=STRING ('from' 
> parent_id=ID)?
> 
> It doesn't matter, if I change tab_page_number=STRING, it errors saying 
> it expected STRING as if internet was not a string?!?
> 
> In a gdb session I checked the contents of the parameters
> 
> break /home/user/libreoffice/vcl/source/uitest/logger.cxx:599
> 
> Thread 1 "soffice.bin" hit Breakpoint 1, UITestLogger::logEvent 
> (this=0x555556cc9510, rDescription=...) at 
> /home/user/libreoffice/vcl/source/uitest/logger.cxx:600
> 600             aLogLine = "Choose Tab number " + 
> GetValueInMapWithIndex(rDescription.aParameters, 0)
> (gdb) p rDescription
> $1 = (const EventDescription &) @0x7fffffffb1f0: {aKeyWord = 
> "VerticalTab", aAction = "SELECT", aID = "tabcontrol", aParent = "",
>    aParameters = std::__debug::map with 1 element = {["POS"] = "internet"}}
> 
> Relevant commits:
> https://git.libreoffice.org/core/commit/644a775833857955576b5284bf2f1b992d8f5b21 
> 
> https://git.libreoffice.org/core/commit/f558d810de845ad1dd52632ca0a2cae4733ed6e6 
> 
> 
> I know this tool is underused, but it would be nice to make sure it 
> works and maybe we will start using it more :)

Now I got some help from the maintainer of textX and could solve the tab 
number issue: https://github.com/textX/textX/discussions/370

However, there is an issue arising from the fact that the parent of 
tabcontrol turns up blank. The logger should insert the parent at the 
end of the logged event:

Choose Tab number internet in 'tabcontrol' from

I tracked it down as follows:

vcl/source/uitest/logger.cxx has UITestLogger::logEvent which takes an 
EventDescription&

vcl/source/control/ivctrl.cxx has collectUIInformation with the parent 
as the last parameter. It is run in VerticalTabControl::SetCurPageId

I set a breakpoint there and indeed 'p GetPageParent()->get_id()' 
returns an empty string.

GetPageParent() is in vcl/inc/verticaltabctrl.hxx and gets a VclVBox object.

VclVBox is found in include/vcl/layout.hxx

Do VCL experts have ideas on this?

Ilmari


More information about the LibreOffice mailing list