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/rm34250.docent.yaml src/hg/utils/docent/tests/regress/rm34250.docent.yaml
new file mode 100644
index 00000000000..3d3587c1081
--- /dev/null
+++ src/hg/utils/docent/tests/regress/rm34250.docent.yaml
@@ -0,0 +1,60 @@
+# #34250 -- b0b highlighted two regions either side of a patch in multi-region mode, left
+# multi-region mode, and the highlights were gone.  Jonathan could not reproduce it and
+# closed it as working, so what this asserts is the behaviour the ticket was answered
+# with, not a named fix: a highlight made in multi-region mode is still there, and still
+# over the same bases, after exiting to the normal view.
+#
+# It is the other direction of rm30833's round trip, and the direction with the arithmetic
+# in it.  Entering multi-region DISGUISES the highlight into virtual coordinates and
+# exiting undisguises it (imageV2.undisguiseHighlight() in hg/js/hgTracks.js reads them
+# back, and hg/hgTracks/hgTracks.c writes them), so this is where a highlight is lost by
+# being converted to coordinates that no longer exist.  Measured on genome-test on
+# 2026-09-12, the cart's highlight goes
+#
+#     (none)                                    custom-regions view, nothing highlighted
+#     hg38.multi:1-726#aaedff                   the highlight, in virtual coordinates
+#     hg38.chr1:144874355-144875080#aaedff      after exiting
+#
+# and the third line is the first custom region, 1-based: the 726 bases of virtual
+# chromosome the highlight covered are chr1:144,874,355-144,875,080 again.
+#
+# A highlight is not drawn into the image: hg/js/hgTracks.js appends one
+# <div class='highlightItem'> per highlight to the body.  Losing it changes nothing else
+# on the page -- same rows, same height, same items -- so the selector IS the assertion
+# here, and there is nothing looser to fall back on.
+#
+# The last step is the one that would have failed for b0b.  It also asserts that the
+# Multi-region button came back unpressed, so that a run which never left multi-region
+# mode cannot pass it by still having the virtual-coordinate highlight on screen.
+proof:
+  - "assertion-only 2026-09-12 -- written from the ticket, which was closed as working rather than fixed"
+
+target: genome-test
+db: hg38
+position: chr1:144874000-144875500
+reset: true
+fast: true
+steps:
+  # Custom regions first, so the highlight below is made while in multi-region mode.
+  - goto: "/cgi-bin/hgTracks?db=hg38&position=chr1%3A144874000-144875500&pix=1100&hideTracks=1&problematicSuper=show&problematic=pack&comments=pack&comments_sel=1&virtModeType=customUrl&virtWinFull=on&multiRegionsBedInput=chr1%20144874354%20144875080%0Achr1%2091386300%2091388400%0A"
+  - expect:
+      rows: [ruler, comments]
+      exact: true
+      has: '#hgTracksConfigMultiRegionPage.pressed'
+      noHas: '.highlightItem'
+
+  # The highlight, in the virtual coordinates the view is in.
+  - goto: "/cgi-bin/hgTracks?pix=1100&highlight=hg38.multi%3A1-726%23aaedff"
+  - expect:
+      rows: [ruler, comments]
+      has:
+        - '#hgTracksConfigMultiRegionPage.pressed'
+        - '.highlightItem'
+
+  # Exit.  The highlight has to come back to chr1 coordinates and still be drawn.
+  - goto: "/cgi-bin/hgTracks?pix=1100&virtModeType=default"
+  - expect:
+      rows: [ruler, comments]
+      exact: true
+      has: '.highlightItem'
+      noHas: '#hgTracksConfigMultiRegionPage.pressed'