Skip to content

Run tests for unix implementation#104

Closed
smaryus wants to merge 4 commits intofyne-io:masterfrom
smaryus:add_tests_for_unix
Closed

Run tests for unix implementation#104
smaryus wants to merge 4 commits intofyne-io:masterfrom
smaryus:add_tests_for_unix

Conversation

@smaryus
Copy link

@smaryus smaryus commented Dec 17, 2025

Run tests for unix implementation.

@smaryus
Copy link
Author

smaryus commented Dec 17, 2025

Hi @andydotxyz,
Would you be interested to have running tests on Linux for the repo?

@andydotxyz
Copy link
Member

Thanks for looking at this.

Hi @andydotxyz, Would you be interested to have running tests on Linux for the repo?

Running tests is good - but is this PR really testing the code, or is it testing a new mock implementation?
There are more lines of Go code added here than exist in the unix and darwin implementations combined...

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.

@smaryus
Copy link
Author

smaryus commented Dec 23, 2025

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 StatusNotifierWatcher class that would listen on the changes that systray generates on dbus. Then in tests the StatusNotifierWatcher can be used to interact with the tray and later the menu.

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.

@andydotxyz
Copy link
Member

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.
Would it not be a lot simpler to just verify what is being sent rather than decoding and responding as a complete mock server?

@smaryus
Copy link
Author

smaryus commented Dec 27, 2025

But on most systems the dbus server will already be running

I think this depends on the used image, because I've used ubuntu-latest(I didn't test with other images) and that doesn't even have dbus package installed. Because of this, it is installed into the github file and then started in tests.

If I understand this correctly I've implemented the system tray server almost completely to verify that we are sending the right things.

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.

Would it not be a lot simpler to just verify what is being sent rather than decoding and responding as a complete mock server?

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:

  • running dbus server
  • StatusNotifierItem - is the application, systray
  • StatusNotifierHost and StatusNotifierWatcher - this would be the mocks(StatusNotifierHost logic is not yet implemented 😞). I've saw in KDE for example it is a different process that is running for this.

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?

@andydotxyz
Copy link
Member

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.
I think it is also important to understand that taking this (current or fynedesk) approach simply won't work on any Unix computer currently running a system tray. I wonder if checking values based on what is sent to dbus rather than what happens on a registered dbus server...

@smaryus
Copy link
Author

smaryus commented Jan 19, 2026

Sorry but I'll close this, because I don't have time at the moment to work more on it.

@smaryus smaryus closed this Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants