Conversation
|
Hi @andydotxyz, |
|
Thanks for looking at this.
Running tests is good - but is this PR really testing the code, or is it testing a new mock implementation? I don't know how this solution was found - please explain further why this is your preferred approach for testing the correctness of our code. |
|
Yes, it is a lot of code, that's why it is just a draft and I stopped to get some feedback 😄 The idea was to be able to have a real dbus instance running and a For example: to get the current tooltip or title from the systray through dbus calls. Also when calling systray.SetTitle a dbus event is generated and so on. But, if you have other ideas for testing, to use something else, then I'll just close this. |
|
But on most systems the dbus server will already be running. So would it not make more sense to have the GitHub configuration set up these things instead? If I understand this correctly I've implemented the system tray server almost completely to verify that we are sending the right things. |
I think this depends on the used image, because I've used
Yes, the entire code is just running to ensure that the application, systray package, sends the correct information and data + emits needed events. And it responds correctly when asked something thru some dbus method.
Yes, this would be much simpler(this is actually monitoring all the dbus events). But I think there would be some limitations of what it can be tested, because the systray and tests would need several distinct components to run in the system:
Only watching for dbus events might not always be sufficient, if there is no StatusNotifierWatcher running. This is because in some cases StatusNotifierWatcher requests data from StatusNotifierItem. For example here mock requests the tray info after it registers itself in dbus. Plus tests would not be able to generate clicks on the tray or to request submenu info. Probably the easiest and with the least amount of code would be have an already running StatusNotifierWatcher that can be controlled from the tests. In this way all the implementation details would not be part of the project. Thanks and sorry for the so long response. Out of context: just out of curiosity, I've saw that you're working on a DE using fyne, did you implemented there the support for systray? 😄 If there is, maybe something from there can be used for the tests instead? |
|
You can find a full systray implementation at https://github.com/FyshOS/fynedesk/tree/master/modules/systray. If that helps to avoid this test being so much code then it could help. |
|
Sorry but I'll close this, because I don't have time at the moment to work more on it. |
Run tests for unix implementation.