fe79fa58f3040e69e5ac3fa38037674b007d2e61
braney
  Sat Sep 12 13:47:50 2026 -0700
docent: ten regression tests for multi-region view, refs #38252

One script per Closed multi-region ticket, asserting the behavior the ticket
says is correct, on genome-test.  Before these the only script here that
entered multi-region at all was rm35580, which uses singleAltHaplo to reach a
different bug.

Between them they cover the four modes, the dialog, the custom-region BED
reader, hideEmptySubtracks across windows, and highlights in both directions
across the mode change:

rm22144  the alt-haplotype input is in the dialog, and hgSuggest
type=altOrPatch resolves the ticket's own mhc, apd and NT_187643
rm23922  the Multi-region and Reverse buttons carry class='pressed' while
their mode is on, and lose it on exit
rm26772  a zero-length BED line names itself instead of aborting with
"Window out of range"
rm27855  hg19 GTEx Gene in singleAltHaplo on chr6_cox_hap2 renders and
clicks through instead of freezing
rm29452  the dialog's exit radio is enabled and checked from a normal view,
and selectable from inside exon view (#34776's half, the missing
hgTracks.virtModeType in the dialog's JSON)
rm29787  custom regions in UCSC chrom names work on hs1
rm30833  a highlight survives turning multi-region on
rm34250  a highlight made in multi-region survives exiting, back in chr1
coordinates
rm35472  hideEmptySubtracks over two windows keeps both subtracks that have
items in one of them, and still hides the one with items in neither
rm37175  exon view keeps the last searched transcript

All ten are assertion-only: every fix shipped long ago.  make test is 47 of 47
green, 7m34s.

README.txt gains the two things they cost a red run each.  Never assert on a
title attribute: hgTracks' tooltip code moves it into data-tooltip once the
page's JavaScript has run.  And multi-region is fully reachable from a goto:
URL -- virtModeType, multiRegionsBedInput, singleAltHaploId, virtWinFull,
<composite>.hideEmptySubtracks -- but the dialog is not, because what it
decides is in JavaScript.

Three candidates were rejected and should not be picked again: #32544 was
closed by deferring to #37256 and is not fixed, #27891 needs a track with a
trackDb multiRegionsBedUrl and /gbdb/hg38/covidMuts/covidMuts.regions.bed does
not exist, and #24055's gesture is an ajax visibility change that no Docent
verb makes.

diff --git src/hg/utils/docent/tests/regress/rm35472.docent.yaml src/hg/utils/docent/tests/regress/rm35472.docent.yaml
new file mode 100644
index 00000000000..4d9590298ee
--- /dev/null
+++ src/hg/utils/docent/tests/regress/rm35472.docent.yaml
@@ -0,0 +1,57 @@
+# #35472 -- "hide empty subtracks" counted items in one window only, so in multi-region a
+# subtrack with items in the second window was hidden as empty.  Lou reported it against
+# the GRC Patches composite: the haplotype subtrack disappeared even though it had an item
+# on screen, and scrolling right past the multi-region boundary brought it back.
+#
+# Galt's fix, 9038f4eb685 (2025-06-27), replaced the count with a walk over the windows:
+#
+#     boolean anyWindowHaveItems(struct track *track)
+#     for(;track;track=track->nextWindow)
+#         if (slCount(track->items) > 0) return TRUE;
+#
+# in checkHideEmptySubtracks()'s caller, hg/hgTracks/hgTracks.c.  His commit message says
+# the bug had been there since the feature was added.
+#
+# The recipe is built rather than loaded from the ticket's session, because what it needs
+# is one composite with hideEmptySubtracks and two regions chosen so that each subtrack is
+# empty in one of them.  The Problematic Regions composite on hg38 (`hideEmptySubtracks
+# on` in hg38/problematic.ra) gives that without any fixture of our own:
+#
+#     chr1:144,874,354-144,875,080   comments has an item, encBlacklist does not
+#     chr1:91,386,300-91,388,400     encBlacklist has one, comments does not
+#     grcExclusions                  has no item in either -- it has no chr1 at all
+#
+# so after the fix the two-window view draws BOTH, and grcExclusions is still hidden.
+# That third row is what makes this a test of the fix rather than of the feature being
+# switched off: a build that simply stopped hiding anything would draw grcExclusions too
+# and fail the noRows: below.
+#
+# The single-window step comes first for the same reason.  It pins that the feature is
+# doing its work at all -- with one window, encBlacklist IS empty and IS hidden -- so a
+# server with `problematic.hideEmptySubtracks` off could not pass this script.
+proof:
+  - "assertion-only 2026-09-12 -- written from the ticket and from 9038f4eb685, after the fix shipped"
+
+target: genome-test
+db: hg38
+position: chr1:144874354-144875080
+reset: true
+fast: true
+steps:
+  # One window, over the region only `comments` has an item in.  hideEmptySubtracks is on
+  # by default for this composite, so the other two subtracks are hidden even though all
+  # three are selected.
+  - goto: "/cgi-bin/hgTracks?db=hg38&position=chr1%3A144874354-144875080&pix=1100&hideTracks=1&problematicSuper=show&problematic=pack&comments=pack&comments_sel=1&encBlacklist=pack&encBlacklist_sel=1&grcExclusions=pack&grcExclusions_sel=1&problematic.hideEmptySubtracks=on"
+  - expect:
+      rows: [ruler, comments]
+      exact: true
+      noRows: [encBlacklist, grcExclusions]
+
+  # Both regions as custom regions.  Each subtrack is empty in one window and not in the
+  # other, which is the case the old count got wrong.
+  - goto: "/cgi-bin/hgTracks?pix=1100&virtModeType=customUrl&virtWinFull=on&multiRegionsBedInput=chr1%20144874354%20144875080%0Achr1%2091386300%2091388400%0A"
+  - expect:
+      rows: [ruler, comments, encBlacklist]
+      exact: true
+      noRows: [grcExclusions]
+      has: '#hgTracksConfigMultiRegionPage.pressed'