Pharo test defects

StObjectTranscriptPresenterTest

State
Fixed (image fix)
Defect in
the test
Tests
1
Fix
image fix 20-StObjectTranscriptPresenterTest.st
Upstream repository
pharo-spec/NewTools

Record

The test called self skip because a remembered window extent could break it. SpPresenter class>>preferredExtent:/customExtent stores a resized window's extent per class, and a sibling test in the class run left 240@77 behind, so the unskipped test got 240@77 instead of 550@850 on both VMs. Run alone, the unskipped test already passed. The fix removes the skip, resets the remembered extent at the start (the author's own commented-out resetRememberedResizeExtent line), and restores the previous remembered extent and showInspector in the ensure block. The assertion is unchanged (initialExtent equals 550@850) and the window close is nil-safe.

Test Defect in State Cause
StObjectTranscriptPresenterTest>>testTrueShowInspectorShowsInspector test repaired self skip left in; the class-level remembered resize extent (customExtent) leaks between tests in the same run, so the test must reset it and restore it.

Regression check: Only a test method changed, no non-test method. Ran the whole StObjectTranscriptPresenterTest class on both VMs. Before the fix: 3 pass and 1 skip on ours and on Cog. After the fix, 3 runs on each VM: 4/4 pass every time. The other 3 tests are unchanged and still pass. I did not run other test classes.

Upstream note: Pharo, StObjectTranscriptPresenterTest>>testTrueShowInspectorShowsInspector: remove the self skip. The test now resets the remembered resize extent (StObjectTranscriptPresenter resetRememberedResizeExtent) before opening the window and restores the previous value and showInspector afterwards, so it passes whether or not an earlier test or the user resized the window. The assertion (initialExtent equals 550@850) is unchanged.

Results

Last full sweeps of 2026-11-17: iospharo (sweep14-new14) and stock Cog with the Cog changes (sweepcogp14-new10), with all image fixes. "Before" is the state of the test before the repairs. The Stock Cog column has a value only where the record measured stock Cog: "PASS 3 of 3 (repair run)" is the check of each repair on stock Cog v12.0.6 with the fix entry; "-" is not measured separately.

TestBeforeStateiospharo VMPatched CogStock Cog
StObjectTranscriptPresenterTest>>testTrueShowInspectorShowsInspectorSKIPrepairedPASSPASSPASS 3 of 3 (repair run)

Test

Run the tests in a Pharo 14 image (build 791). Before the fix they skip, fail or carry the expected-failure mark.

"Run in a Playground of a Pharo 14 image (Do it and print each line)."
((StObjectTranscriptPresenterTest selector: #testTrueShowInspectorShowsInspector) run) printString.

Source of the tests before the fix

StObjectTranscriptPresenterTest>>testTrueShowInspectorShowsInspector before the fix (Pharo 14 build 791)
testTrueShowInspectorShowsInspector
	"We wanted to show that the size of the window can dynamically be changed when the extend of the class presenter changes.
	However, in the current version of spec this is not possible. 
	A window can be resized using the resize: message but not the extent: on its presenter. 
	So a defaultPreferredExtent cannot dynamically change once the window is open."
	| st win current |

	"With the new changes that makes it so the window remembers its last state, this test will fail if the user has ever resized it."
	self skip.
	
	[
	current := StObjectTranscriptPresenter showInspector.
	"StObjectTranscriptPresenter resetRememberedResizeExtent."
	StObjectTranscriptPresenter showInspector: true.
	st := StObjectTranscriptPresenter new.
	st logger: StObjectTranscriptLogger instance.
	win := st asWindow.
	win resizable: false.
	win open.
	
	self assert: win initialExtent equals: 550 @ 850 ] ensure: [
		win close.
		StObjectTranscriptPresenter showInspector: current ]

Fix

How to apply an entries file: file in 00-header.st and the entries file as one chunk (the iospharo script scripts/gen-image-fixes.py makes that chunk). Each entry checks for the defect first and prints FIXED, ADDED or SKIP. Download 00-header.st.

20-StObjectTranscriptPresenterTest.st (download)
fix value: #StObjectTranscriptPresenterTest value: #testTrueShowInspectorShowsInspector value: [:s | s includesSubstring: 'self skip'] value: 'testTrueShowInspectorShowsInspector
	"The window extent is remembered per class when a window is resized (SpPresenter class>>preferredExtent:). Other tests open windows and can leave a remembered extent behind, so this test starts from the default extent and puts the remembered extent back afterwards."
	| st win current remembered |
	current := StObjectTranscriptPresenter showInspector.
	remembered := StObjectTranscriptPresenter instVarNamed: #customExtent.
	[
	StObjectTranscriptPresenter resetRememberedResizeExtent.
	StObjectTranscriptPresenter showInspector: true.
	st := StObjectTranscriptPresenter new.
	st logger: StObjectTranscriptLogger instance.
	win := st asWindow.
	win resizable: false.
	win open.
	self assert: win initialExtent equals: 550 @ 850 ] ensure: [
		win ifNotNil: [ win close ].
		StObjectTranscriptPresenter showInspector: current.
		StObjectTranscriptPresenter instVarNamed: #customExtent put: remembered ]'.

State of 2026-11-20. Made from the test records of the iospharo project (a second Pharo VM). The fixes are proposals for review.