Make partition table cell edits deterministic (review of #144) - #145
Merged
Conversation
BeautiSimpleTest still used the clickOn/eraseText/write pattern that setPartitionTableCell was introduced to replace, so it remained subject to the focus race that appends instead of replaces the cell text. AlignmentListInputEditor's cell factory sets the same id and combo box graphic on every TableCell it creates, including the recycled cells backing empty rows, and those keep a live action handler. An unfiltered lookup could therefore return an empty cell, whose action handler calls tableEntries.get(-1). Match the cell on visibility and row index, and fail with a clear message when no such cell exists.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two changes from reviewing #144, targeted at
beautitestsso they land with that PR. One is a review comment on #144's code; the other is an opportunistic cleanup in a file #144 does not touch. Happy to drop the second if you'd rather keep the PR tight.1. The new cell lookup can land on a recycled empty cell (review comment on this PR)
robot.lookup("#" + cellId).query()returns the first node with that id anywhere in the scene, unfiltered.AlignmentListInputEditor's cell factory sets the id and theComboBoxgraphic on everyTableCellit creates — including the recycled cells backing the empty rows below the table (updateItemonly doessetVisible(!empty)) — and those keep a livesetOnAction(e -> action(e, COLUMN))handler. If the lookup lands on one, the synthesizedActionEventreachesAlignmentListInputEditor.action(), which doestableEntries.get(row.getIndex())with an index of-1, and the intended partition is never renamed. With no match at all, the cast failed with a bare NPE instead of a useful message.The lookup now iterates the candidates and picks the visible, non-empty cell whose
TableRowindex matches the requested row, throwing a descriptiveAssertionErrorif there is none. A(robot, row, col, string)overload was added; the existing three-arg form delegates to row 0, so no caller changes were needed.2.
BeautiSimpleTestadopting the new helper (cleanup, not a defect in this PR)BeautiSimpleTest.simpleTestrenames the tree with the sameclickOn(#treeModelCell)+eraseText(10)+write()sequence thatsetPartitionTableCellwas introduced to replace, then assertsassertStateEquals("Tree.t:tree", …). It now callssetPartitionTableCell(robot, 7, "tree")instead.To be clear about what this is:
BeautiSimpleTestis byte-identical before and after #144, does not callsetPartitionTableCell, and passes at the pre-#144 baseline — so it was not one of the tests failing in #143 and this is not an incomplete fix on your part. It is just consistency: one remaining copy of a pattern this PR establishes a better replacement for. If you'd prefer, I'll pull it out and raise it separately against master after #144 lands.Verification
mvn -pl beast-fx -am test-compilepasses.BeautiSimpleTestpasses with these changes (Tests run: 1, Failures: 0), and also passes unchanged atorigin/beautitests. Neither failure mode reproduces on a single isolated run on my machine, so treat both changes as hardening against timing/scene-graph-order dependence rather than as a demonstrated red→green fix.BeautiDivergenceDatingTestorBeautiCLITestagainst this branch.Note, not addressed here
All three
BeautiCLITestbodies sit insideif (!GraphicsEnvironment.isHeadless()). Under a headless run the bodies — including thef.exists() && f.length() > 0assertions — never execute, so those tests pass vacuously and the rewritten template is not actually exercised. Pre-existing, but worth knowing when judging whether CI verifies this PR's fix.