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

Jakob Reschke forums.jakob at resfarm.de
Tue Aug 4 11:27:02 UTC 2020


This is nice to detect bad menus for a Squeak release. But it will fail if
you have a non-conforming third party Model loaded. On the other hand the
tests of that third party code will probably not fail. And they have no
easy easy to reuse this test facility for their own classes to make their
test suite fail. So: how about making the list of classes to test
overridable? The base implementation could either collect all the Model
subclasses as currently, or get only the classes of the Trunk packages.

Of course this is a different direction for new subclasses than what I
wrote in my other mail about subclasses for UI frameworks. So one of those
aspects should probably be in a different object (composition) or for now
just another test method.

<commits at source.squeak.org> schrieb am Di., 4. Aug. 2020, 10:52:

> 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/7fda5324/attachment.html>


More information about the Squeak-dev mailing list