Skip to content

Add CSS selector integration tests for tab selection, .active class, and preference pseudo#3983

Open
vogella wants to merge 1 commit intoeclipse-platform:masterfrom
vogella:css-tests-selector-integration
Open

Add CSS selector integration tests for tab selection, .active class, and preference pseudo#3983
vogella wants to merge 1 commit intoeclipse-platform:masterfrom
vogella:css-tests-selector-integration

Conversation

@vogella
Copy link
Copy Markdown
Contributor

@vogella vogella commented May 7, 2026

Adds three JUnit 5 tests under tests/org.eclipse.e4.ui.tests.css.swt that pin engine behaviours not covered end-to-end today: how CTabItem:selected rules surface on CTabFolder#getSelectionForeground/Background and how the CTabFolderElement SWT selection listener triggers a reapply, how CTabFolder.active rules toggle on WidgetElement#setCSSClass, and how the IEclipsePreferences#node:contributor pseudo selector form (Bug 466075) lets multiple stylesheets contribute to the same preference node.

Two scenarios were adjusted to match observed behaviour rather than the originally drafted expectation. The selected-foreground assertion runs against folder.getSelectionForeground() (consistent with the existing CTabItemTest#testSelectionForeground) instead of CTabItem#getForeground(), and the listener path is exercised by dispatching an SWT.Selection event because programmatic CTabFolder#setSelection does not fire it. The "clearing .active reverts the background" case was flipped: the folder retains the previously painted background after the class is cleared, so the test pins that behaviour with a comment so a future revert fix shows up as a failure.

The third scenario (IEclipsePreferences#node:key) was reframed: the pseudo slot in shipped CSS is a contributor namespace tag (Bug 466075), not a preference key, and EclipsePreferencesHandler only acts on the preferences: declaration. An additional cascade-override test pins the source-order tiebreak: when two equal-specificity rules under the same pseudo write the same preference key, the later rule wins because viewCSS resolves the duplicate preferences: property before the handler runs. The class javadocs were trimmed to single sentences with the non-obvious context kept as inline comments next to the relevant assertions.

@vogella vogella force-pushed the css-tests-selector-integration branch from 1c9d07b to 3cb397e Compare May 7, 2026 13:17
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Test Results

   867 files  + 9     867 suites  +9   57m 47s ⏱️ + 4m 37s
 7 986 tests + 9   7 743 ✅ + 9  243 💤 ±0  0 ❌ ±0 
20 460 runs  +27  19 805 ✅ +27  655 💤 ±0  0 ❌ ±0 

Results for commit 6468cbd. ± Comparison against base commit 7b7ab71.

♻️ This comment has been updated with latest results.

…and preference pseudo

Locks in three engine behaviours that the existing matcher and parser
unit tests do not exercise end-to-end:

- CTabItem:selected matched rules surface on the parent CTabFolder via
  getSelectionForeground/Background. Programmatic CTabFolder#setSelection
  does not fire the SWT selection listener that CTabFolderElement
  registers, so the listener-driven reapply is exercised by dispatching
  an SWT.Selection event.
- CTabFolder.active rules apply when WidgetElement#setCSSClass marks the
  folder as active, and a folder without that class is not painted by
  the rule. Clearing the class and reapplying does not revert the
  previously painted background, which is pinned as current behaviour.
- IEclipsePreferences#node:pseudo (the contributor namespace tag form
  used by shipped themes per Bug 466075) matches the node and lets the
  preferences declaration write the keys. When two equal-specificity
  rules under the same pseudo write the same key, the later rule wins
  because viewCSS resolves the duplicate property before
  EclipsePreferencesHandler runs (standard CSS source-order tiebreak).

Trims overlong block javadocs on the three test classes to short
descriptions and inline comments.
@vogella vogella force-pushed the css-tests-selector-integration branch from 3cb397e to 6468cbd Compare May 7, 2026 14:55
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.

1 participant