When recording a testscript that opens the systemtray context-menu you will get different recordings depending on the current operating system.
The code interacting with the tray-icon is platform-dependant and works on different objects (“
:Heart_Button” vs “
:_QWidget”), something which is undesirable for testing cross-platform applications.
mouseClick that opens the tray-icon context menu with something similar to the following:
This example makes use of the
QSystemTrayIcon API which is cross-platform. It first tries to lookup the first
QSystemTrayIcon object in the application, fetches the context-menu assigned to the tray-icon followed by opening the context-menu at the current position of the tray-icon.
Alternatively you may use
nativeMouseClick() to achieve a replay that is closer to what a real user would do at the expensive of possible test-instabilities in case the tray-icon unexpectedly changes its position (i.e. appearance of new tray-icons from other applications)
QSystemTrayIconmust have been created as a child of some object that can already be found within Squish (i.e. your main window).