Skip to content

Add a few test cases for simple situations#322

Merged
texus merged 2 commits intotexus:1.xfrom
jjuhl:add-some-tests
Feb 28, 2026
Merged

Add a few test cases for simple situations#322
texus merged 2 commits intotexus:1.xfrom
jjuhl:add-some-tests

Conversation

@jjuhl
Copy link
Contributor

@jjuhl jjuhl commented Feb 21, 2026

Hi Texus

This is just a "feeler PR" to find out if you will appreciate additions to the test suite.
These tests are fairly basic (but relevant IMHO).
I'll add more in the future if you like them - just don't want to waste a bunch of time writing tests if you don't want them :)

@texus
Copy link
Owner

texus commented Feb 22, 2026

More tests are welcome, especially if they touch on situations that aren't already covered.
If some lines of code are only tested indirectly by internal function calls then I still think it is good to have explicit tests for them. However if other test cases already call certain functions then I don't necessarily feel like new tests focusing on just these functions are very useful.

I would merge the "Child Widgets" tests because more explicit tests are never bad, but they are unlikely to add much value because this is already covered by the Container tests. They might protect against a future case where Panel would override the add or remove functions, but if tests are done properly then new tests would be written together with such a change to Panel anyway.

Time might be better spend writing tests for parts of the code that are untested or partially untested. You can use https://app.codecov.io/github/texus/TGUI to see which part of the code is covered by the tests.

The addition in SignalManager.cpp doesn't seem to have anything to do with SignalManager (which is an actual class for an edge-case situation, not the place to tests signals). The signal class itself (so e.g. connect and emit functions) is tested in Signal.cpp, and each widget has tests for its own signals. So tests/Widgets/Button.cpp has tests for connecting to the Pressed signal in it's "Signals" section and also has tests to verify that pressing it triggers it in the "Events / Signals" section. Many other widgets don't have a complete "Events / Signals" section though, that is e.g. something that could still use some work.

@jjuhl
Copy link
Contributor Author

jjuhl commented Feb 25, 2026

Thank you for the feedback.
I've dropped the SignalManager bits.
The https://app.codecov.io/github/texus/TGUI link is super useful (didn't know about that one) - I'll take a look and see where there's potential to add more tests for currently untested code that can have a real impact. :-)

@jjuhl
Copy link
Contributor Author

jjuhl commented Feb 26, 2026

Added a test for FileDialog::[get/set]CreateFolderButtonText that didn't previously have any test coverage.

I won't touch this branch any further, but will add more tests in a future PR if you are happy with this stuff :)

@texus texus merged commit 5e8ef25 into texus:1.x Feb 28, 2026
15 checks passed
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