Skip to content

Commit

Permalink
Fixing MicRichTextComposer
Browse files Browse the repository at this point in the history
  • Loading branch information
Ducasse committed Jan 18, 2024
1 parent d94f703 commit 0b894ad
Show file tree
Hide file tree
Showing 42 changed files with 524 additions and 455 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
Some specific microdown rich text integration tests.
"
Class {
#name : #ManifestMicrodownRichTextComposerTests,
#superclass : #PackageManifest,
#category : #'Microdown-RichTextComposer-Tests-Manifest'
#name : 'ManifestMicrodownRichTextComposerTests',
#superclass : 'PackageManifest',
#category : 'Microdown-RichTextComposer-Tests-Manifest',
#package : 'Microdown-RichTextComposer-Tests',
#tag : 'Manifest'
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
A MicCenterAllignmentBlockTest is a test class for testing the behavior of MicCenterAllignmentBlock
"
Class {
#name : #MicCenterAlignmentBlockTest,
#superclass : #TestCase,
#category : #'Microdown-RichTextComposer-Tests-BlockExtensions'
#name : 'MicCenterAlignmentBlockTest',
#superclass : 'TestCase',
#category : 'Microdown-RichTextComposer-Tests-BlockExtensions',
#package : 'Microdown-RichTextComposer-Tests',
#tag : 'BlockExtensions'
}

{ #category : #tests }
{ #category : 'tests' }
MicCenterAlignmentBlockTest >> testCenter [
| src doc center |
src := '
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
Class {
#name : #MicCodeSemanticActionTest,
#superclass : #TestCase,
#category : #'Microdown-RichTextComposer-Tests-Composer'
#name : 'MicCodeSemanticActionTest',
#superclass : 'TestCase',
#category : 'Microdown-RichTextComposer-Tests-Composer',
#package : 'Microdown-RichTextComposer-Tests',
#tag : 'Composer'
}

{ #category : #'test - bogus entry' }
{ #category : 'test - bogus entry' }
MicCodeSemanticActionTest >> semanticActionClass [

^ MicSemanticAction
]

{ #category : #'test - bogus entry' }
{ #category : 'test - bogus entry' }
MicCodeSemanticActionTest >> testArrayShouldNotBreak [

self deny: (self semanticActionClass fromTokens: #( 1 #+ 2 #* 3 )) hasEntity.
self deny: (self semanticActionClass fromTokens: #( 1 #+ 2 #* )) hasEntity
]

{ #category : #'test - bogus entry' }
{ #category : 'test - bogus entry' }
MicCodeSemanticActionTest >> testChevronWithBrokenArguments [

self assert: (self semanticActionClass fromTokens: #( Point #>> 2 )) entity isNil.
Expand All @@ -27,7 +29,7 @@ MicCodeSemanticActionTest >> testChevronWithBrokenArguments [
self assert: (self semanticActionClass fromTokens: #( Point #>> Point )) entity isNil
]

{ #category : #'test - bogus entry' }
{ #category : 'test - bogus entry' }
MicCodeSemanticActionTest >> testChevronWithBrokenReceiver [

self assert: (self semanticActionClass fromTokens: #( 1 #>> 2 )) entity isNil.
Expand All @@ -40,113 +42,113 @@ MicCodeSemanticActionTest >> testChevronWithBrokenReceiver [
self assert: (self semanticActionClass fromTokens: #( ClassThatDoesNotExist class #>> 2 )) entity isNil
]

{ #category : #'test - bogus entry' }
{ #category : 'test - bogus entry' }
MicCodeSemanticActionTest >> testDoubleDollars [

self deny: (self semanticActionClass from: '$$') hasEntity
]

{ #category : #'test - bogus entry' }
{ #category : 'test - bogus entry' }
MicCodeSemanticActionTest >> testEmptyString [

self deny: (self semanticActionClass from: '') hasEntity
]

{ #category : #'test - bogus entry' }
{ #category : 'test - bogus entry' }
MicCodeSemanticActionTest >> testGlobalAccess [

self assert: (self semanticActionClass fromTokens: #( Transcript )) hasEntity
"the semantics action is working even if it is refers to a global because the class of global is
used by the browse invocation when clicking on it. "
]

{ #category : #'test - bogus entry' }
{ #category : 'test - bogus entry' }
MicCodeSemanticActionTest >> testMoreSpaces [

self deny: (self semanticActionClass from: ' ') hasEntity
]

{ #category : #'test - bogus entry' }
{ #category : 'test - bogus entry' }
MicCodeSemanticActionTest >> testOneSpace [

self deny: (self semanticActionClass from: ' ') hasEntity
]

{ #category : #'tests - metaclass' }
{ #category : 'tests - metaclass' }
MicCodeSemanticActionTest >> testReferenceToABrokenMetaClass [

self assert: (self semanticActionClass from: 'Point2 class') entity isNil
]

{ #category : #'tests - metaclass' }
{ #category : 'tests - metaclass' }
MicCodeSemanticActionTest >> testReferenceToABrokenMetaClass2 [

self assert: (self semanticActionClass from: 'Point grgrgr') entity isNil
]

{ #category : #'tests - class' }
{ #category : 'tests - class' }
MicCodeSemanticActionTest >> testReferenceToAClass [

self
assert: (self semanticActionClass from: 'Point') entity
equals: Point
]

{ #category : #'tests - metaclass' }
{ #category : 'tests - metaclass' }
MicCodeSemanticActionTest >> testReferenceToAMetaClass [

self
assert: (self semanticActionClass from: 'Point class') entity
equals: Point class
]

{ #category : #'tests - methods' }
{ #category : 'tests - methods' }
MicCodeSemanticActionTest >> testReferenceToAMethod [

self
assert: (self semanticActionClass from: 'Point >> #setX:setY:') entity name
equals: 'Point>>#setX:setY:'
]

{ #category : #'tests - methods' }
{ #category : 'tests - methods' }
MicCodeSemanticActionTest >> testReferenceToANonExistingMethod [

self assert: (self semanticActionClass from: 'Point >> 12+3 ') entity isNil
]

{ #category : #'tests - methods' }
{ #category : 'tests - methods' }
MicCodeSemanticActionTest >> testReferenceToANonExistingMethodBecauseOfBogusClass [

self assert: (self semanticActionClass from: 'Point222 >> #setX:setY:') entity isNil
]

{ #category : #'tests - methods' }
{ #category : 'tests - methods' }
MicCodeSemanticActionTest >> testReferenceToANonExistingMethodBecauseOfNoSymbol [

self assert: (self semanticActionClass from: 'Point >> setX:setY2:') entity isNil
]

{ #category : #'tests - package' }
{ #category : 'tests - package' }
MicCodeSemanticActionTest >> testReferenceToANonExistingPackage [

self assert: (self semanticActionClass from: #Pillar) entity isNil
]

{ #category : #'tests - package' }
{ #category : 'tests - package' }
MicCodeSemanticActionTest >> testReferenceToAPackage [

self
assert: (self semanticActionClass from: #'''Microdown''') entity name
equals: 'Microdown'
]

{ #category : #'tests - class' }
{ #category : 'tests - class' }
MicCodeSemanticActionTest >> testReferenceToNonExistingClass [

self deny: (self semanticActionClass from: 'Point22') hasEntity
]

{ #category : #'test - bogus entry' }
{ #category : 'test - bogus entry' }
MicCodeSemanticActionTest >> testScannerShouldNotFail [

self deny: (self semanticActionClass from: 'half"baked') hasEntity.
Expand All @@ -155,7 +157,7 @@ MicCodeSemanticActionTest >> testScannerShouldNotFail [
self deny: (self semanticActionClass from: 16rFFFD asCharacter asString) hasEntity.
]

{ #category : #'test - bogus entry' }
{ #category : 'test - bogus entry' }
MicCodeSemanticActionTest >> testTwoBogusElements [

self assert:
Expand All @@ -166,7 +168,7 @@ MicCodeSemanticActionTest >> testTwoBogusElements [
(self semanticActionClass fromTokens: #( Point #foo )) entity isNil
]

{ #category : #'test - bogus entry' }
{ #category : 'test - bogus entry' }
MicCodeSemanticActionTest >> testTwoSpaces [

self deny: (self semanticActionClass from: ' ') hasEntity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
A MicDynamicTextStylerTest is a test class for testing the behavior of MicDynamicTextStyler
"
Class {
#name : #MicDynamicTextStylerTest,
#superclass : #TestCase,
#category : #'Microdown-RichTextComposer-Tests-Composer'
#name : 'MicDynamicTextStylerTest',
#superclass : 'TestCase',
#category : 'Microdown-RichTextComposer-Tests-Composer',
#package : 'Microdown-RichTextComposer-Tests',
#tag : 'Composer'
}

{ #category : #tests }
{ #category : 'tests' }
MicDynamicTextStylerTest >> testBodyFont [
| styler |
styler := MicDynamicTextStyler new.
Expand All @@ -17,7 +19,7 @@ MicDynamicTextStylerTest >> testBodyFont [
self assert: styler bodyFont pointSize equals: 72.
]

{ #category : #tests }
{ #category : 'tests' }
MicDynamicTextStylerTest >> testBulletForLevel [
| styler |
styler := MicDynamicTextStyler new.
Expand All @@ -27,17 +29,17 @@ MicDynamicTextStylerTest >> testBulletForLevel [
self assert: (styler bulletForLevel: 4) equals: 'a' asText.
]

{ #category : #tests }
{ #category : 'tests' }
MicDynamicTextStylerTest >> testBullets [
"I am not needed as I am tested by testCounterForAtLevel, but being here marks counters: as tested"
]

{ #category : #tests }
{ #category : 'tests' }
MicDynamicTextStylerTest >> testCodeBackgroundColor [

]

{ #category : #tests }
{ #category : 'tests' }
MicDynamicTextStylerTest >> testCounterForAtLevel [
| styler |
styler := MicDynamicTextStyler new.
Expand All @@ -48,12 +50,12 @@ MicDynamicTextStylerTest >> testCounterForAtLevel [
self assert: (styler counterFor: 5 atLevel: 5) equals: 'e)' asText.
]

{ #category : #tests }
{ #category : 'tests' }
MicDynamicTextStylerTest >> testCounters [
"I am not needed as I am tested by testCounterForAtLevel, but being here marks counters: as tested"
]

{ #category : #tests }
{ #category : 'tests' }
MicDynamicTextStylerTest >> testCrAfterHeader [
| styler |
styler := MicDynamicTextStyler new.
Expand All @@ -64,7 +66,7 @@ MicDynamicTextStylerTest >> testCrAfterHeader [

]

{ #category : #tests }
{ #category : 'tests' }
MicDynamicTextStylerTest >> testHeaderFontForLevel [
| styler |
styler := MicDynamicTextStyler new.
Expand All @@ -73,7 +75,7 @@ MicDynamicTextStylerTest >> testHeaderFontForLevel [
self assert: (styler headerLevelFont: 1) font pointSize equals: 72.
]

{ #category : #tests }
{ #category : 'tests' }
MicDynamicTextStylerTest >> testHeaderFontForLevel_wrongFormat [
| styler |
styler := MicDynamicTextStyler new.
Expand All @@ -82,15 +84,15 @@ MicDynamicTextStylerTest >> testHeaderFontForLevel_wrongFormat [

]

{ #category : #tests }
{ #category : 'tests' }
MicDynamicTextStylerTest >> testHeaderFontForLevel_wrongLevel [
| styler |
styler := MicDynamicTextStyler new.
styler headerFont: 'Source Sans Pro;72' forLevel: 9.
self assert: styler errors isNotEmpty
]

{ #category : #tests }
{ #category : 'tests' }
MicDynamicTextStylerTest >> testInterblockSpacing [
| styler |
styler := MicDynamicTextStyler new.
Expand All @@ -101,7 +103,7 @@ MicDynamicTextStylerTest >> testInterblockSpacing [
self assert: styler interBlockSpacing equals: (String cr, String cr) asText
]

{ #category : #tests }
{ #category : 'tests' }
MicDynamicTextStylerTest >> testKeepCRFromInput [
| styler textSample|
styler := MicDynamicTextStyler new.
Expand All @@ -112,7 +114,7 @@ MicDynamicTextStylerTest >> testKeepCRFromInput [

]

{ #category : #tests }
{ #category : 'tests' }
MicDynamicTextStylerTest >> testMonospaceBackgroundColor [
| styler |
styler := MicDynamicTextStyler new.
Expand All @@ -124,7 +126,7 @@ MicDynamicTextStylerTest >> testMonospaceBackgroundColor [

]

{ #category : #tests }
{ #category : 'tests' }
MicDynamicTextStylerTest >> testNewLineIfNotAlready [
| styler |
styler := MicDynamicTextStyler new.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Class {
#name : #MicMockBaselineOf,
#superclass : #BaselineOf,
#category : #'Microdown-RichTextComposer-Tests-Composer'
#name : 'MicMockBaselineOf',
#superclass : 'BaselineOf',
#category : 'Microdown-RichTextComposer-Tests-Composer',
#package : 'Microdown-RichTextComposer-Tests',
#tag : 'Composer'
}
Loading

0 comments on commit 0b894ad

Please sign in to comment.