scripts/image-fixes/20-presenter-examples.stSpDemo class>>example, SpComponentListSelectionExample class>>example, SpCodeEditorPresenter class>>example, MicTextPresenter class>>example, MicrodownPresenter class>>example, SpToolbarToggleButtonPresenter class>>example, SpMenuItemPresenter class>>example, SpMenuPresenter class>>exampleEach of the 8 presenter test classes inherits SpSmokeTest>>testExample, which skips when the presenter class under test has no class-side #example. The defect is missing image code: none of the 8 presenter classes (MicTextPresenter, MicrodownPresenter, SpCodeEditorPresenter, SpDemo, SpMenuItemPresenter, SpMenuPresenter, SpToolbarToggleButtonPresenter, SpComponentListSelectionExample) had #example. The fix adds one class-side #example to each. Six reuse existing sample code in the image (open or exampleSample, SpCodePresenter's text example, SpToolbarPresenter's toolbar pattern). The two menu examples are different. The existing exampleWithSubMenu and exampleWithGroups call openWithSpecAt:, which runs MenuMorph>>invokeAt:in:allowKeyboard:, a modal loop that waits for a user to dismiss the menu. That version timed out after 10 s on both VMs. So SpMenuItemPresenter class>>example and SpMenuPresenter class>>example host the menu in an SpMenuButtonPresenter inside a window (the same pattern as the existing exampleWithinMenuButton) and return the window. The test is not weakened.
| Test | Defect in | State | Cause |
|---|---|---|---|
MicTextPresenterTest>>testExample |
image-code | repaired | MicTextPresenter class has no #example |
MicrodownPresenterTest>>testExample |
image-code | repaired | MicrodownPresenter class has no #example |
SpCodeEditorPresenterTest>>testExample |
image-code | repaired | SpCodeEditorPresenter class has no #example (its superclass is SpPresenter, so it does not inherit SpCodePresenter class>>example) |
SpDemoTest>>testExample |
image-code | repaired | SpDemo class has #open with an <example> pragma but no #example |
SpMenuItemPresenterTest>>testExample |
image-code | repaired | SpMenuItemPresenter class has no #example. The existing popup-based exampleWithSubMenu is modal (10 s timeout), so the new example uses a menu button in a window. |
SpMenuPresenterTest>>testExample |
image-code | repaired | SpMenuPresenter class has no #example. The existing popup-based exampleWithGroups is modal (10 s timeout), so the new example uses a menu button in a window. |
SpToolbarToggleButtonMorphTest>>testExample |
image-code | repaired | SpToolbarToggleButtonPresenter class has no #example |
SpTransmissionWithComponentListTest>>testExample |
image-code | repaired | SpComponentListSelectionExample class has #open with an <example> pragma but no #example |
Regression check: All 8 owning test classes were run whole, on our VM (JIT build, vm-base/test_load_image) and on Cog, with the base image and with the fix image, with 60 s per test. On both VMs each class went from N PASS + 1 SKIP to N+1 PASS with nothing else changed. Counts (PASS before, then after): MicTextPresenterTest 21 to 22, MicrodownPresenterTest 25 to 26, SpCodeEditorPresenterTest 16 to 17, SpDemoTest 11 to 12, SpMenuItemPresenterTest 12 to 13, SpMenuPresenterTest 12 to 13, SpToolbarToggleButtonMorphTest 11 to 12, SpTransmissionWithComponentListTest 11 to 12. SpMenuBarPresenterTest (a subclass of SpMenuPresenter, which has its own #example) was 13 PASS before and after on both VMs. SpMockMenuPresenterTest produced no RT lines, so it was not measured; the class may not exist. Each testExample was run 3 times on each VM: 24 of 24 PASS on ours, 24 of 24 PASS on Cog. The ours-nojit VM was not run. The new methods are only added; no existing method was replaced, so no other test class covers a changed method.
Upstream note: Title: Add class-side #example to presenters that lack one (Spec2, Microdown, in the Pharo image). SpSmokeTest>>testExample skips whenever the presenter class does not respond to #example, so eight tests never ran: MicTextPresenter, MicrodownPresenter, SpCodeEditorPresenter, SpDemo, SpMenuItemPresenter, SpMenuPresenter, SpToolbarToggleButtonPresenter and SpComponentListSelectionExample. The PR adds an #example to each so the smoke test runs. The menu examples use SpMenuButtonPresenter so that the example window opens without a modal popup loop (MenuMorph>>invokeAt:in:allowKeyboard: does not return until the user dismisses the menu). This is a draft only; the owner must review it before any PR is opened. Nothing was submitted.
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.
| Test | Before | State | iospharo VM | Patched Cog | Stock Cog |
|---|---|---|---|---|---|
MicTextPresenterTest>>testExample | SKIP | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
MicrodownPresenterTest>>testExample | SKIP | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
SpCodeEditorPresenterTest>>testExample | SKIP | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
SpDemoTest>>testExample | SKIP | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
SpMenuItemPresenterTest>>testExample | SKIP | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
SpMenuPresenterTest>>testExample | SKIP | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
SpToolbarToggleButtonMorphTest>>testExample | SKIP | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
SpTransmissionWithComponentListTest>>testExample | SKIP | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
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)." ((MicTextPresenterTest selector: #testExample) run) printString. ((MicrodownPresenterTest selector: #testExample) run) printString. ((SpCodeEditorPresenterTest selector: #testExample) run) printString. ((SpDemoTest selector: #testExample) run) printString. ((SpMenuItemPresenterTest selector: #testExample) run) printString. ((SpMenuPresenterTest selector: #testExample) run) printString. ((SpToolbarToggleButtonMorphTest selector: #testExample) run) printString. ((SpTransmissionWithComponentListTest selector: #testExample) run) printString.
testExample "We do not use #shouldnt:raise: to get feedback on the CI" self flag: #todo. "All widgets should have an example. When it will be done remove this skip" (self classToTest respondsTo: #example) ifFalse: [ self skip ]. [ window := self classToTest example ] on: Error do: [ :e | self fail: 'Broken class example: ' , self classToTest asString , ' ' , e signalerContext shortStack ]
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.
"presenter-examples: eight presenter test classes skip testExample because the presenter class has no class-side #example. Each presenter gets one." add value: #'SpDemo class' value: #example value: 'examples' value: 'example "Open the demo window." ^ self open'. add value: #'SpComponentListSelectionExample class' value: #example value: 'examples' value: 'example "Open the component list selection example." ^ self open'. add value: #'SpCodeEditorPresenter class' value: #example value: 'examples' value: 'example "Show a code editor with a short text." ^ self new text: ''42 factorial''; open'. add value: #'MicTextPresenter class' value: #example value: 'examples' value: 'example "Show the Microdown sample document as rich text." ^ self exampleSample'. add value: #'MicrodownPresenter class' value: #example value: 'examples' value: 'example "Show the Microdown cheat sheet in an editable Microdown presenter." ^ self new document: MicTextPresenter cheetSheet; open'. add value: #'SpToolbarToggleButtonPresenter class' value: #example value: 'examples' value: 'example "Show a toolbar with two toggle buttons." | toolbar | toolbar := SpToolbarPresenter new. toolbar beBoth; add: (self new icon: (self iconNamed: #smallOk); label: ''Toggle''; yourself); add: (self new icon: (self iconNamed: #smallOk); label: ''Selected''; beSelected; yourself). ^ toolbar open'. add value: #'SpMenuItemPresenter class' value: #example value: 'examples' value: 'example "Show a button that opens a menu with items, one of them with a sub menu. The menu opens inside a window; a popup menu opened at a position runs a modal loop and does not return until the user dismisses the menu." | presenter menuButton | (presenter := SpPresenter new) layout: (SpBoxLayout newTopToBottom add: (SpBoxLayout newLeftToRight addLast: (menuButton := presenter newMenuButton) expand: false; yourself) expand: false; yourself). menuButton menu: [ SpMenuPresenter new addItem: [ :item | item name: ''Test 1''; action: [ "action" ] ]; addItem: [ :item | item name: ''Test 2''; subMenu: (SpMenuPresenter new addItem: [ :subMenuItem | subMenuItem name: ''SubMenu 1''; action: [ ] ]; addItem: [ :subMenuItem | subMenuItem name: ''SubMenu 2''; action: [ ] ]; yourself) ]; addItem: [ :item | item name: ''Test 3''; action: [ "action" ] ]; yourself ]. ^ presenter open'. add value: #'SpMenuPresenter class' value: #example value: 'examples' value: 'example "Show a button that opens a menu with two groups of items. The menu opens inside a window; a popup menu opened at a position runs a modal loop and does not return until the user dismisses the menu." | presenter menuButton | (presenter := SpPresenter new) layout: (SpBoxLayout newTopToBottom add: (SpBoxLayout newLeftToRight addLast: (menuButton := presenter newMenuButton) expand: false; yourself) expand: false; yourself). menuButton menu: [ SpMenuPresenter new addGroup: [ :group | group addItem: [ :item | item name: ''Group 1. Test 1''; action: [ "action" ] ]; addItem: [ :item | item name: ''Group 1. Test 2''; action: [ "action" ] ] ]; addGroup: [ :group | group addItem: [ :item | item name: ''Group 2. Test 1''; action: [ "action" ] ]; addItem: [ :item | item name: ''Group 2. Test 2''; action: [ "action" ] ] ]; yourself ]. ^ presenter open'.
State of 2026-11-20. Made from the test records of the iospharo project (a second Pharo VM). The fixes are proposals for review.