Nicolas Cellier uploaded a new version of GraphicsTests to project The Trunk:
http://source.squeak.org/trunk/GraphicsTests-nice.40.mcz==================== Summary ====================
Name: GraphicsTests-nice.40
Author: nice
Time: 27 October 2016, 2:22:37.941587 am
UUID: 162ebb92-0acf-4b87-bd26-7d7edcc70476
Ancestors: GraphicsTests-tfel.39
Just after a space, if a word does not fit on current line, it is displayed on next line.
Then if user click right of the space on current line, then drag the selection down, the start characterBlock is somehow strange : it has its topLeft on current line, just right of the space, but its stringIndex will point on the next line.
We add a testBreakBeforeLongWord to assert this specific behavior.
=============== Diff against GraphicsTests-tfel.39 ===============
Item was added:
+ ----- Method: CharacterScannerTest>>testBreakBeforeLongWord (in category 'testing') -----
+ testBreakBeforeLongWord
+ | p text cbfirst cblast cbend cbend2 cbend1 cbspace |
+ text := ((String with: $m) , (String with: Character space) , (String new: 4 withAll: $m)) asText.
+ p := NewParagraph new.
+ p
+ compose: text
+ style: style
+ from: 1
+ in: (0 @ 0 corner: mWidth*4+(spaceWidth*2)+1 @ (style lineGrid * 4)).
+ self assert: p lines size = 2 description: 'In leftFlush alignment, a long word overflowing the right margin should flow on next line'.
+ self assert: p lines first last = 2 description: 'The space before the long word is on the first line'.
+
+ cbfirst := p characterBlockForIndex: 1.
+ cblast := p characterBlockForIndex: text size.
+ self assert: cblast origin y >= cbfirst corner y description: 'The long word coordinate is under the first line'.
+ cbend := p characterBlockForIndex: text size + 1.
+ self assert: cbend origin x >= cblast corner x description: 'Past end is located right of long word'.
+
+ cbend2 := p characterBlockAtPoint: 0 @ (cbend corner y + style lineGrid).
+ self assert: cbend = cbend2 description: 'Clicking below the second line gives the past end location'.
+ self assert: cbend origin = cbend2 origin.
+ self assert: cbend corner = cbend2 corner.
+
+ cbspace := p characterBlockForIndex: 2.
+ self assert: cbspace origin y = cbfirst origin y description: 'The space is on the first line'.
+
+ cbend1 := p characterBlockAtPoint: cbspace corner x + 1 @ cbspace center y.
+ self assert: cbend1 origin x >= cbspace corner x description: 'Clicking after the space starts right after the space'.
+ self assert: cbend1 origin y = cbspace origin y description: 'Clicking after the space starts on same line as the space'.
+ self assert: cbend1 stringIndex = 3 description: 'Clicking after the space starts on the long word'.
+
+ !