Skip to content

Commit

Permalink
Enrich scaledFont test
Browse files Browse the repository at this point in the history
  • Loading branch information
tinchodias committed Oct 20, 2023
1 parent 38ba134 commit 79e67b2
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/Alexandrie-Cairo-Tests/AeCairoContextTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,14 @@ AeCairoContextTest >> testPathExtents [
{ #category : #tests }
AeCairoContextTest >> testScaledFont [

| aSurface aContext scaledFont17 scaledFont71 scaledFont17b |
| aSurface aContext aCairoFontFace scaledFont17 scaledFont71 scaledFont17b |
aSurface := AeCairoImageSurface extent: 1@1.
aContext := aSurface newContext.

"Set up scaled font in the context"
aCairoFontFace := self newSourceSansProRegularFontFace.
aContext
fontFace: self newSourceSansProRegularFontFace;
fontFace: aCairoFontFace;
fontSize: 17.
scaledFont17 := aContext scaledFont.

Expand Down Expand Up @@ -298,6 +299,19 @@ AeCairoContextTest >> testScaledFont [

"Caching, also when switching back to fontSize=71 via #fontSize:"
aContext fontSize: 71.
self
assert: aContext scaledFont getHandle
equals: scaledFont71 getHandle.

"There isn't cache when same cairo font face but in new instance."
aContext fontFace: self newSourceSansProRegularFontFace.
self
deny: aContext scaledFont getHandle
equals: scaledFont71 getHandle.

"Getting back to original cairo font face instance, gets
cached scaled font face."
aContext fontFace: aCairoFontFace.
self
assert: aContext scaledFont getHandle
equals: scaledFont71 getHandle
Expand Down

0 comments on commit 79e67b2

Please sign in to comment.