Nicolas Cellier uploaded a new version of ST80 to project The Inbox:
http://source.squeak.org/inbox/ST80-nice.249.mcz ==================== Summary ==================== Name: ST80-nice.249 Author: nice Time: 7 March 2020, 10:15:56.235551 pm UUID: ab4fcf8c-acb9-4cde-83e0-57846e89aa42 Ancestors: ST80-mt.248 Let TestIndenting pass whatever custom tab stops. In some image, I have set the tab stops like that: (TextConstants at: #DefaultTabsArray) becomeForward: (32 to: 1536 by: 32) asArray. (TextConstants at: #DefaultMarginTabsArray) becomeForward: ((32 to: 768 by: 32) collect: [:i | {i. i}]). =============== Diff against ST80-mt.248 =============== Item was changed: ----- Method: TestIndenting>>testCR (in category 'tests') ----- testCR "Checks whether the beginning of a new line starts at the indented position" + | cb leftMargin | - | cb | para replaceFrom: 7 to: 7 with: (String with: Character cr) displaying: false. para clippingRectangle: (0@0 extent: 200@200). cb := para characterBlockForIndex: 8. + leftMargin := para textStyle leftMarginTabAt: 1. self assert: cb top > 0. + self assert: cb left = leftMargin! - self assert: cb left = 24! Item was changed: ----- Method: TestIndenting>>testCR3 (in category 'tests') ----- testCR3 "Checks whether the beginning of a new line starts at the indented position" + | cb leftMargin | - | cb | para replaceFrom: 11 to: 11 with: (Text string: (String with: Character cr) attribute: (TextIndent tabs: 1)) displaying: false. para clippingRectangle: (0@0 extent: 200@200). cb := para characterBlockForIndex: 12. + leftMargin := para textStyle leftMarginTabAt: 1. self assert: cb top > 0. + self assert: cb left = leftMargin! - self assert: cb left = 24! Item was changed: ----- Method: TestIndenting>>testNewLineAndTabProvidesDoubleIndent (in category 'tests') ----- testNewLineAndTabProvidesDoubleIndent "Checks whether the beginning of a new line starts at the indented position" + | cb leftMargin | - | cb | para replaceFrom: 11 to: 11 with: (Text string: (String with: Character cr) attribute: (TextIndent tabs: 1)) displaying: false. - cb := para characterBlockForIndex: 12. + leftMargin := para textStyle leftMarginTabAt: 1. self assert: cb top > 0. + self assert: cb left = leftMargin! - self assert: cb left = 24! Item was changed: ----- Method: TestIndenting>>testNewLineStartsIndented (in category 'tests') ----- testNewLineStartsIndented "Checks whether the beginning of a new line starts at the indented position" + | cb leftMargin | - | cb | para replaceFrom: 7 to: 7 with: (String with: Character cr) displaying: false. + leftMargin := para textStyle leftMarginTabAt: 1. - cb := para characterBlockForIndex: 8. self assert: cb top > 0. + self assert: cb left = leftMargin! - self assert: cb left = 24! Item was changed: ----- Method: TestIndenting>>testNewLineStartsIndentedWhenWrapped (in category 'tests') ----- testNewLineStartsIndentedWhenWrapped "Checks whether the beginning of a new line starts at the indented position" + | cb leftMargin | - | cb | para compositionRectangle: (0@0 extent: para width - 24@100); updateCompositionHeight. para clippingRectangle: (0@0 extent: 200@200). cb := para characterBlockForIndex: 8. + leftMargin := para textStyle leftMarginTabAt: 1. self assert: cb top > 0. + self assert: cb left = leftMargin! - self assert: cb left = 24! Item was changed: ----- Method: TestIndenting>>testSetUp (in category 'tests') ----- testSetUp "just reminding us all what the paragraph looks like to begin with. assuming Accuny12 font " + | cb firstTabStop | + firstTabStop := para textStyle nextTabXFrom: 1 leftMargin: 0 rightMargin: 200. - | cb | - cb := para characterBlockForIndex: 1. "p" self assert: cb top = 0. self assert: cb left = 0. self assert: cb right = 7. - cb := para characterBlockForIndex: 2. "the tab" self assert: cb top = 0. self assert: cb left = 7. + self assert: cb right = firstTabStop. - self assert: cb right = 24. - cb := para characterBlockForIndex: 3. "w" self assert: cb top = 0. + self assert: cb left = firstTabStop. + self assert: cb right = (firstTabStop + 10). - self assert: cb left = 24. - self assert: cb right = 34. cb := para characterBlockForIndex: 7. " " "between word and word" self assert: cb top = 0. + self assert: cb left = (firstTabStop + 28). + self assert: cb right = (firstTabStop + 33). - self assert: cb left = 52. - self assert: cb right = 57. cb := para characterBlockForIndex: 11. "d" "last char" self assert: cb top = 0. + self assert: cb left = (firstTabStop + 55). + self assert: cb right = (firstTabStop + 61). - self assert: cb left = 79. - self assert: cb right = 85. ! |
Free forum by Nabble | Edit this page |