[squeak-dev] The Inbox: MorphicTests-pre.88.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Jul 19 14:33:52 UTC 2022


A new version of MorphicTests was added to project The Inbox:
http://source.squeak.org/inbox/MorphicTests-pre.88.mcz

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

Name: MorphicTests-pre.88
Author: pre
Time: 19 July 2022, 4:33:48.196163 pm
UUID: 0260d7ea-7bc6-1443-a2a0-4092a7aaebd2
Ancestors: MorphicTests-mt.87

A morphic test case that demonstrates a) that invalid Text instances can be constructed by adding more attributes than characters b) that there can be situations when TextMorph can not handle these objects (in particular when it tries to restore the editor selection when the TextMorph gets new content).

=============== Diff against MorphicTests-mt.87 ===============

Item was added:
+ ----- Method: TextMorphTest>>testHandlingInvalidTextObjects (in category 'tests') -----
+ testHandlingInvalidTextObjects
+ 	"It is possible to construct Text objects that have more attributes than characters. 
+ 	This can break the TextMorph when it tries to restore the text selection."
+ 	| textMorph emptyMethodText newEmptyMethodText |
+ 	textMorph := TextMorph new.
+ 	emptyMethodText := 'emptyMethod
+  ' asText.
+ 	textMorph newContents: emptyMethodText.
+ 	textMorph selectFrom: 13 to: 12.
+ 	self assert: textMorph selectionInterval start = 13.
+ 	newEmptyMethodText := 'emptyMethod
+ ' asText.
+ 	newEmptyMethodText addAttribute: TextColor red from: 2 to: 13.
+ 	textMorph newContents: newEmptyMethodText.!



More information about the Squeak-dev mailing list