[squeak-dev] The Trunk: MorphicTests-mt.85.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Apr 5 14:53:40 UTC 2022
Marcel Taeumel uploaded a new version of MorphicTests to project The Trunk:
http://source.squeak.org/trunk/MorphicTests-mt.85.mcz
==================== Summary ====================
Name: MorphicTests-mt.85
Author: mt
Time: 5 April 2022, 4:53:39.334186 pm
UUID: f3f26703-4a52-4861-b543-bb410ed24a66
Ancestors: MorphicTests-mt.84
Fixes text-anchor layout tests.
=============== Diff against MorphicTests-mt.84 ===============
Item was changed:
TestCase subclass: #TextAnchorTest
+ instanceVariableNames: 'anchoredMorph anchorAttribute font text textMorph'
- instanceVariableNames: 'anchoredMorph anchorAttribute text textMorph'
classVariableNames: ''
poolDictionaries: ''
category: 'MorphicTests-Text Support'!
Item was changed:
----- Method: TextAnchorTest>>prepareTextMorph (in category 'utility') -----
prepareTextMorph
textMorph := text asMorph.
+ textMorph font: font.
self refreshTextMorph.!
Item was changed:
----- Method: TextAnchorTest>>setUp (in category 'running') -----
setUp
super setUp.
anchoredMorph := TextAnchorTestMorph new.
anchorAttribute := TextAnchor new anchoredMorph: anchoredMorph.
text := Text streamContents: [:stream |
stream
nextPutAll: 'Here is a contrived example ';
nextPutAll: (Text
string: Character startOfHeader asString
attributes: {
anchorAttribute.
TextColor color: Color transparent});
nextPutAll: ' whose morph is in the center.' ].
+ font := TextStyle defaultFont.
self prepareTextMorph.!
Item was changed:
----- Method: TextAnchorTest>>testHavingADocumentAnchorShouldNotAffectTheLineHeight (in category 'tests') -----
testHavingADocumentAnchorShouldNotAffectTheLineHeight
| firstLine |
anchoredMorph := Morph new.
+ anchoredMorph height: font height * 2.
- anchoredMorph height: 50.
anchoredMorph textAnchorProperties
positionInDocument: 20 @ 10;
anchorLayout: #document.
anchorAttribute anchoredMorph: anchoredMorph.
self prepareTextMorph.
firstLine := textMorph paragraph lines first.
self
+ assert: firstLine lineHeight < anchoredMorph height
- assert: (firstLine bottom - firstLine top) < 25
description: '#document layouted anchor should not affect line height'.
!
Item was changed:
----- Method: TextAnchorTest>>testPaddingBottom (in category 'tests-padding') -----
testPaddingBottom
self
after: [
anchoredMorph height: 20.
anchoredMorph textAnchorProperties verticalAlignment: #(bottom baseline).
anchoredMorph textAnchorProperties padding: (anchoredMorph textAnchorProperties padding bottom: 10)]
paddingChangesTo: [:line |
+ self assert: line baseline equals: anchoredMorph bottom + 10 ]!
- self assert: anchoredMorph bottom + 10 = line baseline ]!
Item was changed:
----- Method: TextAnchorTest>>testPaddingBottomAndBottom (in category 'tests-padding') -----
testPaddingBottomAndBottom
self
after: [
anchoredMorph height: 20.
anchoredMorph textAnchorProperties verticalAlignment: #(bottom bottom).
anchoredMorph textAnchorProperties padding: (anchoredMorph textAnchorProperties padding bottom: 10)]
paddingChangesTo: [:line |
+ self assert: line baseline + font descent "= visual line bottom" equals: anchoredMorph bottom + 10 ]!
- self assert: anchoredMorph bottom + 10 = line bottom ]!
Item was changed:
----- Method: TextAnchorTest>>testPaddingBottomAndBottomWithConvenienceAlignment (in category 'tests-padding') -----
testPaddingBottomAndBottomWithConvenienceAlignment
self
after: [
anchoredMorph height: 20.
anchoredMorph textAnchorProperties verticalAlignment: #bottom.
anchoredMorph textAnchorProperties padding: (anchoredMorph textAnchorProperties padding bottom: 10)]
paddingChangesTo: [:line |
+ self assert: line baseline + font descent "= visual line bottom" equals: anchoredMorph bottom + 10 ]!
- self assert: anchoredMorph bottom + 10 = line bottom ]!
Item was changed:
----- Method: TextAnchorTest>>testPaddingTop (in category 'tests-padding') -----
testPaddingTop
self
after: [
anchoredMorph height: 20.
anchoredMorph textAnchorProperties verticalAlignment: #(top baseline).
anchoredMorph textAnchorProperties padding: (anchoredMorph textAnchorProperties padding top: 10)]
+ paddingChangesTo: [:line |
+ self assert: line baseline equals: anchoredMorph top - 10 ]!
- paddingChangesTo: [:line | | anchoredMorphTop |
- anchoredMorphTop := anchoredMorph top - textMorph top.
- self assert: anchoredMorphTop - 10 = line baseline ]!
Item was changed:
----- Method: TextAnchorTest>>testPaddingTopAndBottom (in category 'tests-padding') -----
testPaddingTopAndBottom
self
after: [
anchoredMorph height: 30.
anchoredMorph textAnchorProperties verticalAlignment: #(#bottom #bottom).
anchoredMorph textAnchorProperties padding: (anchoredMorph textAnchorProperties padding bottom: 10).
anchoredMorph textAnchorProperties padding: (anchoredMorph textAnchorProperties padding top: 10).]
paddingChangesTo: [:line |
+ self assert: line baseline + font descent "= visual line bottom" equals: anchoredMorph bottom + 10.
+ self
+ deny: line baseline - font ascent "= visual line top"
+ equals: anchoredMorph top - 10
+ description: 'We only apply padding to the morph position'.]!
- self assert: anchoredMorph bottom + 10 = line bottom.
- self deny: anchoredMorph top - 10= line top description: 'We only apply padding to the morph position'.]!
Item was changed:
----- Method: TextAnchorTest>>testPaddingTopAndTop (in category 'tests-padding') -----
testPaddingTopAndTop
self
after: [
anchoredMorph height: 20.
+ anchoredMorph textAnchorProperties verticalAlignment: #(top top).
- anchoredMorph textAnchorProperties verticalAlignment: #(top baseline).
anchoredMorph textAnchorProperties padding: (anchoredMorph textAnchorProperties padding top: 10)]
+ paddingChangesTo: [:line |
+ self assert: line baseline - font ascent "= visual line top" equals: anchoredMorph top - 10 ]!
- paddingChangesTo: [:line | | anchoredMorphTop |
- anchoredMorphTop := anchoredMorph top - textMorph top.
- self assert: anchoredMorphTop - 10 = line baseline ]!
More information about the Squeak-dev
mailing list
|