Files
qbz/scripts/test-keyed-model-qml.sh
T
vicrodh ce625e7e28 fix(qt): an album leaving the Library slides the grid instead of rebuilding it
Removing an album (or a track, artist or playlist) from the Library made
Rust republish the feed, the derive produced a new array, and every body
bound to it took a model swap: the grid jumped to the top, every card was
rebuilt and every cover faded in again. All four bodies (grid, list,
albums list, playlists list) now share one QbzKeyedModel over the same
derive: the leaving card shrinks and fades while its neighbours slide
into the gap, the page stays where it was, and surviving cards keep their
delegates and decoded covers. The Artists sidepanel rail gets its own
keyed model with the same page identity.

A different page is still a different page: tab, sort, search, source
filters, genres and grouping form the model's scope and replace the rows
at once, from the top, as before. A heart removed under "Favorites only"
is not a scope change, so that card animates out.

Supporting changes: the artwork window reports read the model's published
rows and count from originY (a removal above the window moves the
origin), scroll memory is origin-relative, the playlists and albums lists
are height-gated like the grid so hidden bodies build nothing, pooled
cells come back opaque, and a background reload with a page already on
screen (a bulk removal, a language switch) keeps that page instead of
blinking through the loading skeleton.

tst_library_keyed mounts the real grid cell over the keyed model and
checks that an album leaving through a republished feed keeps the other
cards, their covers and the page offset; bound to the plain array it
fails.

cc
2026-09-14 05:50:35 -06:00

24 lines
959 B
Bash
Executable File

#!/usr/bin/env bash
# QbzKeyedModel regression: rows reconcile into removes / inserts / moves /
# updates, a scope change resets silently at the top, a removal keeps the
# viewport and the delegates, pooled delegates come back opaque, and the
# Library grid keeps its cards and covers when an album leaves. Same run in CI
# and locally.
set -euo pipefail
cd "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
if [[ -n "${QT_ROOT_DIR:-}" ]]; then
qt_keyed_model_bins="$QT_ROOT_DIR/bin"
else
qt_keyed_model_qmake="${QMAKE:-}"
if [[ -z "$qt_keyed_model_qmake" ]]; then
qt_keyed_model_qmake="$(command -v qmake6 || command -v qmake)"
fi
qt_keyed_model_bins="$("$qt_keyed_model_qmake" -query QT_INSTALL_BINS)"
fi
for suite in tst_keyed_model tst_library_keyed; do
QT_QPA_PLATFORM=offscreen QT_QUICK_BACKEND=software \
"$qt_keyed_model_bins/qmltestrunner" \
-input "scripts/qml-tests/$suite.qml" \
-import scripts/qml-tests/imports
done