Skip to content

Cover restoring the tree expansion state and the viewer element map - #4246

Open
vogella wants to merge 1 commit into
eclipse-platform:masterfrom
vogella:jface/expansion-state-tests
Open

Cover restoring the tree expansion state and the viewer element map#4246
vogella wants to merge 1 commit into
eclipse-platform:masterfrom
vogella:jface/expansion-state-tests

Conversation

@vogella

@vogella vogella commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Restoring the expansion state by tree path had thin coverage. The only test that exercised it, MultipleEqualElementsTreeViewerTest, ran without an element comparer, although the comparer is what decides how a tree path hashes and compares, and nothing checked what happens to the items the walk reaches after the last path to expand has been found.

TreeViewerExpansionStateTest covers the round trip with and without a comparer, restoring a subset and an empty set, restoring from equal but distinct elements the way a content provider does after a refresh, and the state of the containers the walk passes once its work is done.

The hash table a viewer keeps to map elements to items had no coverage of its own at all, which is uncomfortable for a hand-written table that every viewer with hash lookup depends on. It is package private, so StructuredViewerElementMapTest reaches it the way a client does, through a comparer that decides the hashes: several keys in one slot, keys whose hashes differ but share a slot, a table grown well past its initial capacity, and removal.

All of it passes on master unchanged, since this is coverage for existing behaviour rather than a fix.

Restoring the expansion state by tree path had thin coverage. The one test
that exercised it, MultipleEqualElementsTreeViewerTest, ran without an element
comparer, although the comparer decides how a tree path hashes and compares,
and nothing checked what happens to the items the walk reaches after the last
path to expand has been found.

TreeViewerExpansionStateTest covers the round trip with and without a comparer,
restoring a subset and an empty set, restoring from equal but distinct elements
the way a content provider does after a refresh, and the state of the
containers the walk passes once its work is done.

The hash table a viewer keeps to map elements to items had no coverage of its
own at all. It is package private, so StructuredViewerElementMapTest reaches it
the way a client does, through a comparer that decides the hashes: several keys
in one slot, keys whose hashes differ but share a slot, a table grown well past
its initial capacity, and removal.

Also gives TreeViewerExpansionTest a second shape, a few large containers with
one of them expanded, which is where restoring is most expensive.
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

   858 files  ± 0     858 suites  ±0   54m 53s ⏱️ +19s
 8 168 tests +11   7 925 ✅ +11  243 💤 ±0  0 ❌ ±0 
20 406 runs  +33  19 752 ✅ +33  654 💤 ±0  0 ❌ ±0 

Results for commit dc52e7f. ± Comparison against base commit 61565e6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant