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/rm26772.docent.yaml src/hg/utils/docent/tests/regress/rm26772.docent.yaml
new file mode 100644
index 00000000000..5d354cfca8c
--- /dev/null
+++ src/hg/utils/docent/tests/regress/rm26772.docent.yaml
@@ -0,0 +1,48 @@
+# #26772 -- a BED of zero-length regions crashed multi-region with
+#
+#     Window out of range on virt
+#
+# and a grey error page.  The input was the COVID GWAS risk variants written as 1-based
+# single positions, chromStart == chromEnd on every line, which is wrong BED but is the
+# mistake a reader makes when they paste a variant list.  Galt's fix rejects the line and
+# says which one it is; Daniel confirmed the message on beta on 2021-01-20 and closed the
+# ticket on the RR six days later.
+#
+# The check is in hg/hgTracks/hgTracks.c, in the reader for custom regions:
+#
+#     warn("BED chromEnd %u must be greater than chromStart %u %s", ...)
+#
+# The virtual chromosome is called "multi" now and was called "virt" in 2021, so the
+# noText: below names the part of the string the rename did not touch.  It is the error
+# the FIX must not produce; the text: beside it is the message it must produce, and both
+# are needed because the page has no track image on either build -- a noText: alone would
+# pass just as happily on the grey page the ticket was filed about.
+#
+# The regions are fed through the multiRegionsBedInput cart variable, which is what the
+# dialog's textarea submits, so this reaches the same reader the dialog does.  Docent has
+# no verb that types into the textarea.
+proof:
+  - "assertion-only 2026-09-12 -- written from the ticket long after the fix shipped"
+
+target: genome-test
+db: hg38
+position: chr3:45901000-45901200
+reset: true
+fast: true
+steps:
+  - go: chr3:45901000-45901200
+
+  # The ticket's own BED, first two lines: 1-based single positions, so chromStart and
+  # chromEnd are equal on both.
+  - goto: "/cgi-bin/hgTracks?db=hg38&pix=1100&virtModeType=customUrl&multiRegionsBedInput=chr3%2045901089%2045901089%0Achr6%2029798794%2029798794%0A"
+  - expect:
+      text: "BED chromEnd 45901089 must be greater than chromStart 45901089 chr3"
+      noText: "Window out of range on"
+
+  # The same BED with the ends one base past the starts is legal, and has to still work:
+  # a fix that rejected every short region would pass the step above.
+  - goto: "/cgi-bin/hgTracks?db=hg38&pix=1100&virtModeType=customUrl&virtWinFull=on&multiRegionsBedInput=chr3%2045901089%2045901090%0Achr6%2029798794%2029798795%0A"
+  - expect:
+      rows: [ruler]
+      noText: "must be greater than chromStart"
+      has: '#hgTracksConfigMultiRegionPage.pressed'