# Take the tab strip scroll positions from a tested module · lucenx/codexbar-plasma

[View on GitCafe](https://git.cafe/lucenx/codexbar-plasma/commit/954646dffe27b81f2e0f144a6602ec4dea553222)

Repository: [lucenx/codexbar-plasma](https://git.cafe/lucenx/codexbar-plasma)

Visibility: public

Requested revision: 954646dffe27b81f2e0f144a6602ec4dea553222

Requested commit: 954646dffe27b81f2e0f144a6602ec4dea553222

Commit: 954646dffe27b81f2e0f144a6602ec4dea553222

Tree: 0b772d9b72096aac1c6dac10f19be8c1a52e8822

Author: Simone

Committer: Simone

## Message

```
Take the tab strip scroll positions from a tested module

FullRepresentation.qml is the largest file in the repo without a behavioural
test, so the plan was to test the component. Instantiating it needs a fake
`applet` with 49 distinct members, and most of what it does is declarative
layout: such a test would mostly exercise the fake.

What is worth testing is the arithmetic. The tab strip clamps a requested
contentX and decides whether a tab is off the left edge, off the right edge, or
already visible. Both are off-by-one country and neither reads clearly inline.

Move them into TabStripGeometry.js. `revealPosition` answers with a position or
null, so an already-visible tab no longer restarts the scroll animation every
time the strip re-reports its selection; before, the same decision was spread
across an if/else-if that called scrollTo directly.

The rest of the strip stays in QML on purpose: `containsTab` walks the parent
chain and `focusAdjacentTab` walks the focus chain, and neither proves anything
without a live scene.

tests/tst_tab_strip_geometry.qml adds 15 cases, including a strip narrower than
its viewport (where clamping the other way round would leave a negative
contentX), an exact fit, a tab wider than the viewport, and the margin boundary
tested on both sides.

test_ui_regressions.sh asserts the delegation and rejects the arithmetic being
re-inlined beside the module. Verified by re-inlining the clamp: the check exits
1 and names the missing fragment.

```

## Parents

- [a09bf4c3c17ce16e8ba8bbb2843502d8528c92a0](https://git.cafe/lucenx/codexbar-plasma/commit/a09bf4c3c17ce16e8ba8bbb2843502d8528c92a0?format=markdown)

[Source at this commit](https://git.cafe/lucenx/codexbar-plasma/tree/954646dffe27b81f2e0f144a6602ec4dea553222?format=markdown)
