Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change addresses item #4408
This changes the behaviour of the test explorer tree view
The following changes are proposed:
If tests are added in cmake via
add_testand at the same time viagtest_discover_testsit can happen that the tree view doesn't work properly, because test descriptions fromgtest_discover_testsare overwritten by those generated byadd_test. I think the correct approach would be to only use one of these commands in cmake - but still I thought it would be a good idea to make it work. The fix works by reusing existing test items.Another thing that annoyed me was that the tree structure was changing when a test is run - I tried to capture the behaviour here:
test_visibility_changes.webm
I found out that cmake build is executed when tests are run - and afterwards the tests are refreshed. This refreshing works by removing all test items and re-building the tree structure. This caused all the items in the tree to be initialized in a certain state. I fixed this by keeping track of all the currently active test ids and removing the deleted ones at the end of the refresh-function.
Other Notes/Information
For the second issue I tried to figure out a way to avoid refreshing the tree if nothing has changed.
However, it seems as if this is not trivial. It could be possible to compute and store a hash (or something in this direction) of the json that is produced by cmake and use it as an indicator - let me know if you think it would be worthwhile to explore this direction.
Thanks and best regards
oz