Pharo test defects

SpMorphPresenterTest

State
Fixed (image fix)
Defect in
the Pharo image
Tests
1
Fix
image fix 20-SpMorphPresenterTest.st
Upstream repository
pharo-spec/Spec

Record

SpMorphPresenterTest>>testChangingHelpAffectTheWidget skipped itself ("It does not has sense here"). With the skip removed it failed on both VMs with "Got nil instead of 'ALabel'". Cause: SpMorphicMorphAdapter ignored SpMorphPresenter>>help, while the Label, Image, Athens and Button adapters put the presenter help on their morph as balloon text and follow whenHelpChangedDo:. Fix: add SpMorphicMorphAdapter>>applyHelpTo: (balloon text from the presenter help, localized; a presenter without help leaves the morph's own balloon text alone), call it from buildWidget and updateMorph:, subscribe to whenHelpChangedDo: in buildWidget, and remove the test override that skipped so the inherited SpAbstractWidgetAdapterTest test runs. Entries are guarded and idempotent.

Test Defect in State Cause
SpMorphPresenterTest>>testChangingHelpAffectTheWidget image-code repaired SpMorphicMorphAdapter never set the balloon text from presenter help; the test skipped instead of the adapter being repaired

Regression check: Ran with and without the fix on both ours and cog. SpMorphPresenterTest: 6 PASS + 1 SKIP before, 7 PASS after (both VMs). SpMorphStyleTest 7/7 before and after. SpPresenterTest 13/13 before and after. SpMorphicAdapterTest has no runnable tests (0 results before and after). I did not run the other adapter test classes.

Upstream note: Spec2: SpMorphicMorphAdapter applies the presenter help. SpMorphicMorphAdapter did not set balloon text from SpMorphPresenter>>help, so SpMorphPresenterTest>>testChangingHelpAffectTheWidget was skipped. The adapter now applies help to the wrapped morph (build, morph change, help change), and the skip override in the test is removed so the inherited SpAbstractWidgetAdapterTest test runs. Project: Spec2 (needs owner review before any PR).

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
SpMorphPresenterTest>>testChangingHelpAffectTheWidgetSKIPrepairedPASS 2xPASS 2xPASS 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)."
((SpMorphPresenterTest selector: #testChangingHelpAffectTheWidget) run) printString.

Source of the tests before the fix

SpMorphPresenterTest>>testChangingHelpAffectTheWidget before the fix (Pharo 14 build 791)
testChangingHelpAffectTheWidget
	"It does not has sense here"

	self skip

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-SpMorphPresenterTest.st (download)
"SpMorphicMorphAdapter ignored SpMorphPresenter>>help, so the inherited
 SpAbstractWidgetAdapterTest>>testChangingHelpAffectTheWidget was skipped in
 SpMorphPresenterTest with 'It does not has sense here'.  Every other adapter
 (Label, Image, Athens, Button) puts the presenter help on its morph as balloon
 text and follows whenHelpChangedDo:.  The Morph adapter does the same now, and
 the test override that skipped is removed so the inherited test runs."
add value: #SpMorphicMorphAdapter value: #applyHelpTo: value: 'private' value: 'applyHelpTo: aMorph
	"The presenter help becomes the balloon text of the wrapped morph.  A presenter without
	 help leaves the balloon text that the morph has itself."

	self presenter help ifNotNil: [ :aString |
		aMorph setBalloonText: (aString localizedForPresenter: self presenter) ]'.
fix value: #SpMorphicMorphAdapter value: #buildWidget
	value: [ :src | (src includesSubstring: 'applyHelpTo:') not ]
	value: 'buildWidget

	| newWidget |

	newWidget := self presenter morph 
		ifNil: [ Morph new color: Color transparent ].
	newWidget presenter: self presenter.
	self applyHelpTo: newWidget.

	self presenter whenMorphChangedDo: [ :aMorph | 
		self updateMorph: aMorph ].
	self presenter whenHelpChangedDo: [ 
		self widget ifNotNil: [ :w | self applyHelpTo: w ] ].
	
	^ newWidget'.
fix value: #SpMorphicMorphAdapter value: #updateMorph:
	value: [ :src | (src includesSubstring: 'applyHelpTo:') not ]
	value: 'updateMorph: aMorph

	self applyStyle: aMorph.
	aMorph presenter: self presenter.
	self applyHelpTo: aMorph.
	widget owner ifNotNil: [ :ownerMorph | 
		ownerMorph 
			replaceSubmorph: widget
			by: aMorph ].
	widget := aMorph'.
(SpMorphPresenterTest includesSelector: #testChangingHelpAffectTheWidget)
	ifTrue: [
		((SpMorphPresenterTest >> #testChangingHelpAffectTheWidget) sourceCode includesSubstring: 'self skip')
			ifTrue: [
				SpMorphPresenterTest removeSelector: #testChangingHelpAffectTheWidget.
				Stdio stdout nextPutAll: 'FIXED SpMorphPresenterTest>>testChangingHelpAffectTheWidget (skip override removed)'; lf; flush ]
			ifFalse: [ Stdio stdout nextPutAll: 'SKIP SpMorphPresenterTest>>testChangingHelpAffectTheWidget (not skipping)'; lf; flush ] ]
	ifFalse: [ Stdio stdout nextPutAll: 'SKIP SpMorphPresenterTest>>testChangingHelpAffectTheWidget (absent)'; lf; flush ].

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