[squeak-dev] The Inbox: Morphic-mt.1520.mcz

H. Hirzel hannes.hirzel at gmail.com
Tue Sep 17 11:52:14 UTC 2019


Hi Tom

I think also a good test is code inspection

you replace
    #contentsAsIs:
with
    #newContents:


contentsAsIs: stringOrText
	"Accept new text contents with line breaks only as in the text.
	Fit my width and height to the result."
	wrapFlag := false.
	container ifNotNil: [container fillsOwner ifTrue: [wrapFlag := true]].
	self newContents: stringOrText



newContents: stringOrText
	"Accept new text contents."
	| newText embeddedMorphs oldSelection |
	newText := stringOrText isString
		ifTrue: [Text fromString: stringOrText copy ]
		ifFalse: [ stringOrText copy asText.	"should be veryDeepCopy?" ].

	(text = newText and: [text runs = newText runs]) ifTrue: [^
self].	"No substantive change"
	text ifNotNil: [(embeddedMorphs := text embeddedMorphs)
			ifNotNil:
				[self removeAllMorphsIn: embeddedMorphs.
				embeddedMorphs do: [:m | m delete]]].

	oldSelection := editor ifNotNil: [:ed | ed selectionInterval].
	text := newText.

	"add all morphs off the visible region; they'll be moved into the right
	place when they become visible. (this can make the scrollable area too
	large, though)"
	newText embeddedMorphs do:
		[:m |
		self addMorph: m.
		m position: -1000 @ 0].
	self releaseParagraph.
	"update the paragraph cache"
	self paragraph.
	oldSelection ifNotNil: [:sel | self selectFrom: sel first to: sel last].
	"re-instantiate to set bounds"
	self world ifNotNil: [self world startSteppingSubmorphsOf: self]


>From this point of view I think it should be commited to trunk.

The test cases you prepare for TableLayout and the interplay with
TextMorph will be of good value.

Also tests like this https://wiki.squeak.org/squeak/2765 ?

Regards
Hannes

On 9/17/19, Beckmann, Tom <Tom.Beckmann at student.hpi.uni-potsdam.de> wrote:
> Hi Hannes,
>
> I'm currently compiling a list of testcases for the TableLayout, in
> particular also testing its interplay with the TextMorph. Are there any
> particular scenarios you'd like to see covered, maybe also verifying some
> legacy behavior in this case? If not, I'll just keep looking what makes
> sense to me and put it up on the inbox in a day or two, likely already
> assuming that this patch will land (and if it can't get merged for some
> reason, adjusting the tests).
>
> Best,
> Tom
> ________________________________________
> From: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> on behalf
> of H. Hirzel <hannes.hirzel at gmail.com>
> Sent: Monday, September 16, 2019 2:23 PM
> To: squeak-dev at lists.squeakfoundation.org
> Subject: Re: [squeak-dev] The Inbox: Morphic-mt.1520.mcz
>
> Good catch!
>
> Test cases?
>
> --Hannes
>
> On Mon, 16 Sep 2019 11:35:48 0000, commits at source.squeak.org
> <commits at source.squeak.org> wrote:
>> A new version of Morphic was added to project The Inbox:
>> http://source.squeak.org/inbox/Morphic-mt.1520.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Morphic-mt.1520
>> Author: mt
>> Time: 16 September 2019, 1:35:41.298794 pm
>> UUID: b3397a5b-4928-7647-80c7-f6ab8655445f
>> Ancestors: Morphic-mt.1519
>>
>> Avoid resetting wrapFlag or autoFit when setting new contents in
>> TextMorph.
>>
>> =============== Diff against Morphic-mt.1519 ===============
>>
>> Item was changed:
>>   ----- Method: TextMorph>>contents: (in category 'accessing') -----
>>   contents: stringOrText
>> +     ^ self newContents: stringOrText!
>> -     ^ self contentsAsIs: stringOrText!
>>
>>
>>
>
>
>


More information about the Squeak-dev mailing list