forked from pharo-project/pharo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
On TextColor
- Loading branch information
hilaire
committed
Sep 26, 2019
1 parent
c56f5f0
commit beb2724
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
Class { | ||
#name : #TextColorTest, | ||
#superclass : #TestCase, | ||
#category : #'Text-Tests-Base' | ||
} | ||
|
||
{ #category : #tests } | ||
TextColorTest >> testColor [ | ||
| textColor | | ||
textColor := TextColor new color: Color red. | ||
self assert: textColor color equals: Color red. | ||
self assert: textColor asColor equals: Color red. | ||
|
||
] | ||
|
||
{ #category : #tests } | ||
TextColorTest >> testDominates [ | ||
| text | | ||
self assert: (TextColor red dominates: TextColor yellow). | ||
self assert: (TextColor red dominates: TextColor red). | ||
self deny: (TextColor red dominates: TextEmphasis bold). | ||
self deny: (TextColor red dominates: TextFontChange font2). | ||
"In action" | ||
text := 'Pharo is cool' asText. | ||
text addAttribute: TextColor red. | ||
"Only one color at time, the last added color win" | ||
text addAttribute: TextColor yellow. | ||
self assert: (text attributesAt: 1) size equals: 1. | ||
self assert: (text attributesAt: 1) first color equals: Color yellow. | ||
"Can be both colored and bold" | ||
text addAttribute: TextEmphasis bold. | ||
self assert: (text attributesAt: 1) size equals: 2. | ||
self assert: (text attributesAt: 1) first color equals: Color yellow. | ||
self assert: (text attributesAt: 2) second emphasisCode equals: 1 | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters