[squeak-dev] The Trunk: ToolsTests-mt.98.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Tue Aug 4 08:54:45 UTC 2020


... "model or widget" because of the use of Object >> #perform:orSendTo:.

Best,
Marcel
Am 04.08.2020 10:52:39 schrieb commits at source.squeak.org <commits at source.squeak.org>:
Marcel Taeumel uploaded a new version of ToolsTests to project The Trunk:
http://source.squeak.org/trunk/ToolsTests-mt.98.mcz

==================== Summary ====================

Name: ToolsTests-mt.98
Author: mt
Time: 4 August 2020, 10:52:30.205047 am
UUID: c6795330-9d71-bd41-811f-76dec78f8ef6
Ancestors: ToolsTests-mt.97

Based on KernelTests-tcj.350 (inbox -> treated), add a test to check whether all menu actions are actually implemented in either model or widget.

Currently works for model's code-pane menus only. Test design requires agreement on communication between model and builder such as through #buildCodePaneWith:.

Not yet working for MVCToolBuilder. We do need to harmonize the interfaces of MenuMorph (Morphic) and PopUpMenu (MVC), e.g., by adding #items.

Not yet passing for MorphicToolBuilder bc. missing implementation of #makeProjectLink in either CodeHolder or PluggableTextMorph. :-)

=============== Diff against ToolsTests-mt.97 ===============

Item was changed:
SystemOrganization addCategory: #'ToolsTests-Browser'!
SystemOrganization addCategory: #'ToolsTests-Debugger'!
SystemOrganization addCategory: #'ToolsTests-FileList'!
SystemOrganization addCategory: #'ToolsTests-Inspector'!
+ SystemOrganization addCategory: #'ToolsTests-Menus'!

Item was added:
+ TestCase subclass: #ToolMenusTest
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'ToolsTests-Menus'!

Item was added:
+ ----- Method: ToolMenusTest>>testCodePaneMenu (in category 'tests') -----
+ testCodePaneMenu
+ "Checks whether all menu actions are implemented in either the model or the widget."
+
+ | builder builderSelector menuSelector result |
+ builder := ToolBuilder default.
+ builderSelector := #buildCodePaneWith:.
+ menuSelector := #menu.
+ result := Dictionary new.
+
+ Model withAllSubclasses
+ select: [:modelClass | modelClass includesSelector: builderSelector]
+ thenDo: [:modelClass |
+ | model spec widget menu selectors |
+ result at: modelClass put: OrderedCollection new.
+ model := modelClass new.
+ spec := model perform: builderSelector with: builder.
+ (spec respondsTo: menuSelector) ifFalse: [
+ "Little hack to allow code panes being wrapped in panels."
+ spec := spec children detect: [:child |
+ (child respondsTo: menuSelector) and: [(child perform: menuSelector) notNil]]].
+ [widget := builder build: spec] on: Error do: [:ex | ex resume: nil].
+ #(false true) do: [:shifted |
+ menu := builder build: (builder pluggableMenuSpec new items; yourself).
+ menu := model perform: spec menu withEnoughArguments: {menu. shifted}.
+ selectors := menu items collect: [:item | item selector].
+ "MVC: selectors := menu selections select: [:sel | sel isSymbol]"
+ (result at: modelClass)
+ addAll: (selectors reject: [:selector |
+ (model respondsTo: selector) or: [widget respondsTo: selector]])]].
+
+ self assert: (result values allSatisfy: [:notImplementedSelectors | notImplementedSelectors isEmpty]).!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200804/64826c6c/attachment.html>


More information about the Squeak-dev mailing list